[Top][All Lists]

[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

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.


GIT_DIST_COMMIT_MESSAGE="Distribution of $(PACKAGE) version $(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 \
        fi; \
        COMMIT="$$(echo $(GIT_DIST_COMMIT_MESSAGE) | git commit-tree "$$TREE" 
        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)" 


  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux   
 `. `'   Printing on GNU/Linux?
   `-    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]