From 23339e0c98e232dad93ea887543f576b580141f86c4900ff991672feb4ed495c Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 1 Oct 2014 12:15:16 +0000 Subject: [PATCH] - setup-fix-tar-with-long-options.patch: Update to new upstream version. This fixes handling of corner cases. - quilt-format-options-pass-through.patch, pop-add-auto-refresh.patch, push-add-auto-refresh.patch: Implement auto-refreshing when applying or unapplying patches, as suggested by Tomas Cech and Takashi Iwai. OBS-URL: https://build.opensuse.org/package/show/devel:tools:scm/quilt?expand=0&rev=87 --- pop-add-auto-refresh.patch | 89 ++++++++++++++++++++ push-add-auto-refresh.patch | 87 ++++++++++++++++++++ quilt-format-options-pass-through.patch | 24 ++++++ quilt.changes | 10 +++ quilt.spec | 6 ++ setup-fix-tar-with-long-options.patch | 105 +++++++++++++++--------- 6 files changed, 280 insertions(+), 41 deletions(-) create mode 100644 pop-add-auto-refresh.patch create mode 100644 push-add-auto-refresh.patch create mode 100644 quilt-format-options-pass-through.patch diff --git a/pop-add-auto-refresh.patch b/pop-add-auto-refresh.patch new file mode 100644 index 0000000..cf2e63c --- /dev/null +++ b/pop-add-auto-refresh.patch @@ -0,0 +1,89 @@ +From: Jean Delvare +Subject: pop: Add --refresh option +Upstream: Submitted (2014-10-01) + +Add an option to automatically refresh each patch before it gets +unapplied. +--- + quilt/pop.in | 11 +++++++++-- + test/auto-refresh.test | 27 +++++++++++++++++++++++++++ + 2 files changed, 36 insertions(+), 2 deletions(-) + +--- a/quilt/pop.in ++++ b/quilt/pop.in +@@ -19,7 +19,7 @@ fi + + usage() + { +- printf $"Usage: quilt pop [-afRqv] [num|patch]\n" ++ printf $"Usage: quilt pop [-afRqv] [--refresh] [num|patch]\n" + if [ x$1 = x-h ] + then + printf $" +@@ -41,6 +41,9 @@ completion can be used. + -q Quiet operation. + + -v Verbose operation. ++ ++--refresh ++ Automatically refresh every patch before it gets unapplied. + " + exit 0 + else +@@ -163,7 +166,7 @@ remove_patch() + return $status + } + +-options=`getopt -o fRqvah -- "$@"` ++options=`getopt -o fRqvah --long refresh -- "$@"` + + if [ $? -ne 0 ] + then +@@ -194,6 +197,9 @@ do + shift ;; + -h) + usage -h ;; ++ --refresh) ++ opt_refresh=1 ++ shift ;; + --) + shift + break ;; +@@ -239,6 +245,7 @@ fi + + for patch in $patches + do ++ [ -z "$opt_refresh" ] || quilt_command refresh $QUILT_REFRESH_ARGS + if ! remove_patch "$patch" + then + exit 1 +--- /dev/null ++++ b/test/auto-refresh.test +@@ -0,0 +1,27 @@ ++$ mkdir patches ++ ++$ echo a > a ++$ echo b > b ++ ++$ quilt new a.patch ++> Patch patches/a.patch is now on top ++$ quilt add a ++> File a added to patch patches/a.patch ++$ echo A > a ++ ++$ quilt new b.patch ++> Patch patches/b.patch is now on top ++$ quilt add b ++> File b added to patch patches/b.patch ++$ echo B > b ++ ++$ quilt pop -a --refresh ++> Refreshed patch patches/b.patch ++> Removing patch patches/b.patch ++> Restoring b ++> ++> Refreshed patch patches/a.patch ++> Removing patch patches/a.patch ++> Restoring a ++> ++> No patches applied diff --git a/push-add-auto-refresh.patch b/push-add-auto-refresh.patch new file mode 100644 index 0000000..189029c --- /dev/null +++ b/push-add-auto-refresh.patch @@ -0,0 +1,87 @@ +From: Jean Delvare +Subject: push: Add --refresh option +Upstream: Submitted (2014-10-01) + +Add an option to automatically refresh each patch after is was +successfully applied. +--- + quilt/push.in | 11 +++++++++-- + test/auto-refresh.test | 22 ++++++++++++++++++++++ + 2 files changed, 31 insertions(+), 2 deletions(-) + +--- a/quilt/push.in ++++ b/quilt/push.in +@@ -21,7 +21,7 @@ setup_colors + + usage() + { +- printf $"Usage: quilt push [-afqv] [--merge[=merge|diff3]] [--leave-rejects] [--color[=always|auto|never]] [num|patch]\n" ++ printf $"Usage: quilt push [-afqv] [--merge[=merge|diff3]] [--leave-rejects] [--color[=always|auto|never]] [--refresh] [num|patch]\n" + if [ x$1 = x-h ] + then + printf $" +@@ -53,6 +53,9 @@ be used. + + --color[=always|auto|never] + Use syntax coloring (auto activates it only if the output is a tty). ++ ++--refresh ++ Automatically refresh every patch after it was successfully applied. + " + exit 0 + else +@@ -294,7 +297,7 @@ check_duplicate_patches() + return 1 + } + +-options=`getopt -o fqvam::h --long fuzz:,merge::,leave-rejects,color:: -- "$@"` ++options=`getopt -o fqvam::h --long fuzz:,merge::,leave-rejects,color::,refresh -- "$@"` + + if [ $? -ne 0 ] + then +@@ -352,6 +355,9 @@ do + usage ;; + esac + shift 2 ;; ++ --refresh) ++ opt_refresh=1 ++ shift ;; + --) + shift + break ;; +@@ -412,6 +418,7 @@ do + then + exit 1 + fi ++ [ -z "$opt_refresh" ] || quilt_command refresh $QUILT_REFRESH_ARGS + [ -n "$opt_quiet" ] || echo + done \ + | cleanup_patch_output \ +--- a/test/auto-refresh.test ++++ b/test/auto-refresh.test +@@ -25,3 +25,25 @@ $ quilt pop -a --refresh + > Restoring a + > + > No patches applied ++ ++$ quilt push -a --refresh ++> Applying patch patches/a.patch ++> patching file a ++> Patch patches/a.patch is unchanged ++> ++> Applying patch patches/b.patch ++> patching file b ++> Patch patches/b.patch is unchanged ++> ++> Now at patch patches/b.patch ++ ++$ quilt pop -a --refresh ++> Patch patches/b.patch is unchanged ++> Removing patch patches/b.patch ++> Restoring b ++> ++> Patch patches/a.patch is unchanged ++> Removing patch patches/a.patch ++> Restoring a ++> ++> No patches applied diff --git a/quilt-format-options-pass-through.patch b/quilt-format-options-pass-through.patch new file mode 100644 index 0000000..c95a6d3 --- /dev/null +++ b/quilt-format-options-pass-through.patch @@ -0,0 +1,24 @@ +From: Jean Delvare +Subject: Allow patch format options to pass through +Upstream: Submitted (2014-10-01) + +In order to make "quilt_command refresh" work properly, we must ensure +that format options are passed through. +--- + quilt/scripts/patchfns.in | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/quilt/scripts/patchfns.in ++++ b/quilt/scripts/patchfns.in +@@ -976,6 +976,11 @@ quilt_command() + local command=$1 + shift + ++ # Refreshing here must produce the same output as "quilt refresh" on ++ # the command line ++ export QUILT_NO_DIFF_INDEX ++ export QUILT_NO_DIFF_TIMESTAMPS ++ + QUILT_COMMAND="" bash $BASH_OPTS -c "${SUBDIR:+cd $SUBDIR;} . $QUILT_DIR/$command" "quilt $command" "$@" + } + diff --git a/quilt.changes b/quilt.changes index 87d3c94..c9d4ced 100644 --- a/quilt.changes +++ b/quilt.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Wed Oct 1 14:10:22 CEST 2014 - jdelvare@suse.de + +- setup-fix-tar-with-long-options.patch: Update to new upstream + version. This fixes handling of corner cases. +- quilt-format-options-pass-through.patch, + pop-add-auto-refresh.patch, push-add-auto-refresh.patch: + Implement auto-refreshing when applying or unapplying patches, as + suggested by Tomas Cech and Takashi Iwai. + ------------------------------------------------------------------- Thu Jul 31 18:47:10 CEST 2014 - jdelvare@suse.de diff --git a/quilt.spec b/quilt.spec index 43ed868..ff49ee8 100644 --- a/quilt.spec +++ b/quilt.spec @@ -46,6 +46,9 @@ Patch4: suse-workaround-pseudo-release.patch Patch5: setup-skip-version-check.patch Patch6: setup-check-for-rpmbuild.patch Patch7: setup-fix-tar-with-long-options.patch +Patch8: quilt-format-options-pass-through.patch +Patch9: pop-add-auto-refresh.patch +Patch10: push-add-auto-refresh.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArch: noarch Recommends: procmail @@ -72,6 +75,9 @@ http://www.zip.com.au/~akpm/linux/patches/. %patch5 -p1 %patch6 -p1 %patch7 -p1 +%patch8 -p1 +%patch9 -p1 +%patch10 -p1 %build # --with-rpmbuild=/usr/lib/rpm/rpmb: diff --git a/setup-fix-tar-with-long-options.patch b/setup-fix-tar-with-long-options.patch index de164ec..41dda57 100644 --- a/setup-fix-tar-with-long-options.patch +++ b/setup-fix-tar-with-long-options.patch @@ -3,62 +3,85 @@ Subject: inspect: Handle long options passed to tar Upstream: Submitted The command line interface to tar is complex and sometimes confusing, -but we should still do our best to figure where the file name is on -that command line. +but we should still do our best to figure out where the file name is +on that command line. Add support for the --file FILE and --file=FILE options. Other long options must be explicitly skipped, as well as short options not containing the letter "f". With this we should be good to go in most real-world cases, but -there are still a few corner cases we may not handle properly. These -can be addressed later when reported. +there are still a few corner cases we may not handle properly. Let's +just hope we never hit them. Reported by Petr Tesarik. --- - quilt/scripts/inspect.in | 34 ++++++++++++++++++++++++++-------- - 1 file changed, 26 insertions(+), 8 deletions(-) +Changes since v1: +* Fix an endless loop when trying to parse options "x --file file". +* On "-xC software -f file", the previous code would extract "-f" as + the file name, instead of "file". + + quilt/scripts/inspect.in | 45 +++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 45 insertions(+) --- a/quilt/scripts/inspect.in +++ b/quilt/scripts/inspect.in -@@ -257,14 +257,32 @@ cat <<-'EOF' > $tmpdir/bin/wrapper - +@@ -258,13 +258,58 @@ cat <<-'EOF' > $tmpdir/bin/wrapper tar_input_file() { -- case "$1" in -- *C*f*) -- echo "$3" -- ;; -- *f*) -- echo "$2" -- ;; -- esac -+ while [ $# -gt 0 ]; do -+ case "$1" in -+ --file) -+ echo "$2" -+ return -+ ;; -+ --file=*) -+ echo "${1#--file=}" -+ return -+ ;; -+ --*) + case "$1" in ++ # Modern option format ++ -*) ++ while [ $# -gt 0 ]; do ++ case "$1" in ++ # Extract the file name (long option) ++ --file) ++ echo "$2" ++ return ++ ;; ++ --file=*) ++ echo "${1#--file=}" ++ return ++ ;; ++ # Skip other long options ++ --*) ++ shift ++ ;; ++ # Extract the file name (short option) ++ -*f) ++ echo "$2" ++ return ++ ;; ++ -f*) ++ echo "${1#-f}" ++ return ++ ;; ++ # Skip other short options and parameters ++ *) ++ shift ++ ;; ++ esac ++ done ++ ;; ++ # Legacy option format (must always come first) + *C*f*) + echo "$3" ++ return + ;; + *f*) + echo "$2" ++ return ++ ;; ++ ?*) ++ # Eat legacy options and try again ++ until [ $# -eq 0 -o "${1:0:1}" = "-" ]; do + shift -+ ;; -+ *C*f*) -+ echo "$3" -+ return -+ ;; -+ *f*) -+ echo "$2" -+ return -+ ;; -+ -*) -+ shift -+ ;; -+ esac -+ done ++ done ++ tar_input_file "$@" ++ return + ;; + esac ++ return 1 } unzip_input_file()