Skip to content

Commit f20306b

Browse files
committed
Shellcheck fixes
1 parent 6cf9d49 commit f20306b

File tree

6 files changed

+87
-64
lines changed

6 files changed

+87
-64
lines changed

lib/galaxy/dependencies/update.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ fi
4747

4848
# Update pinned requirements files.
4949
UV_EXPORT_OPTIONS='--frozen --no-annotate --no-hashes'
50+
# shellcheck disable=SC2086
5051
${uv} export ${UV_EXPORT_OPTIONS} --no-dev > "$this_directory/pinned-requirements.txt"
52+
# shellcheck disable=SC2086
5153
${uv} export ${UV_EXPORT_OPTIONS} --only-group=test > "$this_directory/pinned-test-requirements.txt"
54+
# shellcheck disable=SC2086
5255
${uv} export ${UV_EXPORT_OPTIONS} --only-group=dev > "$this_directory/dev-requirements.txt"
56+
# shellcheck disable=SC2086
5357
${uv} export ${UV_EXPORT_OPTIONS} --only-group=typecheck > "$this_directory/pinned-typecheck-requirements.txt"

packages/package-build-install.sh

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
#
88
set -euo pipefail
99

10-
: ${PACKAGE_LIST_FILE:=packages_by_dep_dag.txt}
11-
: ${PIP_EXTRA_ARGS:=--extra-index-url https://wheels.galaxyproject.org}
10+
: "${PACKAGE_LIST_FILE:=packages_by_dep_dag.txt}"
11+
: "${PIP_EXTRA_ARGS:=--extra-index-url https://wheels.galaxyproject.org}"
1212
#: ${SETUP_VENV:=true}
1313

1414
INSTALL=true
@@ -26,7 +26,7 @@ fi
2626

2727
# Prevent making a venv for build deps for each package, Used inside the package dir, so refers to
2828
# <source_root>/packages/.venv
29-
: ${VENV=../.venv}
29+
: "${VENV=../.venv}"
3030
export VENV
3131

3232
trap_handler() {
@@ -36,42 +36,45 @@ trap_handler() {
3636
}
3737
trap trap_handler EXIT
3838

39+
usage() {
40+
echo "usage: $0 [-bem] [up_to_package]"
41+
echo " -b build only, no install"
42+
echo " -e install packages in \"editable\" mode (pip install -e)"
43+
echo " -m install galaxy metapackage, installing pinned deps in meta/requirements.txt"
44+
}
45+
3946
while getopts ':bhem' OPTION
4047
do
4148
case $OPTION in
42-
b)
43-
INSTALL=false
44-
;;
45-
h)
46-
echo "usage: $0 [-bem] [up_to_package]"
47-
echo " -b build only, no install"
48-
echo " -e install packages in \"editable\" mode (pip install -e)"
49-
echo " -m install galaxy metapackage, installing pinned deps in meta/requirements.txt"
50-
exit 0
51-
;;
52-
e)
53-
EDITABLE=true
54-
INSTALL=true
55-
;;
56-
m)
57-
META=true
58-
;;
49+
b) INSTALL=false
50+
;;
51+
h) usage
52+
exit 0
53+
;;
54+
e) EDITABLE=true
55+
INSTALL=true
56+
;;
57+
m) META=true
58+
;;
59+
?) usage
60+
exit 2
61+
;;
5962
esac
6063
done
6164
shift $((OPTIND - 1))
6265

6366
up_to="${1:-}"
6467

65-
if [ -n "$up_to" -a ! -d "$up_to" ]; then
68+
if [ -n "$up_to" ] && [ ! -d "$up_to" ]; then
6669
echo "ERROR: package does not exist: $up_to"
6770
exit 1
6871
fi
6972

70-
while read package; do
73+
while read -r package; do
7174
[ -n "$package" ] || continue
7275
if $INSTALL && [[ $package == meta ]] && ! $META; then continue; fi
7376
printf "\n========= PACKAGE %s =========\n\n" "$package"
74-
pushd $package
77+
pushd "$package"
7578
if $EDITABLE; then
7679
${PIP_CMD} install -e .
7780
else
@@ -90,6 +93,7 @@ done < "$PACKAGE_LIST_FILE"
9093

