diff --git a/arcanist/.phutil_module_cache b/arcanist/.phutil_module_cache index ef8052d8c..40f7e319a 100644 --- a/arcanist/.phutil_module_cache +++ b/arcanist/.phutil_module_cache @@ -1 +1 @@ -{"__symbol_cache_version__":11,"ae5b7d3d6b8cf9598ce4abaf0cd56b21":{"have":{"class":{"ExtendedConfigurationDrivenLintEngine":19}},"need":{"function":{"newv":159,"pht":933},"class":{"ArcanistLintEngine":65,"ArcanistConfigurationDrivenLintEngine":171,"PhutilConsole":866},"class\/interface":{"ILintOnce":634}},"xmap":{"ExtendedConfigurationDrivenLintEngine":["ArcanistLintEngine"]}},"2809b09d2021203b43c57da33d1fe8bf":{"have":{"class":{"AssertWithSideEffectsLinter":210}},"need":{"function":{"pht":439},"class":{"ArcanistLinter":246,"ArcanistLintSeverity":926,"Filesystem":1170}},"xmap":{"AssertWithSideEffectsLinter":["ArcanistLinter"]}},"90a8b110dc475955f15bb81d37268cb5":{"have":{"class":{"AutoPEP8FormatLinter":75}},"need":{"function":{"pht":297,"execx":769,"id":1903},"class":{"ArcanistExternalLinter":104,"ArcanistLintMessage":1910,"Filesystem":1754,"ArcanistLinter":2017,"ArcanistLintSeverity":2095}},"xmap":{"AutoPEP8FormatLinter":["ArcanistExternalLinter"]}},"5ea58c19df0397ed8ee0f463d90d6c72":{"have":{"class":{"BoostDependenciesLinter":145}},"need":{"function":{"pht":330,"id":1440},"class":{"GlobalExternalLinter":177,"ArcanistLintMessage":1447,"Filesystem":609,"ArcanistLinter":1524,"ArcanistLintSeverity":1624}},"xmap":{"BoostDependenciesLinter":["GlobalExternalLinter"]}},"38f0c676bff5192a344464142caaa253":{"have":{"class":{"CHeaderLinter":99}},"need":{"function":{"pht":611},"class":{"ArcanistLinter":121,"ArcanistLintSeverity":1060,"Filesystem":1307}},"xmap":{"CHeaderLinter":["ArcanistLinter"]}},"9bb48ec0fe2e9ced8e27d42540d0571c":{"have":{"class":{"CheckDocLinter":106}},"need":{"function":{"pht":321,"id":1845},"class":{"GlobalExternalLinter":129,"ArcanistLintMessage":1852,"Filesystem":729,"ArcanistLinter":1900,"ArcanistLintSeverity":1986}},"xmap":{"CheckDocLinter":["GlobalExternalLinter"]}},"63d19a8745cb2e1200cc26488dc7ad25":{"have":{"class":{"CheckRpcMappingsLinter":131}},"need":{"function":{"pht":310,"id":1386},"class":{"GlobalExternalLinter":162,"ArcanistLintMessage":1393,"Filesystem":573,"ArcanistLinter":1443,"ArcanistLintSeverity":1544}},"xmap":{"CheckRpcMappingsLinter":["GlobalExternalLinter"]}},"1c03a4631b02b8e1ebcc3a078dc1e4af":{"have":{"class":{"ClangFormatLinter":79}},"need":{"function":{"pht":302,"execx":781,"id":2235},"class":{"ArcanistExternalLinter":105,"ArcanistLintMessage":2242,"Filesystem":2086,"ArcanistLinter":2349,"ArcanistLintSeverity":2427}},"xmap":{"ClangFormatLinter":["ArcanistExternalLinter"]}},"75579a609dd975aa0226add52700c622":{"have":{"class":{"FileNameLinter":103}},"need":{"function":{"pht":307},"class":{"ArcanistLinter":126,"ArcanistLintSeverity":662,"Filesystem":968}},"xmap":{"FileNameLinter":["ArcanistLinter"]}},"9285ad9415f8ebe564f7119e5a72c559":{"have":{"class":{"FormatStringLinter":146}},"need":{"function":{"pht":377,"csprintf":1492,"id":1872},"class":{"ArcanistExternalLinter":173,"ArcanistLintMessage":1879,"Filesystem":827,"ArcanistLinter":1956,"ArcanistLintSeverity":2044}},"xmap":{"FormatStringLinter":["ArcanistExternalLinter"]}},"2e11dd9ad67e594f863bc46ac59ea37e":{"have":{"class":{"GlobalExternalLinter":199}},"need":{"class":{"ArcanistExternalLinter":228},"interface":{"ILintOnce":262}},"xmap":{"GlobalExternalLinter":["ArcanistExternalLinter","ILintOnce"]}},"b2403124ec3e8be6cb4d10bf0f6c4134":{"have":{"interface":{"ILintOnce":69}},"need":[],"xmap":[]},"1f9bac7956f4f948a187828dcc6ba2d0":{"have":{"class":{"IncludeGuardLinter":98}},"need":{"function":{"pht":368},"class":{"ArcanistLinter":125,"ArcanistLintSeverity":721,"Filesystem":970}},"xmap":{"IncludeGuardLinter":["ArcanistLinter"]}},"2cbb6e7228d81557f777ad648704f343":{"have":{"class":{"IncludeQuotesLinter":100}},"need":{"function":{"pht":306},"class":{"ArcanistLinter":128,"ArcanistLintSeverity":663,"Filesystem":964}},"xmap":{"IncludeQuotesLinter":["ArcanistLinter"]}},"f151089cf79fdb8257b2272ed4782d88":{"have":{"class":{"IncludeSourceLinter":99}},"need":{"function":{"pht":391},"class":{"ArcanistLinter":127,"ArcanistLintSeverity":699,"Filesystem":938}},"xmap":{"IncludeSourceLinter":["ArcanistLinter"]}},"8a0f2ba683e96feeb9d9564af01fe3e7":{"have":{"class":{"LocaleDependenceLinter":160}},"need":{"function":{"pht":5460},"class":{"ArcanistLinter":191,"ArcanistLintSeverity":5963,"Filesystem":6209}},"xmap":{"LocaleDependenceLinter":["ArcanistLinter"]}},"6f2f22dd0f259fb2eaa284b4fab3bc29":{"have":{"class":{"PythonFormatLinter":123}},"need":{"function":{"pht":353,"id":1838},"class":{"ArcanistExternalLinter":150,"ArcanistLintMessage":1845,"Filesystem":776,"ArcanistLinter":1970,"ArcanistLintSeverity":2053}},"xmap":{"PythonFormatLinter":["ArcanistExternalLinter"]}},"03cf226fe177a9fce7dc046816cc466b":{"have":{"class":{"PythonOpenFileEncodingLinter":111}},"need":{"function":{"pht":325},"class":{"ArcanistLinter":148,"ArcanistLintSeverity":687,"Filesystem":991}},"xmap":{"PythonOpenFileEncodingLinter":["ArcanistLinter"]}},"454160ed72e88797129d84ee589de304":{"have":{"class":{"PythonShebangLinter":87}},"need":{"function":{"pht":290},"class":{"ArcanistLinter":115,"ArcanistLintSeverity":614,"Filesystem":854}},"xmap":{"PythonShebangLinter":["ArcanistLinter"]}},"899b8be78da0be470965682eaa31f00a":{"have":{"class":{"ShellCheckLinter":95}},"need":{"function":{"pht":1835,"id":3051},"class":{"ArcanistExternalLinter":120,"ArcanistLintMessage":3058,"ArcanistLintSeverity":1560,"ArcanistLinter":3106}},"xmap":{"ShellCheckLinter":["ArcanistExternalLinter"]}},"09a933fbbf135320585be52750d93831":{"have":{"class":{"StdintLinter":90}},"need":{"function":{"pht":280},"class":{"ArcanistLinter":111,"ArcanistLintSeverity":589,"Filesystem":897}},"xmap":{"StdintLinter":["ArcanistLinter"]}},"25781df78f6eebfb223296b8265e9d19":{"have":{"class":{"TestsLinter":103}},"need":{"function":{"pht":318,"id":2629},"class":{"ArcanistExternalLinter":123,"ArcanistLintMessage":2636,"Filesystem":776,"ArcanistLinter":2684,"ArcanistLintSeverity":2792}},"xmap":{"TestsLinter":["ArcanistExternalLinter"]}},"4c4adcac26dddfa5e350b85a40097755":{"have":{"class":{"BashShebangLinter":82}},"need":{"function":{"pht":281},"class":{"ArcanistLinter":108,"ArcanistLintSeverity":597,"Filesystem":837}},"xmap":{"BashShebangLinter":["ArcanistLinter"]}}} \ No newline at end of file +{"__symbol_cache_version__":11,"ae5b7d3d6b8cf9598ce4abaf0cd56b21":{"have":{"class":{"ExtendedConfigurationDrivenLintEngine":19}},"need":{"function":{"newv":159,"pht":933},"class":{"ArcanistLintEngine":65,"ArcanistConfigurationDrivenLintEngine":171,"PhutilConsole":866},"class\/interface":{"ILintOnce":634}},"xmap":{"ExtendedConfigurationDrivenLintEngine":["ArcanistLintEngine"]}},"2809b09d2021203b43c57da33d1fe8bf":{"have":{"class":{"AssertWithSideEffectsLinter":210}},"need":{"function":{"pht":439},"class":{"ArcanistLinter":246,"ArcanistLintSeverity":926,"Filesystem":1170}},"xmap":{"AssertWithSideEffectsLinter":["ArcanistLinter"]}},"90a8b110dc475955f15bb81d37268cb5":{"have":{"class":{"AutoPEP8FormatLinter":75}},"need":{"function":{"pht":297,"execx":769,"id":1903},"class":{"ArcanistExternalLinter":104,"ArcanistLintMessage":1910,"Filesystem":1754,"ArcanistLinter":2017,"ArcanistLintSeverity":2095}},"xmap":{"AutoPEP8FormatLinter":["ArcanistExternalLinter"]}},"4c4adcac26dddfa5e350b85a40097755":{"have":{"class":{"BashShebangLinter":82}},"need":{"function":{"pht":281},"class":{"ArcanistLinter":108,"ArcanistLintSeverity":597,"Filesystem":837}},"xmap":{"BashShebangLinter":["ArcanistLinter"]}},"5ea58c19df0397ed8ee0f463d90d6c72":{"have":{"class":{"BoostDependenciesLinter":145}},"need":{"function":{"pht":330,"id":1440},"class":{"GlobalExternalLinter":177,"ArcanistLintMessage":1447,"Filesystem":609,"ArcanistLinter":1524,"ArcanistLintSeverity":1624}},"xmap":{"BoostDependenciesLinter":["GlobalExternalLinter"]}},"38f0c676bff5192a344464142caaa253":{"have":{"class":{"CHeaderLinter":99}},"need":{"function":{"pht":611},"class":{"ArcanistLinter":121,"ArcanistLintSeverity":1060,"Filesystem":1307}},"xmap":{"CHeaderLinter":["ArcanistLinter"]}},"9bb48ec0fe2e9ced8e27d42540d0571c":{"have":{"class":{"CheckDocLinter":106}},"need":{"function":{"pht":321,"id":1845},"class":{"GlobalExternalLinter":129,"ArcanistLintMessage":1852,"Filesystem":729,"ArcanistLinter":1900,"ArcanistLintSeverity":1986}},"xmap":{"CheckDocLinter":["GlobalExternalLinter"]}},"63d19a8745cb2e1200cc26488dc7ad25":{"have":{"class":{"CheckRpcMappingsLinter":131}},"need":{"function":{"pht":310,"id":1386},"class":{"GlobalExternalLinter":162,"ArcanistLintMessage":1393,"Filesystem":573,"ArcanistLinter":1443,"ArcanistLintSeverity":1544}},"xmap":{"CheckRpcMappingsLinter":["GlobalExternalLinter"]}},"1c03a4631b02b8e1ebcc3a078dc1e4af":{"have":{"class":{"ClangFormatLinter":79}},"need":{"function":{"pht":302,"execx":781,"id":2235},"class":{"ArcanistExternalLinter":105,"ArcanistLintMessage":2242,"Filesystem":2086,"ArcanistLinter":2349,"ArcanistLintSeverity":2427}},"xmap":{"ClangFormatLinter":["ArcanistExternalLinter"]}},"75579a609dd975aa0226add52700c622":{"have":{"class":{"FileNameLinter":103}},"need":{"function":{"pht":307},"class":{"ArcanistLinter":126,"ArcanistLintSeverity":662,"Filesystem":968}},"xmap":{"FileNameLinter":["ArcanistLinter"]}},"9285ad9415f8ebe564f7119e5a72c559":{"have":{"class":{"FormatStringLinter":146}},"need":{"function":{"pht":377,"csprintf":1492,"id":1872},"class":{"ArcanistExternalLinter":173,"ArcanistLintMessage":1879,"Filesystem":827,"ArcanistLinter":1956,"ArcanistLintSeverity":2044}},"xmap":{"FormatStringLinter":["ArcanistExternalLinter"]}},"2e11dd9ad67e594f863bc46ac59ea37e":{"have":{"class":{"GlobalExternalLinter":199}},"need":{"class":{"ArcanistExternalLinter":228},"interface":{"ILintOnce":262}},"xmap":{"GlobalExternalLinter":["ArcanistExternalLinter","ILintOnce"]}},"b2403124ec3e8be6cb4d10bf0f6c4134":{"have":{"interface":{"ILintOnce":69}},"need":[],"xmap":[]},"1f9bac7956f4f948a187828dcc6ba2d0":{"have":{"class":{"IncludeGuardLinter":98}},"need":{"function":{"pht":368},"class":{"ArcanistLinter":125,"ArcanistLintSeverity":721,"Filesystem":970}},"xmap":{"IncludeGuardLinter":["ArcanistLinter"]}},"2cbb6e7228d81557f777ad648704f343":{"have":{"class":{"IncludeQuotesLinter":100}},"need":{"function":{"pht":306},"class":{"ArcanistLinter":128,"ArcanistLintSeverity":663,"Filesystem":964}},"xmap":{"IncludeQuotesLinter":["ArcanistLinter"]}},"f151089cf79fdb8257b2272ed4782d88":{"have":{"class":{"IncludeSourceLinter":99}},"need":{"function":{"pht":391},"class":{"ArcanistLinter":127,"ArcanistLintSeverity":699,"Filesystem":938}},"xmap":{"IncludeSourceLinter":["ArcanistLinter"]}},"8a0f2ba683e96feeb9d9564af01fe3e7":{"have":{"class":{"LocaleDependenceLinter":160}},"need":{"function":{"pht":5460},"class":{"ArcanistLinter":191,"ArcanistLintSeverity":5963,"Filesystem":6209}},"xmap":{"LocaleDependenceLinter":["ArcanistLinter"]}},"6f2f22dd0f259fb2eaa284b4fab3bc29":{"have":{"class":{"PythonFormatLinter":123}},"need":{"function":{"pht":353,"id":1838},"class":{"ArcanistExternalLinter":150,"ArcanistLintMessage":1845,"Filesystem":776,"ArcanistLinter":1970,"ArcanistLintSeverity":2053}},"xmap":{"PythonFormatLinter":["ArcanistExternalLinter"]}},"03cf226fe177a9fce7dc046816cc466b":{"have":{"class":{"PythonOpenFileEncodingLinter":111}},"need":{"function":{"pht":325},"class":{"ArcanistLinter":148,"ArcanistLintSeverity":687,"Filesystem":991}},"xmap":{"PythonOpenFileEncodingLinter":["ArcanistLinter"]}},"454160ed72e88797129d84ee589de304":{"have":{"class":{"PythonShebangLinter":87}},"need":{"function":{"pht":290},"class":{"ArcanistLinter":115,"ArcanistLintSeverity":614,"Filesystem":854}},"xmap":{"PythonShebangLinter":["ArcanistLinter"]}},"09a933fbbf135320585be52750d93831":{"have":{"class":{"StdintLinter":90}},"need":{"function":{"pht":280},"class":{"ArcanistLinter":111,"ArcanistLintSeverity":589,"Filesystem":897}},"xmap":{"StdintLinter":["ArcanistLinter"]}},"25781df78f6eebfb223296b8265e9d19":{"have":{"class":{"TestsLinter":103}},"need":{"function":{"pht":318,"id":2629},"class":{"ArcanistExternalLinter":123,"ArcanistLintMessage":2636,"Filesystem":776,"ArcanistLinter":2684,"ArcanistLintSeverity":2792}},"xmap":{"TestsLinter":["ArcanistExternalLinter"]}},"c5bb63c97d3e04f6e0906d001bd3f8a2":{"have":{"class":{"ShellCheckLinter":95}},"need":{"function":{"pht":921,"id":2137},"class":{"ArcanistExternalLinter":120,"ArcanistLintMessage":2144,"ArcanistLintSeverity":646,"ArcanistLinter":2192}},"xmap":{"ShellCheckLinter":["ArcanistExternalLinter"]}}} \ No newline at end of file diff --git a/arcanist/linter/ShellCheckLinter.php b/arcanist/linter/ShellCheckLinter.php index 5edc7b9ea..8f34d735d 100644 --- a/arcanist/linter/ShellCheckLinter.php +++ b/arcanist/linter/ShellCheckLinter.php @@ -1,99 +1,87 @@ ArcanistLintSeverity::SEVERITY_ADVICE, 'warning' => ArcanistLintSeverity::SEVERITY_WARNING, 'error' => ArcanistLintSeverity::SEVERITY_ERROR, ); public function getInfoName() { return 'shellcheck'; } public function getInfoDescription() { return pht('Use shellcheck for processing specified files.'); } public function getLinterName() { return 'SHELLCHECK'; } public function getLinterConfigurationName() { return 'shellcheck'; } public function getDefaultBinary() { return 'shellcheck'; } public function getInstallInstructions() { return pht('Make sure shellcheck is in directory specified by $PATH'); } public function shouldExpectCommandErrors() { return true; } protected function getMandatoryFlags() { return array( '--format=gcc', '--exclude='.implode(',', self::SHELLCHECK_EXCLUDED_RULES)); } private function getSeverity($severity) { if (array_key_exists($severity, self::SHELLCHECK_SEVERITY_MAP)) { return self::SHELLCHECK_SEVERITY_MAP[$severity]; } return ArcanistLintSeverity::SEVERITY_ERROR; } protected function parseLinterOutput($path, $err, $stdout, $stderr) { $messages = array(); $pattern = '/(.+):(\d+):(\d+): (.+): (.+) \[(SC\d+)\]/'; if (preg_match_all($pattern, $stdout, $errors, PREG_SET_ORDER)) { foreach ($errors as $error) { list(, $file, $line, $char, $severity, $message, $code) = $error; $messages[] = id(new ArcanistLintMessage()) ->setGranularity(ArcanistLinter::GRANULARITY_FILE) ->setPath($path) ->setLine($line) ->setChar($char) ->setCode($code) ->setSeverity($this->getSeverity($severity)) ->setName('ShellCheck found an issue:') ->setDescription($message); } } return $messages; } } diff --git a/autogen.sh b/autogen.sh index 27417daf7..f567e4232 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,15 +1,15 @@ #!/bin/sh # Copyright (c) 2013-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. set -e srcdir="$(dirname $0)" cd "$srcdir" -if [ -z ${LIBTOOLIZE} ] && GLIBTOOLIZE="`which glibtoolize 2>/dev/null`"; then +if [ -z ${LIBTOOLIZE} ] && GLIBTOOLIZE="$(command -v glibtoolize)"; then LIBTOOLIZE="${GLIBTOOLIZE}" export LIBTOOLIZE fi -which autoreconf >/dev/null || \ +command -v autoreconf >/dev/null || \ (echo "configuration failed, please install autoconf first" && exit 1) autoreconf --install --force --warnings=all diff --git a/contrib/devtools/gen-manpages.sh b/contrib/devtools/gen-manpages.sh index 8d1a89356..03c065a7b 100755 --- a/contrib/devtools/gen-manpages.sh +++ b/contrib/devtools/gen-manpages.sh @@ -1,31 +1,31 @@ #!/usr/bin/env bash TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)} BUILDDIR=${BUILDDIR:-$TOPDIR} BINDIR=${BINDIR:-$BUILDDIR/src} MANDIR=${MANDIR:-$TOPDIR/doc/man} BITCOIND=${BITCOIND:-$BINDIR/bitcoind} BITCOINCLI=${BITCOINCLI:-$BINDIR/bitcoin-cli} BITCOINTX=${BITCOINTX:-$BINDIR/bitcoin-tx} BITCOINQT=${BITCOINQT:-$BINDIR/qt/bitcoin-qt} [ ! -x $BITCOIND ] && echo "$BITCOIND not found or not executable." && exit 1 # The autodetected version git tag can screw up manpage output a little bit -BTCVER=($($BITCOINCLI --version | head -n1 | awk -F'[ -]' '{ print $6, $7 }')) +read -r -a BTCVER <<< "$($BITCOINCLI --version | head -n1 | awk -F'[ -]' '{ print $6, $7 }')" # Create a footer file with copyright content. # This gets autodetected fine for bitcoind if --version-string is not set, # but has different outcomes for bitcoin-qt and bitcoin-cli. echo "[COPYRIGHT]" > footer.h2m $BITCOIND --version | sed -n '1!p' >> footer.h2m for cmd in $BITCOIND $BITCOINCLI $BITCOINTX $BITCOINQT; do cmdname="${cmd##*/}" help2man -N --version-string=${BTCVER[0]} --include=footer.h2m -o ${MANDIR}/${cmdname}.1 ${cmd} sed -i "s/\\\-${BTCVER[1]}//g" ${MANDIR}/${cmdname}.1 done rm -f footer.h2m diff --git a/contrib/gitian/provisioner.sh b/contrib/gitian/provisioner.sh index eebc3f82e..9e2e026b7 100644 --- a/contrib/gitian/provisioner.sh +++ b/contrib/gitian/provisioner.sh @@ -1,66 +1,66 @@ #!/usr/bin/env bash set -e # User to setup for building. Vagrant is the default export BUILDUSER=${BUILDUSER:-vagrant} apt-get update apt-get install -y git ruby sudo apt-cacher-ng qemu-utils debootstrap \ lxc python-cheetah parted kpartx bridge-utils make curl # the version of lxc-start in Debian needs to run as root, so make sure # that the build script can execute it without providing a password echo "%sudo ALL=NOPASSWD: /usr/bin/lxc-start" > /etc/sudoers.d/gitian-lxc echo "%sudo ALL=NOPASSWD: /usr/bin/lxc-execute" >> /etc/sudoers.d/gitian-lxc # make sure that USE_LXC is always set when logging in as vagrant, # and configure LXC IP addresses { echo 'export USE_LXC=1' echo 'export LXC_BRIDGE=lxcbr0' echo 'export GITIAN_HOST_IP=10.0.3.1' echo 'export LXC_GUEST_IP=10.0.3.5' } >> /home/${BUILDUSER}/.profile # Setup bridge echo 'USE_LXC_BRIDGE="true"' > /etc/default/lxc-net { echo 'lxc.network.type = veth' echo 'lxc.network.link = lxcbr0' echo 'lxc.network.flags = up' echo 'lxc.network.hwaddr = 00:16:3e:xx:xx:xx' } > /etc/lxc/default.conf service lxc-net restart # chdir into build user home directory cd /home/${BUILDUSER}/ ## Install vm-builder wget http://archive.ubuntu.com/ubuntu/pool/universe/v/vm-builder/vm-builder_0.12.4+bzr494.orig.tar.gz echo "76cbf8c52c391160b2641e7120dbade5afded713afaa6032f733a261f13e6a8e vm-builder_0.12.4+bzr494.orig.tar.gz" | sha256sum -c # (verification -- must return OK) tar -zxvf vm-builder_0.12.4+bzr494.orig.tar.gz cd vm-builder-0.12.4+bzr494 sudo python setup.py install cd .. ## Install Gitian git clone https://github.com/devrandom/gitian-builder.git cd gitian-builder git config --global user.email "vagrant@vagrant.com" git config --global user.name "vagrant" chown -R ${BUILDUSER}:${BUILDUSER} /home/${BUILDUSER} echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo "!!! Provisioning Complete !!!!" echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo echo "As the user ${BUILDUSER} run the following commands to produce a linux build:" echo "export COMMIT=v0.18.3" echo "export URL=https://github.com/Bitcoin-ABC/bitcoin-abc.git" echo "cd gitian-builder" -echo './bin/make-base-vm --lxc --distro debian --suite stretch --arch amd64' -echo './bin/gbuild --commit bitcoin=${COMMIT} --url bitcoin=${URL} /vagrant/contrib/gitian-descriptors/gitian-linux.yml' +echo "./bin/make-base-vm --lxc --distro debian --suite stretch --arch amd64" +echo "./bin/gbuild --commit bitcoin=\${COMMIT} --url bitcoin=\${URL} /vagrant/contrib/gitian-descriptors/gitian-linux.yml" diff --git a/contrib/macdeploy/detached-sig-apply.sh b/contrib/macdeploy/detached-sig-apply.sh index 91674a92e..7fe15e793 100755 --- a/contrib/macdeploy/detached-sig-apply.sh +++ b/contrib/macdeploy/detached-sig-apply.sh @@ -1,56 +1,56 @@ #!/bin/sh # Copyright (c) 2014-2015 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. set -e UNSIGNED="$1" SIGNATURE="$2" ARCH=x86_64 ROOTDIR=dist TEMPDIR=signed.temp OUTDIR=signed-app if [ -z "$UNSIGNED" ]; then echo "usage: $0 " exit 1 fi if [ -z "$SIGNATURE" ]; then echo "usage: $0 " exit 1 fi rm -rf ${TEMPDIR} && mkdir -p ${TEMPDIR} tar -C ${TEMPDIR} -xf ${UNSIGNED} cp -rf "${SIGNATURE}"/* ${TEMPDIR} if [ -z "${PAGESTUFF}" ]; then PAGESTUFF=${TEMPDIR}/pagestuff fi if [ -z "${CODESIGN_ALLOCATE}" ]; then CODESIGN_ALLOCATE=${TEMPDIR}/codesign_allocate fi find ${TEMPDIR} -name "*.sign" | while read i; do - SIZE=`stat -c %s "${i}"` - TARGET_FILE="`echo "${i}" | sed 's/\.sign$//'`" + SIZE=$(stat -c %s "${i}") + TARGET_FILE="$(echo "${i}" | sed 's/\.sign$//')" echo "Allocating space for the signature of size ${SIZE} in ${TARGET_FILE}" ${CODESIGN_ALLOCATE} -i "${TARGET_FILE}" -a ${ARCH} ${SIZE} -o "${i}.tmp" - OFFSET=`${PAGESTUFF} "${i}.tmp" -p | tail -2 | grep offset | sed 's/[^0-9]*//g'` + OFFSET=$(${PAGESTUFF} "${i}.tmp" -p | tail -2 | grep offset | sed 's/[^0-9]*//g') if [ -z ${QUIET} ]; then echo "Attaching signature at offset ${OFFSET}" fi dd if="$i" of="${i}.tmp" bs=1 seek=${OFFSET} count=${SIZE} 2>/dev/null mv "${i}.tmp" "${TARGET_FILE}" rm "${i}" echo "Success." done mv ${TEMPDIR}/${ROOTDIR} ${OUTDIR} rm -rf ${TEMPDIR} echo "Signed: ${OUTDIR}" diff --git a/contrib/macdeploy/detached-sig-create.sh b/contrib/macdeploy/detached-sig-create.sh index 9cb343845..efa4d14bc 100755 --- a/contrib/macdeploy/detached-sig-create.sh +++ b/contrib/macdeploy/detached-sig-create.sh @@ -1,51 +1,51 @@ #!/bin/sh # Copyright (c) 2014-2015 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. set -e ROOTDIR=dist BUNDLE="${ROOTDIR}/BitcoinABC-Qt.app" CODESIGN=codesign TEMPDIR=sign.temp TEMPLIST=${TEMPDIR}/signatures.txt OUT=signature.tar.gz OUTROOT=osx -if [ ! -n "$1" ]; then +if [ -z "$1" ]; then echo "usage: $0 " echo "example: $0 -s MyIdentity" exit 1 fi rm -rf ${TEMPDIR} ${TEMPLIST} mkdir -p ${TEMPDIR} ${CODESIGN} -f --file-list ${TEMPLIST} "$@" "${BUNDLE}" grep -v CodeResources < "${TEMPLIST}" | while read i; do - TARGETFILE="${BUNDLE}/`echo "${i}" | sed "s|.*${BUNDLE}/||"`" - SIZE=`pagestuff "$i" -p | tail -2 | grep size | sed 's/[^0-9]*//g'` - OFFSET=`pagestuff "$i" -p | tail -2 | grep offset | sed 's/[^0-9]*//g'` + TARGETFILE="${BUNDLE}/$(echo "${i}" | sed "s|.*${BUNDLE}/||")" + SIZE=$(pagestuff "$i" -p | tail -2 | grep size | sed 's/[^0-9]*//g') + OFFSET=$(pagestuff "$i" -p | tail -2 | grep offset | sed 's/[^0-9]*//g') SIGNFILE="${TEMPDIR}/${OUTROOT}/${TARGETFILE}.sign" - DIRNAME="`dirname "${SIGNFILE}"`" + DIRNAME="$(dirname "${SIGNFILE}")" mkdir -p "${DIRNAME}" echo "Adding detached signature for: ${TARGETFILE}. Size: ${SIZE}. Offset: ${OFFSET}" dd if="$i" of="${SIGNFILE}" bs=1 skip=${OFFSET} count=${SIZE} 2>/dev/null done grep CodeResources < "${TEMPLIST}" | while read i; do - TARGETFILE="${BUNDLE}/`echo "${i}" | sed "s|.*${BUNDLE}/||"`" + TARGETFILE="${BUNDLE}/$(echo "${i}" | sed "s|.*${BUNDLE}/||")" RESOURCE="${TEMPDIR}/${OUTROOT}/${TARGETFILE}" - DIRNAME="`dirname "${RESOURCE}"`" + DIRNAME="$(dirname "${RESOURCE}")" mkdir -p "${DIRNAME}" echo "Adding resource for: \"${TARGETFILE}\"" cp "${i}" "${RESOURCE}" done rm ${TEMPLIST} tar -C "${TEMPDIR}" -czf "${OUT}" . rm -rf "${TEMPDIR}" echo "Created ${OUT}" diff --git a/contrib/qos/tc.sh b/contrib/qos/tc.sh index f3e64ca82..3a346d99a 100644 --- a/contrib/qos/tc.sh +++ b/contrib/qos/tc.sh @@ -1,61 +1,61 @@ #!/usr/bin/env bash # # Copyright (c) 2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. #network interface on which to limit traffic IF="eth0" #limit of the network interface in question LINKCEIL="1gbit" #limit outbound Bitcoin protocol traffic to this rate LIMIT="160kbit" #defines the IPv4 address space for which you wish to disable rate limiting LOCALNET_V4="192.168.0.0/16" #defines the IPv6 address space for which you wish to disable rate limiting LOCALNET_V6="fe80::/10" #delete existing rules tc qdisc del dev ${IF} root #add root class tc qdisc add dev ${IF} root handle 1: htb default 10 #add parent class tc class add dev ${IF} parent 1: classid 1:1 htb rate ${LINKCEIL} ceil ${LINKCEIL} #add our two classes. one unlimited, another limited tc class add dev ${IF} parent 1:1 classid 1:10 htb rate ${LINKCEIL} ceil ${LINKCEIL} prio 0 tc class add dev ${IF} parent 1:1 classid 1:11 htb rate ${LIMIT} ceil ${LIMIT} prio 1 #add handles to our classes so packets marked with go into the class with "... handle fw ..." tc filter add dev ${IF} parent 1: protocol ip prio 1 handle 1 fw classid 1:10 tc filter add dev ${IF} parent 1: protocol ip prio 2 handle 2 fw classid 1:11 -if [ ! -z "${LOCALNET_V6}" ] ; then +if [ -n "${LOCALNET_V6}" ] ; then # v6 cannot have the same priority value as v4 tc filter add dev ${IF} parent 1: protocol ipv6 prio 3 handle 1 fw classid 1:10 tc filter add dev ${IF} parent 1: protocol ipv6 prio 4 handle 2 fw classid 1:11 fi #delete any existing rules #disable for now #ret=0 #while [ $ret -eq 0 ]; do # iptables -t mangle -D OUTPUT 1 # ret=$? #done #limit outgoing traffic to and from port 8333. but not when dealing with a host on the local network # (defined by $LOCALNET_V4 and $LOCALNET_V6) # --set-mark marks packages matching these criteria with the number "2" (v4) # --set-mark marks packages matching these criteria with the number "4" (v6) # these packets are filtered by the tc filter with "handle 2" # this filter sends the packages into the 1:11 class, and this class is limited to ${LIMIT} iptables -t mangle -A OUTPUT -p tcp -m tcp --dport 8333 ! -d ${LOCALNET_V4} -j MARK --set-mark 0x2 iptables -t mangle -A OUTPUT -p tcp -m tcp --sport 8333 ! -d ${LOCALNET_V4} -j MARK --set-mark 0x2 -if [ ! -z "${LOCALNET_V6}" ] ; then +if [ -n "${LOCALNET_V6}" ] ; then ip6tables -t mangle -A OUTPUT -p tcp -m tcp --dport 8333 ! -d ${LOCALNET_V6} -j MARK --set-mark 0x4 ip6tables -t mangle -A OUTPUT -p tcp -m tcp --sport 8333 ! -d ${LOCALNET_V6} -j MARK --set-mark 0x4 fi diff --git a/contrib/teamcity/build-configurations.sh b/contrib/teamcity/build-configurations.sh index 5b4a1a43f..4a5f0d85e 100755 --- a/contrib/teamcity/build-configurations.sh +++ b/contrib/teamcity/build-configurations.sh @@ -1,40 +1,40 @@ #!/usr/bin/env bash set -e if [ -z "$ABC_BUILD_NAME" ]; then echo "Error: Environment variable ABC_BUILD_NAME must be set" exit 1 fi echo "Running build configuration '${ABC_BUILD_NAME}'..." -TOPLEVEL=`git rev-parse --show-toplevel` +TOPLEVEL=$(git rev-parse --show-toplevel) cd "${TOPLEVEL}/contrib/teamcity" case "$ABC_BUILD_NAME" in build-asan) export CONFIGURE_FLAGS="--enable-debug --with-sanitizers=address --disable-ccache" ./build.sh ;; build-ubsan) export CONFIGURE_FLAGS="--enable-debug --with-sanitizers=undefined --disable-ccache CC=clang CXX=clang++" ./build.sh ;; build-default) ./build.sh ./build-secp256k1.sh ;; build-without-wallet) export DISABLE_WALLET=1 ./build.sh ;; *) echo "Error: Invalid build name '${ABC_BUILD_NAME}'" exit 2 ;; esac diff --git a/contrib/teamcity/build-secp256k1.sh b/contrib/teamcity/build-secp256k1.sh index df2c4f954..228c832ee 100755 --- a/contrib/teamcity/build-secp256k1.sh +++ b/contrib/teamcity/build-secp256k1.sh @@ -1,31 +1,30 @@ #!/usr/bin/env bash set -eu -TOPLEVEL=`git rev-parse --show-toplevel` +TOPLEVEL=$(git rev-parse --show-toplevel) if [[ -z "${TOPLEVEL}" ]]; then echo "No .git directory found, assuming pwd" - TOPLEVEL=`pwd -P` + TOPLEVEL=$(pwd -P) fi SECP_DIR="${TOPLEVEL}/src/secp256k1" # Generate necessary autoconf files cd ${SECP_DIR} ./autogen.sh # Setup build directory BUILD_DIR="${SECP_DIR}/build" mkdir -p ${BUILD_DIR} cd ${BUILD_DIR} # Determine the number of build threads THREADS=$(nproc || sysctl -n hw.ncpu) ../configure --enable-jni --enable-experimental --enable-module-ecdh # Run build make -j ${THREADS} # Run Java tests make check-java - diff --git a/contrib/teamcity/build.sh b/contrib/teamcity/build.sh index f29ad2970..af84d86e5 100755 --- a/contrib/teamcity/build.sh +++ b/contrib/teamcity/build.sh @@ -1,88 +1,88 @@ #!/usr/bin/env bash set -eu -TOPLEVEL=`git rev-parse --show-toplevel` +TOPLEVEL=$(git rev-parse --show-toplevel) if [[ -z "${TOPLEVEL}" ]]; then echo "No .git directory found, assuming pwd" - TOPLEVEL=`pwd -P` + TOPLEVEL=$(pwd -P) fi BUILD_DIR="${TOPLEVEL}/build" mkdir -p ${BUILD_DIR} ## Generate necessary autoconf files cd ${TOPLEVEL} ./autogen.sh cd ${BUILD_DIR} rm -f build.status test_bitcoin.xml ## Determine the number of build threads THREADS=$(nproc || sysctl -n hw.ncpu) # Default to nothing -: ${DISABLE_WALLET:=} -: ${CONFIGURE_FLAGS:=} +: "${DISABLE_WALLET:=}" +: "${CONFIGURE_FLAGS:=}" -CONFIGURE_FLAGS=($CONFIGURE_FLAGS "--prefix=`pwd`") -if [[ ! -z "${DISABLE_WALLET}" ]]; then +CONFIGURE_FLAGS=("$CONFIGURE_FLAGS" "--prefix=$(pwd)") +if [[ -n "${DISABLE_WALLET}" ]]; then echo "*** Building without wallet" CONFIGURE_FLAGS+=("--disable-wallet") fi ../configure "${CONFIGURE_FLAGS[@]}" # Base directories for sanitizer related files SAN_SUPP_DIR="${TOPLEVEL}/test/sanitizer_suppressions" SAN_LOG_DIR="${BUILD_DIR}/sanitizer_logs" # Create the log directory if it doesn't exist and clear it mkdir -p "${SAN_LOG_DIR}" rm -rf "${SAN_LOG_DIR:?}"/* # Sanitizers options, not used if sanitizers are not enabled export ASAN_OPTIONS="malloc_context_size=0:log_path=${SAN_LOG_DIR}/asan.log" export LSAN_OPTIONS="suppressions=${SAN_SUPP_DIR}/lsan:log_path=${SAN_LOG_DIR}/lsan.log" export TSAN_OPTIONS="suppressions=${SAN_SUPP_DIR}/tsan:log_path=${SAN_LOG_DIR}/tsan.log" export UBSAN_OPTIONS="suppressions=${SAN_SUPP_DIR}/ubsan:print_stacktrace=1:halt_on_error=1:log_path=${SAN_LOG_DIR}/ubsan.log" function print_sanitizers_log() { for log in "${SAN_LOG_DIR}"/*.log.* do echo "*** Output of ${log} ***" cat "${log}" done } # Run build make -j ${THREADS} # Default to nothing -: ${DISABLE_TESTS:=} +: "${DISABLE_TESTS:=}" # If DISABLE_TESTS is unset (default), run the tests if [[ -z "${DISABLE_TESTS}" ]]; then echo "*** Running tests" # Run unit tests make -j ${THREADS} check || (print_sanitizers_log && exit 1) mkdir -p output/ BRANCH=$(git rev-parse --abbrev-ref HEAD) JUNIT_DEFAULT="junit_results_default.xml" JUNIT_NEXT_UPGRADE="junit_results_next_upgrade.xml" - if [[ ! -z "${DISABLE_WALLET}" ]]; then + if [[ -n "${DISABLE_WALLET}" ]]; then echo "Skipping rpc testing due to disabled wallet functionality." elif [[ "${BRANCH}" == "master" ]]; then ./test/functional/test_runner.py -J="${JUNIT_DEFAULT}" --cutoff=600 --tmpdirprefix=output ./test/functional/test_runner.py -J="${JUNIT_NEXT_UPGRADE}" --cutoff=600 --tmpdirprefix=output --with-gravitonactivation else ./test/functional/test_runner.py -J="${JUNIT_DEFAULT}" --tmpdirprefix=output ./test/functional/test_runner.py -J="${JUNIT_NEXT_UPGRADE}" --tmpdirprefix=output --with-gravitonactivation fi else echo "*** Tests have been skipped" fi diff --git a/contrib/teamcity/gitian.sh b/contrib/teamcity/gitian.sh index e478aaee1..b3a0f4372 100755 --- a/contrib/teamcity/gitian.sh +++ b/contrib/teamcity/gitian.sh @@ -1,35 +1,35 @@ #!/usr/bin/env bash set -e cd "$(dirname "$0")" -COMMIT=`git rev-parse HEAD` +COMMIT=$(git rev-parse HEAD) export COMMIT -PROJECT_ROOT=`git rev-parse --show-toplevel` +PROJECT_ROOT=$(git rev-parse --show-toplevel) export PROJECT_ROOT export USE_LXC=1 export GITIAN_HOST_IP=10.0.3.1 export LXC_BRIDGE=lxcbr0 export LXC_GUEST_IP=10.0.3.5 cd ~/gitian-builder if [[ "${OS_NAME}" == "osx" ]]; then wget https://storage.googleapis.com/f4936e83b2dcbca742be51fb9692b153/MacOSX10.11.sdk.tar.gz echo "4732b52b5ebe300c8c91cbeed6d19d59c1ff9c56c7a1dd6cfa518b9c2c72abde MacOSX10.11.sdk.tar.gz" | sha256sum -c mkdir -p inputs echo "Downloaded" mv MacOSX10.11.sdk.tar.gz inputs fi ## Determine the number of build threads THREADS=$(nproc || sysctl -n hw.ncpu) ./bin/gbuild -j${THREADS} -m3500 --commit bitcoin=${COMMIT} --url bitcoin="${PROJECT_ROOT}" "${PROJECT_ROOT}/contrib/gitian-descriptors/gitian-${OS_NAME}.yml" RESULT_DIR="${PROJECT_ROOT}/gitian-results/${OS_NAME}" mkdir -p "${RESULT_DIR}" mv var/build.log "${PROJECT_ROOT}/gitian-results/" mv result/*.yml "${RESULT_DIR}/" mv build/out/* "${RESULT_DIR}/" diff --git a/contrib/teamcity/ibd.sh b/contrib/teamcity/ibd.sh index ddf031784..ad933b23c 100755 --- a/contrib/teamcity/ibd.sh +++ b/contrib/teamcity/ibd.sh @@ -1,74 +1,74 @@ #!/usr/bin/env bash set -euo pipefail ### # Initial Block Download script. # # Runs a bitcoind process until initial block download is complete. # Forwards the exit code from bitcoind onward. ### MYPID=$$ # Setup DATA_DIR="ibd" mkdir -p "${DATA_DIR}" DEBUG_LOG="${DATA_DIR}/debug.log" touch "${DEBUG_LOG}" chmod +x bitcoind # Launch bitcoind using this script's parameters -./bitcoind "-datadir=${DATA_DIR}" $* & +./bitcoind "-datadir=${DATA_DIR}" "$@" & BITCOIND_PID=$! cleanup() { # Cleanup background processes spawned by this script. pkill -P ${MYPID} tail || true } trap "cleanup" EXIT # Show some progress tail -f "${DEBUG_LOG}" | grep 'UpdateTip' | awk 'NR % 10000 == 0' & # Wait for IBD to finish and kill the daemon ( ( # Ignore the broken pipe when tail tries to write pipe closed by grep set +o pipefail tail -f "${DEBUG_LOG}" | grep -m 1 'progress=1.000000' ) echo "Initial block download complete." # TODO Add more checks to see if IBD completed as expected, # These checks will exit the subshell with a non-zero exit code. ) & IBD_PID=$! # When the IBD subshell finishes, kill bitcoind ( while [ -e /proc/${IBD_PID} ]; do sleep 0.1; done echo "Cleaning up bitcoin daemon (PID: ${BITCOIND_PID})." kill ${BITCOIND_PID} ) & # Wait for bitcoind to exit, whether it exited on its own or IBD finished wait ${BITCOIND_PID} BITCOIND_EXIT_CODE=$? if [ "${BITCOIND_EXIT_CODE}" -ne "0" ]; then echo "bitcoind exited unexpectedly with code: ${BITCOIND_EXIT_CODE}" exit ${BITCOIND_EXIT_CODE} fi # Get the exit code for the IBD subshell, which should have exited already wait ${IBD_PID} IBD_EXIT_CODE=$? # The IBD subshell should only exit with a non-zero code if one of the tests # failed. if [ "${IBD_EXIT_CODE}" -ne "0" ]; then echo "IBD tests failed with code: ${IBD_EXIT_CODE}" exit ${IBD_EXIT_CODE} fi diff --git a/contrib/verifybinaries/verify.sh b/contrib/verifybinaries/verify.sh index 95f714d34..8071eb87e 100755 --- a/contrib/verifybinaries/verify.sh +++ b/contrib/verifybinaries/verify.sh @@ -1,125 +1,124 @@ #!/usr/bin/env bash # Copyright (c) 2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ### This script attempts to download the signature file SHA256SUMS.asc from bitcoin.org ### It first checks if the signature passes, and then downloads the files specified in ### the file, and checks if the hashes of these files match those that are specified ### in the signature file. ### The script returns 0 if everything passes the checks. It returns 1 if either the ### signature check or the hash check doesn't pass. If an error occurs the return value is 2 function clean_up { - for file in $* + for file in "$@" do rm "$file" 2> /dev/null done } WORKINGDIR="/tmp/bitcoin_verify_binaries" TMPFILE="hashes.tmp" SIGNATUREFILENAME="SHA256SUMS.asc" RCSUBDIR="test" BASEDIR="https://bitcoin.org/bin/" VERSIONPREFIX="bitcoin-core-" RCVERSIONSTRING="rc" if [ ! -d "$WORKINGDIR" ]; then mkdir "$WORKINGDIR" fi cd "$WORKINGDIR" || exit 1 #test if a version number has been passed as an argument if [ -n "$1" ]; then #let's also check if the version number includes the prefix 'bitcoin-', # and add this prefix if it doesn't if [[ $1 == "$VERSIONPREFIX"* ]]; then VERSION="$1" else VERSION="$VERSIONPREFIX$1" fi #now let's see if the version string contains "rc", and strip it off if it does # and simultaneously add RCSUBDIR to BASEDIR, where we will look for SIGNATUREFILENAME if [[ $VERSION == *"$RCVERSIONSTRING"* ]]; then BASEDIR="$BASEDIR${VERSION/%-$RCVERSIONSTRING*}/" BASEDIR="$BASEDIR$RCSUBDIR.$RCVERSIONSTRING${VERSION: -1}/" else BASEDIR="$BASEDIR$VERSION/" fi else echo "Error: need to specify a version on the command line" exit 2 fi -#first we fetch the file containing the signature -WGETOUT=$(wget -N "$BASEDIR$SIGNATUREFILENAME" 2>&1) - -#and then see if wget completed successfully -if [ $? -ne 0 ]; then +if ! WGETOUT=$(wget -N "$HOST1$BASEDIR$SIGNATUREFILENAME" 2>&1); then echo "Error: couldn't fetch signature file. Have you specified the version number in the following format?" + # shellcheck disable=SC1087 echo "[$VERSIONPREFIX]-[$RCVERSIONSTRING[0-9]] (example: ${VERSIONPREFIX}0.10.4-${RCVERSIONSTRING}1)" echo "wget output:" + # shellcheck disable=SC2001 echo "$WGETOUT"|sed 's/^/\t/g' exit 2 fi #then we check it GPGOUT=$(gpg --yes --decrypt --output "$TMPFILE" "$SIGNATUREFILENAME" 2>&1) #return value 0: good signature #return value 1: bad signature #return value 2: gpg error RET="$?" if [ $RET -ne 0 ]; then if [ $RET -eq 1 ]; then #and notify the user if it's bad echo "Bad signature." elif [ $RET -eq 2 ]; then #or if a gpg error has occurred echo "gpg error. Do you have the Bitcoin Core binary release signing key installed?" fi echo "gpg output:" + # shellcheck disable=SC2001 echo "$GPGOUT"|sed 's/^/\t/g' clean_up $SIGNATUREFILENAME $TMPFILE exit "$RET" fi #here we extract the filenames from the signature file FILES=$(awk '{print $2}' "$TMPFILE") #and download these one by one for file in $FILES do wget --quiet -N "$BASEDIR$file" done #check hashes DIFF=$(diff <(sha256sum $FILES) "$TMPFILE") if [ $? -eq 1 ]; then echo "Hashes don't match." echo "Offending files:" echo "$DIFF"|grep "^<"|awk '{print "\t"$3}' exit 1 elif [ $? -gt 1 ]; then echo "Error executing 'diff'" exit 2 fi if [ -n "$2" ]; then echo "Clean up the binaries" clean_up $FILES $SIGNATUREFILENAME $TMPFILE else echo "Keep the binaries in $WORKINGDIR" clean_up $TMPFILE fi echo -e "Verified hashes of \n$FILES" exit 0 diff --git a/share/genbuild.sh b/share/genbuild.sh index c8a798e02..b21a734d4 100755 --- a/share/genbuild.sh +++ b/share/genbuild.sh @@ -1,48 +1,48 @@ #!/bin/sh # Copyright (c) 2012-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. if [ $# -gt 1 ]; then cd "$2" || exit 1 fi if [ $# -gt 0 ]; then FILE="$1" shift if [ -f "$FILE" ]; then INFO="$(head -n 1 "$FILE")" fi else echo "Usage: $0 " exit 1 fi DESC="" SUFFIX="" -if [ -e "$(which git 2>/dev/null)" -a "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]; then +if [ -e "$(command -v git)" ] && [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]; then # clean 'dirty' status of touched files that haven't been modified - git diff >/dev/null 2>/dev/null + git diff >/dev/null 2>/dev/null # if latest commit is tagged and not dirty, then override using the tag name RAWDESC=$(git describe --abbrev=0 2>/dev/null) if [ "$(git rev-parse HEAD)" = "$(git rev-list -1 $RAWDESC 2>/dev/null)" ]; then git diff-index --quiet HEAD -- && DESC=$RAWDESC fi # otherwise generate suffix from git, i.e. string like "59887e8-dirty" SUFFIX=$(git rev-parse --short HEAD) git diff-index --quiet HEAD -- || SUFFIX="$SUFFIX-dirty" fi if [ -n "$DESC" ]; then NEWINFO="#define BUILD_DESC \"$DESC\"" elif [ -n "$SUFFIX" ]; then NEWINFO="#define BUILD_SUFFIX $SUFFIX" else NEWINFO="// No build information available" fi # only update build.h if necessary if [ "$INFO" != "$NEWINFO" ]; then echo "$NEWINFO" >"$FILE" fi diff --git a/src/qt/res/movies/makespinner.sh b/src/qt/res/movies/makespinner.sh index d0413efbb..8bc2e8c6a 100755 --- a/src/qt/res/movies/makespinner.sh +++ b/src/qt/res/movies/makespinner.sh @@ -1,13 +1,13 @@ #!/usr/bin/env bash # Copyright (c) 2014-2015 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. FRAMEDIR=$(dirname $0) for i in {0..35} do frame=$(printf "%03d" $i) - angle=$(($i * 10)) + angle=$((i * 10)) convert $FRAMEDIR/../src/spinner.png -background "rgba(0,0,0,0.0)" -distort SRT $angle $FRAMEDIR/spinner-$frame.png done diff --git a/test/functional/test_framework/tests/run_self_tests.sh b/test/functional/test_framework/tests/run_self_tests.sh index a98559462..0e8c21b7a 100644 --- a/test/functional/test_framework/tests/run_self_tests.sh +++ b/test/functional/test_framework/tests/run_self_tests.sh @@ -1,53 +1,53 @@ #!/bin/sh # Copyright (c) 2017 The Bitcoin developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Executes the test framework self-tests located in # qa/rpc-tests/test_framework/tests. # # You should be able to call this script from pretty much anywhere. # It takes care of setting up the PYTHONPATH so tests can run. # Enable exit on any error. set -e # Save folder from which script was called. # We may need to return after looking for the base folder. start_folder="$(pwd)" if [ -d qa/rpc-tests ] then # called from top level RPC_TESTS_DIR=$(pwd)/qa/rpc-tests elif [ -d ../qa/rpc-tests ] then # called from out of tree build RPC_TESTS_DIR=$(cd ../qa/rpc-tests && pwd) else # chop off the script's filename to get path scriptpath=$(dirname $0) RPC_TESTS_DIR=$(cd $scriptpath/../.. && pwd) fi export PYTHONPATH="$PYTHONPATH:$RPC_TESTS_DIR" # Go to where the tests are located cd $RPC_TESTS_DIR/test_framework/tests echo "Running test framework self-tests..." # Run all the Python tests we find there. for t in *.py do - echo "`date -u`: Starting self-test: $t" + echo "$(date -u): Starting self-test: $t" SRCDIR=$RPC_TESTS_DIR/../.. python3 ./$t - echo "`date -u`: Finished self-test: $t" + echo "$(date -u): Finished self-test: $t" echo done # Return to calling folder cd "$start_folder" echo "Completed test framework self-tests."