automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Integration of git-based release workflow into "make dist"


From: Roger Leigh
Subject: Re: Integration of git-based release workflow into "make dist"
Date: Fri, 14 Aug 2009 10:40:18 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

On Fri, Aug 14, 2009 at 12:07:39AM +0100, Roger Leigh wrote:
> This is a rough outline of what I'd like to do (unless someone beats
> me to it!)
> 
> • Add a dist-git option and Makefile target.
>   This will cause $distdir to be injected into git, rather than just
>   calling tar as for other git targets.
> 
> • This will require some additional options in order to work correctly:
>   · A branch name (the head to append the new tree to)
>   · [optional] Tag name, could be a pattern such as dist/$(VERSION)
>   · [optional] Flag for signing the tag or not
>   . [optional] Template commit message
>   These could all just be variables in the top-level Makefile.am.

An initial implementation follows.  This works, but it does need
further refinement (error checking, for example).  And probably
review by a git expert.  I'm sure other people can make it much
nicer, but this hopefully demonstrates the point.

The distributed release is put on a distribution branch, and its
parents are both the previous release and the current head.  i.e.
it's a merge of the old distributed release and the current release.
This lets you do easy merging of changes between both branches, with
a correct history.


Regards,
Roger


GIT_DIST_BRANCH=distrib
GIT_DIST_COMMIT_MESSAGE="Distribution of $(PACKAGE) version $(VERSION)"
GIT_DIST_TAG=true
GIT_DIST_TAG_NAME=dist/$(PACKAGE)-$(VERSION)
GIT_DIST_TAG_MESSAGE="Distributing $(PACKAGE)-$(VERSION)"

dist-git: distdir
        DISTDIR_INDEX=$(distdir).git.idx; \
        rm -f "$$DISTDIR_INDEX"; \
        GIT_INDEX_FILE="$$DISTDIR_INDEX" GIT_WORK_TREE="$(distdir)" git add -A; 
\
        GIT_INDEX_FILE="$$DISTDIR_INDEX" TREE="$$(git write-tree)"; \
        rm -f "$$DISTDIR_INDEX"; \
        DIST_HEAD="$$(git show-ref -s HEAD)"; \
        COMMIT_OPTS="-p $$DIST_HEAD"; \
        DIST_PARENT="$$(git show-ref --heads -s 
refs/heads/$(GIT_DIST_BRANCH))"; \
        if [ -n "$$DIST_PARENT" ]; then \
          COMMIT_OPTS="$$COMMIT_OPTS -p $$DIST_PARENT"; \
        fi; \
        COMMIT="$$(echo $(GIT_DIST_COMMIT_MESSAGE) | git commit-tree "$$TREE" 
$$COMMIT_OPTS)"; \
        git update-ref "refs/heads/$(GIT_DIST_BRANCH)" "$$COMMIT"; \
        TAG_OPTS=""; \
        if [ "$(GIT_DIST_TAG)" = "true" ]; then \
          TAG_OPTS="$$TAG_OPTS -s"; \
        fi; \
        git tag -m $(GIT_DIST_TAG_MESSAGE) $$TAG_OPTS "$(GIT_DIST_TAG_NAME)" 
"$$COMMIT";
        $(am__remove_distdir)


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]