9194
if $INSTALL && $META && ! $EDITABLE; then
9295
WHEELHOUSE=$(mktemp -d -t gxpkgwheelhouseXXXXXX)
93-
cp */dist/*.whl "$WHEELHOUSE"
94-
${PIP_CMD} install $PIP_EXTRA_ARGS --find-links "$WHEELHOUSE" meta/dist/*.whl
96+
cp ./*/dist/*.whl "$WHEELHOUSE"
97+
# shellcheck disable=SC2086
98+
${PIP_CMD} install ${PIP_EXTRA_ARGS} --find-links "$WHEELHOUSE" meta/dist/*.whl
9599
fi

packages/test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ SKIP_PACKAGES=(
1111

1212
should_skip_package() {
1313
local pkg
14-
for pkg in ${SKIP_PACKAGES[@]}; do
15-
[[ $1 == $pkg ]] && return 0
14+
for pkg in "${SKIP_PACKAGES[@]}"; do
15+
[ "$1" = "$pkg" ] && return 0
1616
done
1717
return 1
1818
}

scripts/common_startup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ if [ $SKIP_CLIENT_BUILD -eq 0 ]; then
267267
# Set plugin path
268268
GALAXY_PLUGIN_PATH=$(python scripts/config_parse.py --setting=plugin_path --config-file="$GALAXY_CONFIG_FILE")
269269

270-
if [ $INSTALL_PREBUILT_CLIENT -eq 0 ]; then
270+
if [ "${INSTALL_PREBUILT_CLIENT}" -eq 0 ]; then
271271
# If we have not opted to use a prebuilt client, then build client.
272272
cd client
273273
# shellcheck disable=SC2086

scripts/release.sh

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,27 @@ shopt -s extglob
55
# TODO: upload packages
66
# TODO: set dev version in 21.01 (+ 20.09?) branches
77

8-
: ${VENV:=.venv}
9-
: ${FORK_REMOTE:=origin}
10-
: ${UPSTREAM_REMOTE:=upstream}
11-
: ${UPSTREAM_REMOTE_URL:=git@github.com:galaxyproject/galaxy.git}
12-
: ${DEV_BRANCH:=dev}
13-
: ${STABLE_BRANCH:=master}
8+
: "${VENV:=.venv}"
9+
: "${FORK_REMOTE:=origin}"
10+
: "${UPSTREAM_REMOTE:=upstream}"
11+
: "${UPSTREAM_REMOTE_URL:=git@github.com:galaxyproject/galaxy.git}"
12+
: "${DEV_BRANCH:=dev}"
13+
: "${STABLE_BRANCH:=master}"
1414

1515
# Vars for local releases
16-
: ${RELEASE_LOCAL_TAG:=local}
17-
: ${RELEASE_LOCAL_COMMIT:=$(git rev-parse --short HEAD)}
18-
: ${RELEASE_LOCAL_VERSION:=${RELEASE_LOCAL_TAG}$(date -u +%Y%m%dT%H%M%SZ).${RELEASE_LOCAL_COMMIT}}
16+
: "${RELEASE_LOCAL_TAG:=local}"
17+
: "${RELEASE_LOCAL_COMMIT:=$(git rev-parse --short HEAD)}"
18+
: "${RELEASE_LOCAL_VERSION:=${RELEASE_LOCAL_TAG}$(date -u +%Y%m%dT%H%M%SZ).${RELEASE_LOCAL_COMMIT}}"
1919

2020
# Only use this for dev/testing/CI to ignore forward merge conflicts, skip confirmation and package builds, etc.
21-
: ${TEST_MODE:=false}
21+
: "${TEST_MODE:=false}"
2222
$TEST_MODE && MERGE_STRATEGY_OPTIONS='-X ours' || MERGE_STRATEGY_OPTIONS=
2323

2424
VERIFY_PACKAGES=(wheel packaging)
2525

2626
BRANCH_CURR=$(git branch --show-current)
2727

28-
: ${RELEASE_CURR:=$(grep '^VERSION_MAJOR' lib/galaxy/version.py | sed -E -e "s/^[^'\"]*['\"]([^'\"]*)['\"]$/\1/")}
28+
: "${RELEASE_CURR:=$(grep '^VERSION_MAJOR' lib/galaxy/version.py | sed -E -e "s/^[^'\"]*['\"]([^'\"]*)['\"]$/\1/")}"
2929
RELEASE_NEXT=
3030
RELEASE_CURR_MINOR=
3131
RELEASE_CURR_MINOR_NEXT=
@@ -70,7 +70,6 @@ done
7070

7171
function trap_handler() {
7272
{ set +x; } 2>/dev/null
73-
local file
7473
$ERROR && log_func=log_error || log_func=log
7574
$log_func "Cleaning up..."
7675
if $WORKING_DIR_CLEAN; then
@@ -140,7 +139,8 @@ function sed_inplace() {
140139

141140

142141
function fork_owner() {
143-
local url=$(git remote get-url "$FORK_REMOTE")
142+
local url
143+
url=$(git remote get-url "$FORK_REMOTE")
144144
case "$url" in
145145
https://github.com/*)
146146
echo "$url" | awk -F/ '{print $4}'
@@ -182,7 +182,7 @@ function ensure_prereqs() {
182182
else
183183
pip_list=$(log_exec "${VENV}/bin/pip" list)
184184
fi
185-
for package in ${VERIFY_PACKAGES[@]}; do
185+
for package in "${VERIFY_PACKAGES[@]}"; do
186186
echo "$pip_list" | grep -E "^${package}\s+" || { log_error "Package '${package}' missing from venv: ${VENV}" ; exit 1; }
187187
done
188188
}
@@ -257,7 +257,8 @@ function branch_exists() {
257257

258258
function _test_forward_merge() {
259259
local curr="$1"
260-
local next="$(release_next "$curr")"
260+
local next
261+
next=$(release_next "$curr")
261262
local curr_branch="${UPSTREAM_REMOTE}/release_${curr}"
262263
local next_branch="${UPSTREAM_REMOTE}/release_${next}"
263264
local curr_local_branch="__release_merge_test_${curr}"
@@ -274,6 +275,7 @@ function _test_forward_merge() {
274275
fi
275276
git_checkout_temp "$next_local_branch" "$next_branch"
276277
# Test the merge even if ignoring just to test the code path
278+
# shellcheck disable=SC2086
277279
log_exec git merge $MERGE_STRATEGY_OPTIONS -m 'test merge; please ignore' "$curr_local_branch" || {
278280
log_error "Merging unmodified ${curr} to ${next} failed, resolve upstream first!"; exit 1; }
279281
if $recurse; then
@@ -283,21 +285,27 @@ function _test_forward_merge() {
283285

284286

285287
function test_forward_merge() {
286-
local branch_curr=$(git branch --show-current)
288+
local branch_curr
289+
branch_curr=$(git branch --show-current)
287290
_test_forward_merge "$@"
288291
git checkout "$branch_curr"
289292
}
290293

291294

292295
function perform_stable_merge() {
293-
[ "$RELEASE_TYPE" == 'initial' -o "$RELEASE_TYPE" == 'point' ] || return 0
294-
local branch_curr=$(git branch --show-current)
296+
[ "$RELEASE_TYPE" == 'initial' ] || [ "$RELEASE_TYPE" == 'point' ] || return 0
297+
local branch_curr
298+
branch_curr=$(git branch --show-current)
295299
git_checkout_temp '__stable' "${UPSTREAM_REMOTE}/${STABLE_BRANCH}"
296-
local stable=$(get_version_major)
297-
local curr_int=$(echo "$RELEASE_CURR" | tr -d .)
298-
local stable_int=$(echo "$stable" | tr -d .)
300+
local stable
301+
stable=$(get_version_major)
302+
local curr_int
303+
curr_int=$(echo "$RELEASE_CURR" | tr -d .)
304+
local stable_int
305+
stable_int=$(echo "$stable" | tr -d .)
299306
if [ "$curr_int" -ge "$stable_int" ]; then
300307
log "Release '${RELEASE_CURR}' >= stable branch release '${stable}', merging 'release_${RELEASE_CURR}' to '${STABLE_BRANCH}'"
308+
# shellcheck disable=SC2086
301309
log_exec git merge $MERGE_STRATEGY_OPTIONS -m "Merge branch 'release_${RELEASE_CURR}' into '${STABLE_BRANCH}'" "__release_${RELEASE_CURR}"
302310
PUSH_BRANCHES+=("__stable:${STABLE_BRANCH}")
303311
else
@@ -309,7 +317,8 @@ function perform_stable_merge() {
309317

310318
function _perform_forward_merge() {
311319
local curr="$1"
312-
local next="$(release_next "$curr")"
320+
local next
321+
next="$(release_next "$curr")"
313322
local curr_branch="${UPSTREAM_REMOTE}/release_${curr}"
314323
local next_branch="${UPSTREAM_REMOTE}/release_${next}"
315324
local curr_local_branch="__release_${curr}"
@@ -335,7 +344,8 @@ function _perform_forward_merge() {
335344

336345
function perform_forward_merge() {
337346
local curr="$1"
338-
local branch_curr=$(git branch --show-current)
347+
local branch_curr
348+
branch_curr=$(git branch --show-current)
339349
_perform_forward_merge "$@"
340350
declare -p PUSH_BRANCHES
341351
git checkout "$branch_curr"
@@ -348,7 +358,7 @@ function push_merged() {
348358
log "Pushing '${branch}' to remote '${UPSTREAM_REMOTE}'"
349359
log_exec git push "$UPSTREAM_REMOTE" "$branch"
350360
done
351-
if [ "$RELEASE_TYPE" == 'initial' -o "$RELEASE_TYPE" == 'point' ]; then
361+
if [ "$RELEASE_TYPE" == 'initial' ] || [ "$RELEASE_TYPE" == 'point' ]; then
352362
log_exec git push --tags "$UPSTREAM_REMOTE"
353363
fi
354364
}
@@ -448,7 +458,7 @@ function packages_make_all() {
448458
(
449459
cd packages/
450460
for dir in *; do
451-
[ ! -d "$dir" -o ! -f "${dir}/setup.cfg" ] && continue
461+
[ ! -d "$dir" ] || [ ! -f "${dir}/setup.cfg" ] && continue
452462
# can't use log_exec here because we want to capture output
453463
echo + make -C "$dir" "$@" 1>&2
454464
make -C "$dir" "$@" >"${dir}/make-${1}.log" 2>&1
@@ -504,7 +514,7 @@ function perform_version_update() {
504514

505515

506516
function perform_version_update_dev() {
507-
[ "$RELEASE_TYPE" == 'initial' -o "$RELEASE_TYPE" == 'point' ] || return 0
517+
[ "$RELEASE_TYPE" == 'initial' ] || [ "$RELEASE_TYPE" == 'point' ] || return 0
508518
log "Incrementing release version to '${RELEASE_CURR}.${RELEASE_CURR_MINOR_NEXT_DEV}' for development of next point release"
509519
update_galaxy_version 'VERSION_MINOR' "$RELEASE_CURR_MINOR_NEXT_DEV"
510520
log_exec git diff --exit-code && { log_error 'Missing expected version.py changes'; exit 1; } || true
@@ -542,7 +552,8 @@ function create_release_rc_initial() {
542552
sed_inplace -e "s/^RELEASE_CURR:=.*/RELEASE_CURR:=${RELEASE_NEXT}/" Makefile
543553
log_exec git diff --exit-code && { log_error 'Missing expected Makefile changes'; exit 1; } || true
544554
git add -- Makefile
545-
local package_version=$(packaging_version "${RELEASE_NEXT}.0dev0" "true")
555+
local package_version
556+
package_version=$(packaging_version "${RELEASE_NEXT}.0dev0" "true")
546557
update_package_versions "$package_version"
547558
git add -- packages/
548559
log_exec git commit -m "Update version to ${RELEASE_NEXT}.dev0"
@@ -551,7 +562,8 @@ function create_release_rc_initial() {
551562
log_exec git merge -X ours -m "Merge branch 'release_${RELEASE_CURR}' into 'dev'" "__release_${RELEASE_CURR}"
552563

553564
# Push branches for PR
554-
local owner=$(fork_owner)
565+
local owner
566+
owner=$(fork_owner)
555567
local curr_remote_branch="version-${RELEASE_CURR}.${RELEASE_CURR_MINOR_NEXT}"
556568
local next_remote_branch="version-${RELEASE_NEXT}.dev"
557569
log_exec git push "$FORK_REMOTE" "__release_${RELEASE_CURR}:${curr_remote_branch}"

test/release.sh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ set -euo pipefail
44
# Necessary for testing the release script
55
export TEST_MODE=true
66

7-
: ${ORIGIN:=origin}
8-
: ${STABLE_BRANCH:=master}
7+
: "${ORIGIN:=origin}"
8+
: "${STABLE_BRANCH:=master}"
99

1010
REPO_ROOT=
1111
FORK_ROOT=$(mktemp -d -t galaxy_release_test_XXXXXXXX)
@@ -16,7 +16,7 @@ TEST_RELEASE_CURR='99.0'
1616
TEST_RELEASE_NEXT='99.1'
1717
TEST_RELEASE_NEXT_NEXT='99.2'
1818

19-
: ${VENV:=${FORK_ROOT}/venv}
19+
: "${VENV:=${FORK_ROOT}/venv}"
2020
export VENV
2121

2222

@@ -60,7 +60,8 @@ function get_stable_version() {
6060
local part="$1"
6161
(
6262
cd_fork work
63-
local restore_branch="$(git branch --show-current)"
63+
local restore_branch
64+
restore_branch="$(git branch --show-current)"
6465
git checkout -q --no-track -b __stable_version_check "upstream/${STABLE_BRANCH}"
6566
grep "^VERSION_${part}" lib/galaxy/version.py | sed -E -e "s/^[^'\"]*['\"]([^'\"]*)['\"]$/\1/"
6667
git checkout -q "$restore_branch"
@@ -148,8 +149,9 @@ function verify_version() {
148149
local minor="$2"
149150
local ref="$3"
150151
local _ref="$3"
151-
local restore_branch="$(git branch --show-current)"
152-
[ -n "$(git tag -l $ref)" ] || _ref="upstream/${ref}"
152+
local restore_branch
153+
restore_branch="$(git branch --show-current)"
154+
[ -n "$(git tag -l "$ref")" ] || _ref="upstream/${ref}"
153155
log_exec git checkout --no-track -b "__${ref}" "$_ref"
154156
if grep -q "^VERSION_MAJOR = \"${major}\"$" lib/galaxy/version.py; then
155157
log "**** Major version '${major}' is correct at ref '${ref}'"
@@ -174,8 +176,9 @@ function verify_makefile_version() {
174176
local major="$1"
175177
local ref="$2"
176178
local _ref="$2"
177-
local restore_branch="$(git branch --show-current)"
178-
[ -n "$(git tag -l $ref)" ] || _ref="upstream/${ref}"
179+
local restore_branch
180+
restore_branch="$(git branch --show-current)"
181+
[ -n "$(git tag -l "$ref")" ] || _ref="upstream/${ref}"
179182
log_exec git checkout --no-track -b "__${ref}" "$_ref"
180183
if grep -q "^RELEASE_CURR:=${major}$" Makefile; then
181184
log "**** RELEASE_CURR '${major}' is correct in Makefile at ref '${ref}'"

0 commit comments

Comments
 (0)