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 <[email protected]> --- * 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 -- 2.5.0 -- AppArmor mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
