From e98e3dde6a976a2c8f266ee963d6931fd4b37262 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 12 Feb 2016 05:36:55 +0000 Subject: [PATCH 1/2] Bugfix: Only use git for build info if the repository is actually the right one Also adds ability to disable check with BITCOIN_GENBUILD_NO_GIT=1 in the environment --- contrib/gitian-descriptors/gitian-linux.yml | 1 + contrib/gitian-descriptors/gitian-osx.yml | 1 + contrib/gitian-descriptors/gitian-win.yml | 1 + share/genbuild.sh | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index bba2104ed..ae36acfce 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -70,6 +70,7 @@ script: | done # Create the release tarball using (arbitrarily) the first host + export GIT_DIR="$PWD/.git" ./autogen.sh ./configure --prefix=${BASEPREFIX}/`echo "${HOSTS}" | awk '{print $1;}'` make dist diff --git a/contrib/gitian-descriptors/gitian-osx.yml b/contrib/gitian-descriptors/gitian-osx.yml index eb6df2096..04453527f 100644 --- a/contrib/gitian-descriptors/gitian-osx.yml +++ b/contrib/gitian-descriptors/gitian-osx.yml @@ -80,6 +80,7 @@ script: | done # Create the release tarball using (arbitrarily) the first host + export GIT_DIR="$PWD/.git" ./autogen.sh ./configure --prefix=${BASEPREFIX}/`echo "${HOSTS}" | awk '{print $1;}'` make dist diff --git a/contrib/gitian-descriptors/gitian-win.yml b/contrib/gitian-descriptors/gitian-win.yml index 97c823cde..95caa984e 100644 --- a/contrib/gitian-descriptors/gitian-win.yml +++ b/contrib/gitian-descriptors/gitian-win.yml @@ -73,6 +73,7 @@ script: | done # Create the release tarball using (arbitrarily) the first host + export GIT_DIR="$PWD/.git" ./autogen.sh ./configure --prefix=${BASEPREFIX}/`echo "${HOSTS}" | awk '{print $1;}'` make dist diff --git a/share/genbuild.sh b/share/genbuild.sh index ffa89ca6e..4965ef14c 100755 --- a/share/genbuild.sh +++ b/share/genbuild.sh @@ -16,7 +16,7 @@ fi DESC="" SUFFIX="" LAST_COMMIT_DATE="" -if [ -e "$(which git 2>/dev/null)" -a "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]; then +if [ "${BITCOIN_GENBUILD_NO_GIT}" != "1" -a -e "$(which git 2>/dev/null)" -a "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" -a "$(git status --porcelain -u no --ignored "$0" | cut -b1)" != "?" ]; then # clean 'dirty' status of touched files that haven't been modified git diff >/dev/null 2>/dev/null From ed1fcdcac0b9388b4e50f5e4ca2d5cd963f1ef27 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 29 Dec 2016 15:24:38 +0000 Subject: [PATCH 2/2] Bugfix: Detect genbuild.sh in repo correctly --- share/genbuild.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/share/genbuild.sh b/share/genbuild.sh index 2a7c5c888..7db5455f6 100755 --- a/share/genbuild.sh +++ b/share/genbuild.sh @@ -13,9 +13,13 @@ else exit 1 fi +git_check_in_repo() { + ! { git status --porcelain -uall --ignored "$@" 2>/dev/null || echo '??'; } | grep -q '?' +} + DESC="" SUFFIX="" -if [ "${BITCOIN_GENBUILD_NO_GIT}" != "1" -a -e "$(which git 2>/dev/null)" -a "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" -a "$(git status --porcelain -u no --ignored "$0" | cut -b1)" != "?" ]; then +if [ "${BITCOIN_GENBUILD_NO_GIT}" != "1" -a -e "$(which git 2>/dev/null)" -a "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ] && git_check_in_repo share/genbuild.sh; then # clean 'dirty' status of touched files that haven't been modified git diff >/dev/null 2>/dev/null