diff options
author | Andreas Gruenbacher <agruen@suse.de> | 2003-11-17 19:49:43 +0000 |
---|---|---|
committer | Andreas Gruenbacher <agruen@suse.de> | 2003-11-17 19:49:43 +0000 |
commit | 55d662beaf3ff81a72d2d8c71807d2adba569ebe (patch) | |
tree | a4dd345b9248253b1d5444cb56c7738d83574870 /scripts/apatch.in | |
parent | 26c7e9c357a45e7afe462708eb6232d72df80469 (diff) | |
download | quilt-55d662beaf3ff81a72d2d8c71807d2adba569ebe.tar.gz |
- Add new command `quilt fold' to fold one patch into another.
- Fix bug in `quilt files': Files that are neither present in the
working directory and have an empty backup copy sometimes were
still listed.
- Some minor cleanups in apatch.
- Add test/fold.test, and fix a now-useless check in one.test.
Diffstat (limited to 'scripts/apatch.in')
-rwxr-xr-x | scripts/apatch.in | 58 |
1 files changed, 27 insertions, 31 deletions
diff --git a/scripts/apatch.in b/scripts/apatch.in index 3ec72e4..ad64104 100755 --- a/scripts/apatch.in +++ b/scripts/apatch.in @@ -23,20 +23,6 @@ usage() exit 1 } -rollback_patch() -{ - local patch=$1 pc_file=$(gen_tempfile) - - # FIXME backup_files should scan the directory hierarchy itself. - files_in_patch $patch > $pc_file - @LIB@/backup-files $silent_unless_verbose -f $pc_file -B .pc/$patch/ -r - if [ -z "$opt_leave_rejects" ] - then - @SED@ -e 's/$/\.rej/' $pc_file | xargs rm -f - fi - rm -f $pc_file -} - interrupt() { rollback_patch $1 @@ -57,32 +43,32 @@ apply_patch() if [ "x${patch_file:(-3)}" = "x.gz" ] then - output="$( gzip -cd $patch_file \ | @PATCH@ $(patch_args $patch) --backup --prefix=".pc/$patch/" \ - -E $silent $force_apply 2>&1 )" + -E $silent $force_apply 2>&1 elif [ "x${patch_file:(-4)}" = "x.bz2" ] then - output="$( bzip2 -cd $patch_file \ | @PATCH@ $(patch_args $patch) --backup --prefix=".pc/$patch/" \ - -E $silent $force_apply 2>&1 )" + -E $silent $force_apply 2>&1 else - output="$( @PATCH@ $(patch_args $patch) --backup --prefix=".pc/$patch/" \ - -E $silent -i $patch_file $force_apply 2>&1 )" + -E $silent $force_apply -i $patch_file 2>&1 fi - status=${PIPESTATUS[0]} - if [ $status -ne 0 -a -z "$opt_leave_rejects" ] - then - # The reject files are removed in rollback_patch. - echo "$output" \ - | sed -e 's/-- saving rejects to file \(.\+\)\.rej/-- rejects in file \1/' - elif [ -n "$output" ] +} + +rollback_patch() +{ + local patch=$1 pc_file=$(gen_tempfile) + + # FIXME backup_files should scan the directory hierarchy itself. + files_in_patch $patch > $pc_file + @LIB@/backup-files $silent_unless_verbose -f $pc_file -B .pc/$patch/ -r + if [ -z "$opt_leave_rejects" ] then - echo "$output" + @SED@ -e 's/$/\.rej/' $pc_file | xargs rm -f fi - return $status + rm -f $pc_file } apatch() @@ -93,11 +79,21 @@ apatch() echo $"Applying $patch" trap "interrupt $patch" SIGINT - apply_patch $patch - status=$? + output="$(apply_patch $patch)" + status=${PIPESTATUS[0]} trap "" SIGINT + if [ $status -ne 0 -a -z "$opt_leave_rejects" ] + then + # The reject files are removed in rollback_patch. + echo "$output" \ + | sed -e 's/-- saving rejects to file \(.\+\)\.rej/-- rejects in file \1/' + elif [ -n "$output" ] + then + echo "$output" + fi + if [ $status -eq 0 -o -n "$opt_force" ] then add_to_db $patch |