Make OUTPUTDIR overridable

Users (like me on my Jenkins server) may not want to put output debs and
rpms in ~.
This commit is contained in:
Joe Block
2016-02-26 13:28:01 -08:00
parent 9013350a68
commit e004ebb384
3 changed files with 27 additions and 12 deletions

View File

@@ -1,6 +1,8 @@
SHELL=/bin/sh SHELL=/bin/sh
PKGNAME=stack_blackbox PKGNAME=stack_blackbox
BASEDIR?=~
OUTPUTDIR?="$(BASEDIR)/debbuild-${PACKAGENAME}"
all: all:
@echo 'Menu:' @echo 'Menu:'
@@ -30,14 +32,14 @@ packages-rpm-debug:
@echo BUILD: @echo BUILD:
@PKGRELEASE=99 make packages @PKGRELEASE=99 make packages
@echo ITEMS TO BE PACKAGED: @echo ITEMS TO BE PACKAGED:
find ~/rpmbuild-$(PKGNAME)/installroot -type f find $(BASEDIR)/rpmbuild-$(PKGNAME)/installroot -type f
@echo ITEMS ACTUALLY IN PACKAGE: @echo ITEMS ACTUALLY IN PACKAGE:
@rpm -qpl $$(cat ~/rpmbuild-$(PKGNAME)/bin-packages.txt) @rpm -qpl $$(cat $(BASEDIR)/rpmbuild-$(PKGNAME)/bin-packages.txt)
local-rpm: local-rpm:
@PKGRELEASE=1 make packages @PKGRELEASE=1 make packages
-@sudo rpm -e $(PKGNAME) -@sudo rpm -e $(PKGNAME)
sudo rpm -i $$(cat ~/rpmbuild-$(PKGNAME)/bin-packages.txt) sudo rpm -i $$(cat $(BASEDIR)/rpmbuild-$(PKGNAME)/bin-packages.txt)
lock-rpm: lock-rpm:
sudo yum versionlock add $(PKGNAME) sudo yum versionlock add $(PKGNAME)
@@ -63,7 +65,7 @@ manual-uninstall:
# #
packages-deb: tools/mk_deb_fpmdir.stack_blackbox.txt packages-deb: tools/mk_deb_fpmdir.stack_blackbox.txt
cd tools && PKGRELEASE="$${PKGRELEASE}" PKGDESCRIPTION="Safely store secrets in git/hg/svn repos using GPG encryption" ./mk_deb_fpmdir stack_blackbox mk_deb_fpmdir.stack_blackbox.txt cd tools && OUTPUTDIR=$(OUTPUTDIR) PKGRELEASE="$${PKGRELEASE}" PKGDESCRIPTION="Safely store secrets in git/hg/svn repos using GPG encryption" ./mk_deb_fpmdir stack_blackbox mk_deb_fpmdir.stack_blackbox.txt
# Make mk_deb_fpmdir.vcs_blackbox.txt from mk_rpm_fpmdir.stack_blackbox.txt: # Make mk_deb_fpmdir.vcs_blackbox.txt from mk_rpm_fpmdir.stack_blackbox.txt:
tools/mk_deb_fpmdir.stack_blackbox.txt: tools/mk_rpm_fpmdir.stack_blackbox.txt tools/mk_deb_fpmdir.stack_blackbox.txt: tools/mk_rpm_fpmdir.stack_blackbox.txt
@@ -75,12 +77,12 @@ packages-deb-debug: tools/mk_deb_fpmdir.stack_blackbox.txt
@echo ITEMS TO BE PACKAGED: @echo ITEMS TO BE PACKAGED:
find ~/debbuild-$(PKGNAME)/installroot -type f find ~/debbuild-$(PKGNAME)/installroot -type f
@echo ITEMS ACTUALLY IN PACKAGE: @echo ITEMS ACTUALLY IN PACKAGE:
@dpkg --contents $$(cat ~/debbuild-$(PKGNAME)/bin-packages.txt) @dpkg --contents $$(cat $(BASEDIR)/debbuild-$(PKGNAME)/bin-packages.txt)
local-deb: local-deb:
@PKGRELEASE=1 make packages @PKGRELEASE=1 make packages
-@sudo dpkg -e $(PKGNAME) -@sudo dpkg -e $(PKGNAME)
sudo dpkg -i $$(cat ~/rpmbuild-$(PKGNAME)/bin-packages.txt) sudo dpkg -i $$(cat $(BASEDIR)/rpmbuild-$(PKGNAME)/bin-packages.txt)
# #
# MacPorts builds # MacPorts builds

View File

@@ -27,8 +27,14 @@ shift
# If there is no epoch, assume 0 # If there is no epoch, assume 0
: ${PKGEPOCH:=0} : ${PKGEPOCH:=0}
# Allow us to set a different OUTPUTDIR if we're building in CI/CD
if [[ -z "${OUTPUTDIR}" ]]; then
# The DEB is output here: (should be a place that can be wiped) # The DEB is output here: (should be a place that can be wiped)
OUTPUTDIR="${HOME}/debbuild-$PACKAGENAME" OUTPUTDIR="${HOME}/debbuild-${PACKAGENAME}"
else
echo "Using $OUTPUTDIR for OUTPUTDIR instead of ${HOME}/debbuild-${PACKAGENAME}"
fi
# The TeamCity templates expect to find the list of artifacts here: # The TeamCity templates expect to find the list of artifacts here:
DEB_BIN_LIST="${OUTPUTDIR}/bin-packages.txt" DEB_BIN_LIST="${OUTPUTDIR}/bin-packages.txt"
@@ -36,6 +42,7 @@ DEB_BIN_LIST="${OUTPUTDIR}/bin-packages.txt"
# Clean the output dir. # Clean the output dir.
rm -rf "$OUTPUTDIR" rm -rf "$OUTPUTDIR"
mkdir -p "$OUTPUTDIR/installroot" mkdir -p "$OUTPUTDIR/installroot"
# Copy the files into place: # Copy the files into place:

View File

@@ -27,8 +27,14 @@ shift
# If there is no epoch, assume 0 # If there is no epoch, assume 0
: ${PKGEPOCH:=0} : ${PKGEPOCH:=0}
# Allow us to set a different OUTPUTDIR if we're building in CI/CD
if [[ -z "${OUTPUTDIR}" ]]; then
# The RPM is output here: (should be a place that can be wiped) # The RPM is output here: (should be a place that can be wiped)
OUTPUTDIR="${HOME}/rpmbuild-$PACKAGENAME" OUTPUTDIR="${HOME}/rpmbuild-${PACKAGENAME}"
else
echo "Using $OUTPUTDIR for OUTPUTDIR instead of ${HOME}/rpmbuild-${PACKAGENAME}"
fi
# The TeamCity templates expect to find the list of artifacts here: # The TeamCity templates expect to find the list of artifacts here:
RPM_BIN_LIST="${OUTPUTDIR}/bin-packages.txt" RPM_BIN_LIST="${OUTPUTDIR}/bin-packages.txt"