SHA256
1
0
forked from pool/quilt

Accepting request 254707 from devel:tools:scm

Automatic submission by obs-autosubmit

OBS-URL: https://build.opensuse.org/request/show/254707
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/quilt?expand=0&rev=57
This commit is contained in:
Stephan Kulow 2014-10-11 17:25:52 +00:00 committed by Git OBS Bridge
commit b604b85435
6 changed files with 280 additions and 41 deletions

View File

@ -0,0 +1,89 @@
From: Jean Delvare <jdelvare@suse.de>
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

View File

@ -0,0 +1,87 @@
From: Jean Delvare <jdelvare@suse.de>
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

View File

@ -0,0 +1,24 @@
From: Jean Delvare <jdelvare@suse.de>
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" "$@"
}

View File

@ -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 Thu Jul 31 18:47:10 CEST 2014 - jdelvare@suse.de

View File

@ -46,6 +46,9 @@ Patch4: suse-workaround-pseudo-release.patch
Patch5: setup-skip-version-check.patch Patch5: setup-skip-version-check.patch
Patch6: setup-check-for-rpmbuild.patch Patch6: setup-check-for-rpmbuild.patch
Patch7: setup-fix-tar-with-long-options.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 BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch BuildArch: noarch
Recommends: procmail Recommends: procmail
@ -72,6 +75,9 @@ http://www.zip.com.au/~akpm/linux/patches/.
%patch5 -p1 %patch5 -p1
%patch6 -p1 %patch6 -p1
%patch7 -p1 %patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%build %build
# --with-rpmbuild=/usr/lib/rpm/rpmb: # --with-rpmbuild=/usr/lib/rpm/rpmb:

View File

@ -3,62 +3,85 @@ Subject: inspect: Handle long options passed to tar
Upstream: Submitted Upstream: Submitted
The command line interface to tar is complex and sometimes confusing, 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 but we should still do our best to figure out where the file name is
that command line. on that command line.
Add support for the --file FILE and --file=FILE options. Other long Add support for the --file FILE and --file=FILE options. Other long
options must be explicitly skipped, as well as short options not options must be explicitly skipped, as well as short options not
containing the letter "f". containing the letter "f".
With this we should be good to go in most real-world cases, but 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 there are still a few corner cases we may not handle properly. Let's
can be addressed later when reported. just hope we never hit them.
Reported by Petr Tesarik. Reported by Petr Tesarik.
--- ---
quilt/scripts/inspect.in | 34 ++++++++++++++++++++++++++-------- Changes since v1:
1 file changed, 26 insertions(+), 8 deletions(-) * 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 --- a/quilt/scripts/inspect.in
+++ b/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() tar_input_file()
{ {
- case "$1" in case "$1" in
- *C*f*) + # Modern option format
- echo "$3" + -*)
- ;; + while [ $# -gt 0 ]; do
- *f*) + case "$1" in
- echo "$2" + # Extract the file name (long option)
- ;; + --file)
- esac + echo "$2"
+ while [ $# -gt 0 ]; do + return
+ case "$1" in + ;;
+ --file) + --file=*)
+ echo "$2" + echo "${1#--file=}"
+ return + return
+ ;; + ;;
+ --file=*) + # Skip other long options
+ echo "${1#--file=}" + --*)
+ return + 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 + shift
+ ;; + done
+ *C*f*) + tar_input_file "$@"
+ echo "$3" + return
+ return ;;
+ ;; esac
+ *f*) + return 1
+ echo "$2"
+ return
+ ;;
+ -*)
+ shift
+ ;;
+ esac
+ done
} }
unzip_input_file() unzip_input_file()