From d283c3b36ff4ed09cc1b275b604bddc82693f075 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Tue, 27 May 2025 19:59:28 +0200 Subject: [PATCH 1/2] maintainer/scripts/check-cherry-picks: propagate git errors instead of passing silently Bash will not propagate the exit code from a subshell within a herestring, so the script silently passes when git throws an error there. Re-arranging things a bit and an error will now be thrown. --- maintainers/scripts/check-cherry-picks.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/maintainers/scripts/check-cherry-picks.sh b/maintainers/scripts/check-cherry-picks.sh index e7ffe2bf4c73..c846fa108df2 100755 --- a/maintainers/scripts/check-cherry-picks.sh +++ b/maintainers/scripts/check-cherry-picks.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Find alleged cherry-picks -set -e +set -eo pipefail if [ $# != "2" ] ; then echo "usage: check-cherry-picks.sh base_rev head_rev" @@ -11,6 +11,10 @@ fi PICKABLE_BRANCHES=${PICKABLE_BRANCHES:-master staging release-??.?? staging-??.??} problem=0 +commits="$(git rev-list \ + -E -i --grep="cherry.*[0-9a-f]{40}" --reverse \ + "$1..$2")" + while read new_commit_sha ; do if [ -z "$new_commit_sha" ] ; then continue # skip empty lines @@ -88,10 +92,6 @@ while read new_commit_sha ; do echo "$original_commit_sha not found in any pickable branch" problem=1 -done <<< "$( - git rev-list \ - -E -i --grep="cherry.*[0-9a-f]{40}" --reverse \ - "$1..$2" -)" +done <<< "$commits" exit $problem From 642de212a6ec1d4e76f7cca957163bbeaef85e88 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Tue, 27 May 2025 20:00:24 +0200 Subject: [PATCH 2/2] maintainer/scripts/check-cherry-picks: fix calling from outside nixpkgs The CI job calls this as trusted/maintainers/..., i.e. with a working directory outside the checkout. The git commands inside the script assume to be inside the checkout, though, so let's force that. --- maintainers/scripts/check-cherry-picks.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/maintainers/scripts/check-cherry-picks.sh b/maintainers/scripts/check-cherry-picks.sh index c846fa108df2..0e02c709d8f5 100755 --- a/maintainers/scripts/check-cherry-picks.sh +++ b/maintainers/scripts/check-cherry-picks.sh @@ -8,6 +8,9 @@ if [ $# != "2" ] ; then exit 2 fi +# Make sure we are inside the nixpkgs repo, even when called from outside +cd "$(dirname "${BASH_SOURCE[0]}")" + PICKABLE_BRANCHES=${PICKABLE_BRANCHES:-master staging release-??.?? staging-??.??} problem=0