Re: [PATCH] build-system: use a shell variable for TMPFILE in debian-snapshot

Subject:Re: [PATCH] build-system: use a shell variable for TMPFILE in debian-snapshot

Date:Sun, 18 Dec 2011 10:48:44 +0200

To:David Bremner ,notmuch@notmuchmail.org

Cc:David Bremner

From:Tomi Ollila


On Sat, 17 Dec 2011 23:16:51 -0400, David Bremner <david@tethera.net> wrote:
> From: David Bremner <bremner@debian.org>
> 
> Aaron Ecay points out in
> id:"1324136185-4509-1-git-send-email-aaronecay@gmail.com" that the
> mktemp in
> 
>      debian-snapshot: TMPFILE := $(shell mktemp)
> 
> Is being evaluated for every target. As best I can tell, this is
> because make is evaluating the right hand side, even though it is not
> doing the assignment.
> 
> Of course, it isn't quite as nice to edit with the line continuations,
> but it is ideomatic make.
> ---

I was originally suggesting to add 'set -e' and trap 'cleanup' 0
to the code but that starts looking ever messier. In case of
debian-snapshot: one needs to check whether output is procuded
as it should be; building this goal will always exit with
zero value (provided that last echo ... succeeds).

Ok, provided that the above is OK with this particular target.

(please push fast, I'm tired with all the /tmp/tmp.XXXXXX files
I've got to clean up so far >;)

Tomi

>  Makefile.local |   15 ++++++++-------
>  1 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/Makefile.local b/Makefile.local
> index 5108a0c..97f397f 100644
> --- a/Makefile.local
> +++ b/Makefile.local
> @@ -139,15 +139,16 @@ pre-release:
>  	mv $(TAR_FILE) $(DEB_TAR_FILE) releases
>  
>  .PHONY: debian-snapshot
> -debian-snapshot: TMPFILE := $(shell mktemp)
>  debian-snapshot:
>  	make VERSION=$(VERSION) clean
> -	cp debian/changelog $(TMPFILE)
> -	EDITOR=/bin/true dch -b -v $(VERSION)+1 -D UNRELEASED 'test build, not for upload'
> -	echo '3.0 (native)' > debian/source/format
> -	debuild -us -uc
> -	mv -f $(TMPFILE) debian/changelog
> -	echo '3.0 (quilt)' > debian/source/format
> +	TMPFILE=$$(mktemp /tmp/notmuch.XXXXXX);		\
> +	  cp debian/changelog $${TMPFILE};		\
> +	  EDITOR=/bin/true dch -b -v $(VERSION)+1	\
> +	    -D UNRELEASED 'test build, not for upload';	\
> +	  echo '3.0 (native)' > debian/source/format; 	\
> +	  debuild -us -uc;				\
> +	  mv -f $${TMPFILE} debian/changelog;		\
> +	  echo '3.0 (quilt)' > debian/source/format
>  
>  .PHONY: release-message
>  release-message:
> -- 
> 1.7.7.3

Thread: