From 134d5118cda3113ed9619fc48af61548678f1f48 Mon Sep 17 00:00:00 2001 From: Juergen Gross Date: Jul 05 2022 15:06:50 +0000 Subject: scripts/sequence-patch.sh: let "--fast", "--rapid" and "" behave consistently Today scripts/sequence-patch.sh will stop before applying a patch when being called with "--fast" or "--rapid" and a patch name, while it will apply the named patch when being called without "--fast" or "--rapid". Change that by letting apply_patches() use the PATCHES_BEFORE[] and PATCHES_AFTER[] arrays as apply_rapid_patches() and apply_fast_patches() are doing already. In order to keep the capability to single step through the remaining patches add a function for that purpose. --- diff --git a/scripts/sequence-patch.sh b/scripts/sequence-patch.sh index 0d0723c..15f9409 100755 --- a/scripts/sequence-patch.sh +++ b/scripts/sequence-patch.sh @@ -38,7 +38,7 @@ esac usage() { cat <> $PATCH_DIR/series rapidquilt push -a -d $PATCH_DIR -p $PWD $fuzz $DRY_RUN status=$? - - PATCHES=( ${PATCHES_AFTER[@]} ) } apply_fast_patches() { @@ -100,8 +98,6 @@ apply_fast_patches() { echo "Logfile: $PATCH_LOG" status=1 fi - - PATCHES=( ${PATCHES_AFTER[@]} ) } SKIPPED_PATCHES= @@ -159,13 +155,26 @@ apply_one_patch() { } apply_patches() { - set -- "${PATCHES[@]}" - n=0 - while [ $# -gt 0 ]; do - PATCH="$1" - if ! $QUILT && test "$PATCH" = "$LIMIT"; then - STEP_BY_STEP=1 - echo "Stopping before $PATCH" + for ((n=0; n<${#PATCHES_BEFORE[@]}; n++)); do + PATCH=${PATCHES_BEFORE[n]} + if [ ! -r "$PATCH" ]; then + echo "Patch $PATCH not found." + status=1 + break + fi + apply_one_patch || break + done +} + +apply_rest_patches() { + STEP_BY_STEP=1 + echo "Stopping before ${PATCHES[0]}" + for ((n=0; n<${#PATCHES[@]}; n++)); do + PATCH=${PATCHES[n]} + if [ ! -r "$PATCH" ]; then + echo "Patch $PATCH not found." + status=1 + break fi if [ -n "$STEP_BY_STEP" ]; then while true; do @@ -176,7 +185,7 @@ apply_patches() { break ;; ([nN]) - break 2 # break out of outer loop + break 2 # break out of outer loop ;; ([aA]) unset STEP_BY_STEP @@ -185,22 +194,7 @@ apply_patches() { esac done fi - - if [ ! -r "$PATCH" ]; then - echo "Patch $PATCH not found." - status=1 - break - fi apply_one_patch || break - - shift - if $QUILT; then - unset PATCHES[$n] - fi - let n++ - if $QUILT && test "$PATCH" = "$LIMIT"; then - break - fi done } @@ -621,6 +615,12 @@ else apply_patches fi +PATCHES=( ${PATCHES_AFTER[@]} ) + +if ! $QUILT && [ -z "$FAST$RAPID" ]; then + apply_rest_patches +fi + if [ -n "$DRY_RUN" ]; then exit $status fi