[apparmor] [PATCH v3 3/5] Makefile: Convert shell variables into reusable make variables

Tyler Hicks tyhicks at canonical.com
Wed Jan 27 21:48:25 UTC 2016


On 2016-01-27 12:49:45, Steve Beattie wrote:
> On Wed, Jan 27, 2016 at 12:27:00PM -0600, Tyler Hicks wrote:
> > Turn REPO_VERSION and SNAPSHOT_DIR into make variables that may be
> > reused by future targets that specify the snapshot target as a
> > prerequisite. This prevents us from having to repeatedly call out to
> > potentially slow commands on bound bzr branches, such as the bzr
> > version-info command stored in the REPO_VERSION_CMD make variable.
> > 
> > The new REPO_VERSION make variable is turned into a "simply expanded"
> > variable as to not require a callout to bzr each time it is expanded.
> > 
> > The SNAPSHOT_DIR shell variable is renamed to SNAPSHOT_NAME as a make
> > variable. The new name may be slightly more descriptive in the future as
> > the variable will be reused in other ways besides a simple directory
> > name.
> > 
> > Signed-off-by: Tyler Hicks <tyhicks at canonical.com>
> Acked-by: Steve Beattie <steve at nxnw.org> (though it turns out we don't
> reuse the variables anywhere that I can see).

Thanks! You probably noticed but the next patch reuses SNAPSHOT_NAME in
the coverity target.

Tyler

> 
> Thanks.
> 
> > * Changes since v2:
> >   - Move REPO_VERSION and SNAPSHOT_NAME make variable definitions into the
> >     snapshot target instead of using the 'target-specific' variable technique.
> >     The reason is because target-specific simply expanded make variables are
> >     always evaluated, no matter if the target was specified or not. That was
> >     causing REPO_VERSION_CMD to always be ran, even when the snapshot target
> >     was not in use, which is slow on bound bzr branches.
> > 
> >  Makefile | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> > 
> > diff --git a/Makefile b/Makefile
> > index b9ed3b3..24cc2d2 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -45,11 +45,11 @@ tarball: clean
> >  
> >  .PHONY: snapshot
> >  snapshot: clean
> > -	REPO_VERSION=`$(value REPO_VERSION_CMD)` ; \
> > -	SNAPSHOT_DIR=apparmor-${VERSION}~$${REPO_VERSION} ;\
> > -	make export_dir __EXPORT_DIR=$${SNAPSHOT_DIR} __REPO_VERSION=$${REPO_VERSION} ; \
> > -	make setup __SETUP_DIR=$${SNAPSHOT_DIR} ; \
> > -	tar ${TAR_EXCLUSIONS} -cvzf $${SNAPSHOT_DIR}.tar.gz $${SNAPSHOT_DIR} ;
> > +	$(eval REPO_VERSION:=$(shell $(value REPO_VERSION_CMD)))
> > +	$(eval SNAPSHOT_NAME=apparmor-$(VERSION)~$(REPO_VERSION))
> > +	make export_dir __EXPORT_DIR=${SNAPSHOT_NAME} __REPO_VERSION=${REPO_VERSION} ; \
> > +	make setup __SETUP_DIR=${SNAPSHOT_NAME} ; \
> > +	tar ${TAR_EXCLUSIONS} -cvzf ${SNAPSHOT_NAME}.tar.gz ${SNAPSHOT_NAME} ;
> >  
> >  
> >  .PHONY: export_dir
> 
> -- 
> Steve Beattie
> <sbeattie at ubuntu.com>
> http://NxNW.org/~steve/



> -- 
> AppArmor mailing list
> AppArmor at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20160127/a3bf200c/attachment.pgp>


More information about the AppArmor mailing list