From 2783fb6018d3640f4f1960fb2c8a82db454ee44b Mon Sep 17 00:00:00 2001 From: John Davis Date: Wed, 31 Jan 2024 18:45:41 -0500 Subject: [PATCH 1/3] Ignore lines starting with # in build packages script --- packages/build_packages.sh | 11 ++++++----- packages/test.sh | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/build_packages.sh b/packages/build_packages.sh index dde18ce11324..33a13039ecac 100755 --- a/packages/build_packages.sh +++ b/packages/build_packages.sh @@ -8,12 +8,13 @@ set -ex # Change to packages directory. cd "$(dirname "$0")" -# ensure ordered by dependency dag +# Ensure ordered by dependency dag while read -r package_dir; do - if [ -z "$package_dir" ]; then - # Skip empty lines - continue - fi + # Ignore empty lines + [[ -z "$package_dir" ]] && continue + # Ignore lines beginning with `#` + [[ "$package_dir" =~ ^#.* ]] && continue + printf "\n========= RELEASING PACKAGE %s =========\n\n" "$package_dir" cd "$package_dir" diff --git a/packages/test.sh b/packages/test.sh index 0e41ee922687..a19b2d982ce3 100755 --- a/packages/test.sh +++ b/packages/test.sh @@ -31,12 +31,13 @@ if [ $FOR_PULSAR -eq 0 ]; then pip install -r../lib/galaxy/dependencies/pinned-typecheck-requirements.txt fi -# ensure ordered by dependency DAG +# Ensure ordered by dependency DAG while read -r package_dir || [ -n "$package_dir" ]; do # https://stackoverflow.com/questions/12916352/shell-script-read-missing-last-line - if [ -z "$package_dir" ]; then - # Skip empty lines - continue - fi + # Ignore empty lines + [[ -z "$package_dir" ]] && continue + # Ignore lines beginning with `#` + [[ "$package_dir" =~ ^#.* ]] && continue + printf "\n========= TESTING PACKAGE ${package_dir} =========\n\n" cd "$package_dir" From 01402e279c6ff9f5490635b0fcfa0aa3bce23657 Mon Sep 17 00:00:00 2001 From: John Davis Date: Thu, 1 Feb 2024 09:34:04 -0500 Subject: [PATCH 2/3] Use if/then/fi for readability; minor linting --- packages/build_packages.sh | 8 ++++++-- packages/test.sh | 11 ++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/build_packages.sh b/packages/build_packages.sh index 33a13039ecac..428e4eb17389 100755 --- a/packages/build_packages.sh +++ b/packages/build_packages.sh @@ -11,9 +11,13 @@ cd "$(dirname "$0")" # Ensure ordered by dependency dag while read -r package_dir; do # Ignore empty lines - [[ -z "$package_dir" ]] && continue + if [[ -z $package_dir ]]; then + continue + fi # Ignore lines beginning with `#` - [[ "$package_dir" =~ ^#.* ]] && continue + if [[ $package_dir =~ ^#.* ]]; then + continue + fi printf "\n========= RELEASING PACKAGE %s =========\n\n" "$package_dir" diff --git a/packages/test.sh b/packages/test.sh index a19b2d982ce3..d88fef4b0e58 100755 --- a/packages/test.sh +++ b/packages/test.sh @@ -25,6 +25,7 @@ TEST_PYTHON=${TEST_PYTHON:-"python3"} TEST_ENV_DIR=${TEST_ENV_DIR:-$(mktemp -d -t gxpkgtestenvXXXXXX)} "$TEST_PYTHON" -m venv "$TEST_ENV_DIR" +# shellcheck disable=SC1091 . "${TEST_ENV_DIR}/bin/activate" pip install --upgrade pip setuptools wheel if [ $FOR_PULSAR -eq 0 ]; then @@ -34,11 +35,15 @@ fi # Ensure ordered by dependency DAG while read -r package_dir || [ -n "$package_dir" ]; do # https://stackoverflow.com/questions/12916352/shell-script-read-missing-last-line # Ignore empty lines - [[ -z "$package_dir" ]] && continue + if [[ -z $package_dir ]]; then + continue + fi # Ignore lines beginning with `#` - [[ "$package_dir" =~ ^#.* ]] && continue + if [[ $package_dir =~ ^#.* ]]; then + continue + fi - printf "\n========= TESTING PACKAGE ${package_dir} =========\n\n" + printf "\n========= TESTING PACKAGE %s =========\n\n" "$package_dir" cd "$package_dir" From 2337c9ca837fce7a928911719fcd4ca94f8f484a Mon Sep 17 00:00:00 2001 From: John Davis Date: Thu, 1 Feb 2024 12:22:21 -0500 Subject: [PATCH 3/3] Partially remove bash-specific syntax --- packages/build_packages.sh | 2 +- packages/test.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/build_packages.sh b/packages/build_packages.sh index 428e4eb17389..000427cd77c7 100755 --- a/packages/build_packages.sh +++ b/packages/build_packages.sh @@ -11,7 +11,7 @@ cd "$(dirname "$0")" # Ensure ordered by dependency dag while read -r package_dir; do # Ignore empty lines - if [[ -z $package_dir ]]; then + if [ -z "$package_dir" ]; then continue fi # Ignore lines beginning with `#` diff --git a/packages/test.sh b/packages/test.sh index d88fef4b0e58..5a64061bd51d 100755 --- a/packages/test.sh +++ b/packages/test.sh @@ -35,7 +35,7 @@ fi # Ensure ordered by dependency DAG while read -r package_dir || [ -n "$package_dir" ]; do # https://stackoverflow.com/questions/12916352/shell-script-read-missing-last-line # Ignore empty lines - if [[ -z $package_dir ]]; then + if [ -z "$package_dir" ]; then continue fi # Ignore lines beginning with `#`