Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 194F24196F5 for ; Tue, 6 Apr 2010 09:11:34 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2UkbZ6QdXLzv for ; Tue, 6 Apr 2010 09:11:32 -0700 (PDT) Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36]) by olra.theworths.org (Postfix) with ESMTP id 291C64196F0 for ; Tue, 6 Apr 2010 09:11:32 -0700 (PDT) Received: from localhost (unknown [192.168.200.4]) by max.feld.cvut.cz (Postfix) with ESMTP id 3B69419F3397; Tue, 6 Apr 2010 18:11:31 +0200 (CEST) X-Virus-Scanned: IMAP AMAVIS Received: from max.feld.cvut.cz ([192.168.200.1]) by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new, port 10044) with ESMTP id pU5mTLZ1KwGC; Tue, 6 Apr 2010 18:11:29 +0200 (CEST) Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34]) by max.feld.cvut.cz (Postfix) with ESMTP id 62E0419F335B; Tue, 6 Apr 2010 18:11:29 +0200 (CEST) Received: from steelpick.2x.cz (k335-30.felk.cvut.cz [147.32.86.30]) (Authenticated sender: sojkam1) by imap.feld.cvut.cz (Postfix) with ESMTPSA id DD6E415C062; Tue, 6 Apr 2010 18:11:28 +0200 (CEST) Received: from wsh by steelpick.2x.cz with local (Exim 4.71) (envelope-from ) id 1NzBNA-0004Ws-FJ; Tue, 06 Apr 2010 18:11:28 +0200 From: Michal Sojka To: Sebastian Spaeth , Carl Worth , notmuch@notmuchmail.org Subject: Re: [PATCH] Derive version numbers from git In-Reply-To: <87pr2c7pm1.fsf@SSpaeth.de> References: <87hbnpo1yu.fsf@yoom.home.cworth.org> <87y6h16lun.fsf@steelpick.2x.cz> <87pr2c7pm1.fsf@SSpaeth.de> Date: Tue, 06 Apr 2010 18:11:28 +0200 Message-ID: <87ochw7e8f.fsf@steelpick.2x.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2010 16:11:34 -0000 On Tue, 06 Apr 2010, Sebastian Spaeth wrote: > On 2010-04-06, Michal Sojka wrote: > > I often have several versions of notmuch compiled and it would be very > > helpful to be able to distinguish between them. Git has a very nice > > feature to make intermediate numbering automatic and unambiguous so > > let's use it here. > > But, there are people without git installed that download the release > tarball. So if this patch makes it, we need to replace this with a > static version number when baking a release tar. Right, here is an updated patch. It's more complicated than the previous one, but it solves the issue. -Michal --8<---------------cut here---------------start------------->8--- I often have several versions of notmuch compiled and it would be very helpful to be able to distinguish between them. Git has a very nice feature to make intermediate numbering automatic and unambiguous so let's use it here. For tagged versions, the version is the name of the tag, for intermediate versions, the unique ID of the commit is appended to the tag name. When notmuch is compiled from a release tarball, there is no git repository and therefore the tarball has to contain a special file 'version', which contains the correct version number. --- .gitignore | 1 + Makefile.local | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 95c50ec..b72ce72 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .first-build-message Makefile.config +Makefile.version TAGS tags *cscope* diff --git a/Makefile.local b/Makefile.local index 74f0f86..09fffa6 100644 --- a/Makefile.local +++ b/Makefile.local @@ -7,11 +7,14 @@ # digit when we reach particularly major milestones of usability. # # Between releases, (such as when compiling notmuch from the git -# repository), we add a third digit, (0.1.1, 0.1.2, etc.), and -# increment it occasionally, (such as after a big batch of commits are -# merged. +# repository), we let git to append identification of the actual +# commit. PACKAGE=notmuch -VERSION=0.1.1 +include Makefile.version + +.PHONY: Makefile.version +Makefile.version: + echo VERSION=$(if $(wildcard version),`cat version`,`git describe --dirty`) > $@ RELEASE_HOST=notmuchmail.org RELEASE_DIR=/srv/notmuchmail.org/www/releases @@ -61,8 +64,15 @@ ifeq ($(shell cat .first-build-message),) endif endif -$(TAR_FILE): - git archive --format=tar --prefix=$(PACKAGE)-$(VERSION)/ HEAD | gzip > $(TAR_FILE) +.PHONY: version # Always regenerate version +version: + git describe > $@ + +$(TAR_FILE): version + git archive --format=tar --prefix=$(PACKAGE)-$(VERSION)/ HEAD > $(TAR_FILE).tmp + tar --append -f $(TAR_FILE).tmp --transform s_^_$(PACKAGE)-$(VERSION)/_ version + rm version + gzip < $(TAR_FILE).tmp > $(TAR_FILE) @echo "Source is ready for release in $(TAR_FILE)" $(SHA1_FILE): $(TAR_FILE) @@ -263,4 +273,4 @@ install-zsh: $(call quiet_install_data, contrib/notmuch-completion.zsh $(DESTDIR)$(zsh_completion_dir)/notmuch) SRCS := $(SRCS) $(notmuch_client_srcs) -CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules) notmuch.elc notmuch.1.gz +CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules) notmuch.elc notmuch.1.gz version -- 1.7.0.2