From: Mark Walters Date: Sun, 26 Jan 2014 19:55:08 +0000 (+0000) Subject: Re: [PATCH 1/1] build: write VERSION file containing $(VERSION) string X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5715fbaed0002ce9993aa40f4f4326482bf2ce40;p=notmuch-archives.git Re: [PATCH 1/1] build: write VERSION file containing $(VERSION) string --- diff --git a/52/add19ba3f79b1864bec447ed500159b0cf6fc7 b/52/add19ba3f79b1864bec447ed500159b0cf6fc7 new file mode 100644 index 000000000..1bc326b4c --- /dev/null +++ b/52/add19ba3f79b1864bec447ed500159b0cf6fc7 @@ -0,0 +1,151 @@ +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 15FDC431FBD + for ; Sun, 26 Jan 2014 11:58:15 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled +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 ORnaaEApaEfC for ; + Sun, 26 Jan 2014 11:58:07 -0800 (PST) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 50BE9431FBC + for ; Sun, 26 Jan 2014 11:58:07 -0800 (PST) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1W7VqC-0002c4-2g; Sun, 26 Jan 2014 19:58:05 +0000 +Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71) + (envelope-from ) + id 1W7Vp3-0004aN-LL; Sun, 26 Jan 2014 19:56:49 +0000 +From: Mark Walters +To: Tomi Ollila , notmuch@notmuchmail.org +Subject: Re: [PATCH 1/1] build: write VERSION file containing $(VERSION) + string +In-Reply-To: <1390689800-16654-1-git-send-email-tomi.ollila@iki.fi> +References: <1390689800-16654-1-git-send-email-tomi.ollila@iki.fi> +User-Agent: Notmuch/0.15.2+484~gfb59956 (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Sun, 26 Jan 2014 19:55:08 +0000 +Message-ID: <87wqhm8qn7.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 93.97.24.31 +X-QM-Geographic: According to ripencc, + this message was delivered by a machine in Britain (UK) (GB). +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: c23e237f691b26f710ce5f7bc11d8048 (of first 20000 bytes) +X-SpamAssassin-Score: 0.0 +X-SpamAssassin-SpamBar: / +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored 0.0 points. Summary of the scoring: + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * 0.0 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +Cc: tomi.ollila@iki.fi +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: Sun, 26 Jan 2014 19:58:15 -0000 + + +Hi + +I experimented with this and it didn't always seem to rebuild VERSION +when it should. Looking at the file .git/HEAD that just seems to be the +branch name not the commit id (unless in detached HEAD state) + +This link +http://stackoverflow.com/questions/6526451/how-to-include-git-commit-number-into-a-c-executable +suggests adding .git/index to the VERSION depends. + +I tested that and that does seem to work. It may mean that VERSION gets +rebuilt if you stash (for example) but that is probably not a big +problem. + +Best wishes + +Mark + +On Sat, 25 Jan 2014, Tomi Ollila wrote: +> This version file will be as prerequisite to the target files +> that use the version info for some purpose, like printing +> it to the user to examine. The contents of the VERSION file +> is seldom read by the build system itself as the $(VERSION) +> variable has the same information. +> --- +> Makefile.local | 11 ++++++++++- +> 1 file changed, 10 insertions(+), 1 deletion(-) +> +> diff --git a/Makefile.local b/Makefile.local +> index c85e09c..1f876b3 100644 +> --- a/Makefile.local +> +++ b/Makefile.local +> @@ -22,6 +22,8 @@ VERSION:=$(shell cat ${srcdir}/version) +> ifeq ($(filter release release-message pre-release update-versions,$(MAKECMDGOALS)),) +> ifeq ($(IS_GIT),yes) +> VERSION:=$(shell git describe --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e s/-/~/) +> +# Make the 'VERSION' file depend *also* on .git/HEAD in this case +> +VERSION: .git/HEAD +> endif +> endif +> +> @@ -69,6 +71,11 @@ ifeq ($(shell cat .first-build-message 2>/dev/null),) +> endif +> endif +> +> +# This VERSION file is used mostly for triggering other file remakes... +> +# This may get other dependency to .git/HEAD above in this file. +> +VERSION: version +> + echo $(VERSION) > $@ +> + +> $(TAR_FILE): +> if git tag -v $(VERSION) >/dev/null 2>&1; then \ +> ref=$(VERSION); \ +> @@ -280,6 +287,8 @@ notmuch_client_srcs = \ +> +> notmuch_client_modules = $(notmuch_client_srcs:.c=.o) +> +> +notmuch.o: VERSION +> + +> notmuch: $(notmuch_client_modules) lib/libnotmuch.a util/libutil.a parse-time-string/libparse-time-string.a +> $(call quiet,CXX $(CFLAGS)) $^ $(FINAL_LIBNOTMUCH_LDFLAGS) -o $@ +> +> @@ -318,7 +327,7 @@ install-desktop: +> desktop-file-install --mode 0644 --dir "$(DESTDIR)$(desktop_dir)" notmuch.desktop +> +> SRCS := $(SRCS) $(notmuch_client_srcs) +> -CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules) notmuch.elc +> +CLEAN := $(CLEAN) VERSION notmuch notmuch-shared $(notmuch_client_modules) +> +> DISTCLEAN := $(DISTCLEAN) .first-build-message Makefile.config +> +> -- +> 1.8.5.3 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch