Skip to content

Commit 888c22e

Browse files
committed
Merge bitcoin#20359: depends: Various config.site.in improvements and linting
46756a6 depends: Fix PYTHONPATH setting in config.site.in (Carl Dong) 618cbd2 lint: Also lint files with shellcheck directive (Carl Dong) 6c7e8f0 depends: Allow relative CONFIG_SITE path env var (Carl Dong) Pull request description: This changeset: 1. Allows the `CONFIG_SITE` env var to be a relative path rather than requiring an absolute one 2. Enables linting of the `config.site.in` file with `shellcheck` in our linting scripts 3. Sets the `PYTHONPATH` var sensibly in `config.site.in` Please see commit messages for more details ACKs for top commit: laanwj: ACK 46756a6 Tree-SHA512: 744089b9f6e5604e56466d9a3e64563f9183a70f7e300ac9ae6248f0f17c0b53fe28a2c41d43c5ffe5da825f53c2ca21f21aacba0579442da3056fb0c4b81454
2 parents cddcd22 + 46756a6 commit 888c22e

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

depends/config.site.in

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
depends_prefix="`dirname ${ac_site_file}`/.."
1+
# shellcheck shell=sh disable=SC2034 # Many variables set will be used in
2+
# ./configure but shellcheck doesn't know
3+
# that, hence: disable=SC2034
4+
5+
true # Dummy command because shellcheck treats all directives before first
6+
# command as file-wide, and we only want to disable for one line.
7+
#
8+
# See: https://github.com/koalaman/shellcheck/wiki/Directive
9+
10+
# shellcheck disable=SC2154
11+
depends_prefix="$(cd "$(dirname ${ac_site_file})/.." && pwd)"
212

313
cross_compiling=maybe
414
host_alias=@HOST@
@@ -50,7 +60,7 @@ if test x@host_os@ = xdarwin; then
5060
fi
5161

5262
PATH=$depends_prefix/native/bin:$PATH
53-
PKG_CONFIG="`which pkg-config` --static"
63+
PKG_CONFIG="$(which pkg-config) --static"
5464

5565
# These two need to remain exported because pkg-config does not see them
5666
# otherwise. That means they must be unexported at the end of configure.ac to
@@ -69,7 +79,7 @@ fi
6979
if test -n "@CXX@" -a -z "${CXX}"; then
7080
CXX="@CXX@"
7181
fi
72-
PYTHONPATH=$depends_prefix/native/lib/python3/dist-packages:$PYTHONPATH
82+
PYTHONPATH="${depends_prefix}/native/lib/python3/dist-packages${PYTHONPATH:+${PATH_SEPARATOR}}${PYTHONPATH}"
7383

7484
if test -n "@AR@"; then
7585
AR=@AR@

test/lint/lint-shell.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ fi
3636

3737
SHELLCHECK_CMD=(shellcheck --external-sources --check-sourced)
3838
EXCLUDE="--exclude=$(IFS=','; echo "${disabled[*]}")"
39-
if ! "${SHELLCHECK_CMD[@]}" "$EXCLUDE" $(git ls-files -- '*.sh' | grep -vE 'src/(leveldb|secp256k1|univalue)/'); then
39+
SOURCED_FILES=$(git ls-files | xargs gawk '/^# shellcheck shell=/ {print FILENAME} {nextfile}') # Check shellcheck directive used for sourced files
40+
if ! "${SHELLCHECK_CMD[@]}" "$EXCLUDE" $SOURCED_FILES $(git ls-files -- '*.sh' | grep -vE 'src/(leveldb|secp256k1|univalue)/'); then
4041
EXIT_CODE=1
4142
fi
4243

0 commit comments

Comments
 (0)