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

@@ -27,8 +27,14 @@ shift
# If there is no epoch, assume 0
: ${PKGEPOCH:=0}
# The DEB is output here: (should be a place that can be wiped)
OUTPUTDIR="${HOME}/debbuild-$PACKAGENAME"
# 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)
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:
DEB_BIN_LIST="${OUTPUTDIR}/bin-packages.txt"
@@ -36,6 +42,7 @@ DEB_BIN_LIST="${OUTPUTDIR}/bin-packages.txt"
# Clean the output dir.
rm -rf "$OUTPUTDIR"
mkdir -p "$OUTPUTDIR/installroot"
# Copy the files into place:
@@ -51,7 +58,7 @@ cat """$@""" | while read -a arr ; do
DST="$OUTPUTDIR/installroot/${arr[1]}"
SRC="${arr[2]}"
if [[ $SRC == "cmd/"* || $SRC == *"/cmd/"* ]]; then
( cd $(dirname "$SRC" ) && go build -a -v )
( cd $(dirname "$SRC" ) && go build -a -v )
fi
install -D -T -b -m "$PERM" -T "$SRC" "$DST"
done

View File

@@ -27,8 +27,14 @@ shift
# If there is no epoch, assume 0
: ${PKGEPOCH:=0}
# The RPM is output here: (should be a place that can be wiped)
OUTPUTDIR="${HOME}/rpmbuild-$PACKAGENAME"
# 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)
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:
RPM_BIN_LIST="${OUTPUTDIR}/bin-packages.txt"
@@ -51,7 +57,7 @@ cat """$@""" | while read -a arr ; do
DST="$OUTPUTDIR/installroot/${arr[1]}"
SRC="${arr[2]}"
if [[ $SRC == "cmd/"* || $SRC == *"/cmd/"* ]]; then
( cd $(dirname "$SRC" ) && go build -a -v )
( cd $(dirname "$SRC" ) && go build -a -v )
fi
install -D -T -b -m "$PERM" -T "$SRC" "$DST"
done