From 982f2f0045c037934c9fdbe5f1fbea9a2ad99286 Mon Sep 17 00:00:00 2001 From: Joe Block Date: Fri, 26 Feb 2016 14:38:12 -0800 Subject: [PATCH 1/2] Set release default to the number of commits in the repo instead of always using 1 --- tools/mk_deb_fpmdir | 9 ++++++--- tools/mk_rpm_fpmdir | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tools/mk_deb_fpmdir b/tools/mk_deb_fpmdir index d5f98e3..9deb068 100755 --- a/tools/mk_deb_fpmdir +++ b/tools/mk_deb_fpmdir @@ -22,8 +22,11 @@ shift # Defaults that can be overridden: # All packages are 1.0 unless otherwise specifed: : ${PKGVERSION:=1.0} ; -# If there is no iteration setting, assume "1": -: ${PKGRELEASE:=1} +# If there is no iteration set, default to use the number of commits in the repository: +if [[ -z "${PKGRELEASE}" ]]; then + PKGRELEASE=$(git rev-list HEAD --count) +fi + # If there is no epoch, assume 0 : ${PKGEPOCH:=0} @@ -51,7 +54,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 diff --git a/tools/mk_rpm_fpmdir b/tools/mk_rpm_fpmdir index ead9503..c7d50c2 100755 --- a/tools/mk_rpm_fpmdir +++ b/tools/mk_rpm_fpmdir @@ -22,8 +22,11 @@ shift # Defaults that can be overridden: # All packages are 1.0 unless otherwise specifed: : ${PKGVERSION:=1.0} ; -# If there is no iteration setting, assume "1": -: ${PKGRELEASE:=1} +# If there is no iteration set, default to use the number of commits in the repository: +if [[ -z "${PKGRELEASE}" ]]; then + PKGRELEASE=$(git rev-list HEAD --count) +fi + # If there is no epoch, assume 0 : ${PKGEPOCH:=0} @@ -51,7 +54,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 From 673eaae95bae6e688602c0685a6f03f889941e92 Mon Sep 17 00:00:00 2001 From: Joe Block Date: Sat, 27 Feb 2016 06:50:50 -0800 Subject: [PATCH 2/2] Deal with being built within a burst tarball instead of a git clone --- tools/mk_deb_fpmdir | 5 +++++ tools/mk_rpm_fpmdir | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/tools/mk_deb_fpmdir b/tools/mk_deb_fpmdir index 9deb068..636679a 100755 --- a/tools/mk_deb_fpmdir +++ b/tools/mk_deb_fpmdir @@ -25,6 +25,11 @@ shift # If there is no iteration set, default to use the number of commits in the repository: if [[ -z "${PKGRELEASE}" ]]; then PKGRELEASE=$(git rev-list HEAD --count) + if [[ $? != 0 ]]; then + # We're not in a git repo, fall back to 1 so we cope with being built from + # a tarball + PKGRELEASE=1 + fi fi # If there is no epoch, assume 0 diff --git a/tools/mk_rpm_fpmdir b/tools/mk_rpm_fpmdir index c7d50c2..9683d6f 100755 --- a/tools/mk_rpm_fpmdir +++ b/tools/mk_rpm_fpmdir @@ -25,6 +25,11 @@ shift # If there is no iteration set, default to use the number of commits in the repository: if [[ -z "${PKGRELEASE}" ]]; then PKGRELEASE=$(git rev-list HEAD --count) + if [[ $? != 0 ]]; then + # We're not in a git repo, fall back to 1 so we cope with being built from + # a tarball + PKGRELEASE=1 + fi fi # If there is no epoch, assume 0