summaryrefslogtreecommitdiff
path: root/quilt/patches
diff options
context:
space:
mode:
Diffstat (limited to 'quilt/patches')
-rw-r--r--quilt/patches/check_SERIES_exists24
-rw-r--r--quilt/patches/dep3_headers88
-rw-r--r--quilt/patches/fail_on_missing40
-rw-r--r--quilt/patches/fix-test-setup20
-rw-r--r--quilt/patches/patch-wrapper_do_depend_on_proc21
-rw-r--r--quilt/patches/return258
-rw-r--r--quilt/patches/shell-subcommand92
-rw-r--r--quilt/patches/test_broken_patches39
-rw-r--r--quilt/patches/use-sensible-editor82
9 files changed, 464 insertions, 0 deletions
diff --git a/quilt/patches/check_SERIES_exists b/quilt/patches/check_SERIES_exists
new file mode 100644
index 0000000..077b952
--- /dev/null
+++ b/quilt/patches/check_SERIES_exists
@@ -0,0 +1,24 @@
+Displays an error message when the $SERIES file does not exist and when run
+in verbose mode.
+
+Closes: #369908
+
+Status wrt upstream: not submitted.
+
+
+---
+ quilt/scripts/patchfns.in | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/quilt/scripts/patchfns.in
++++ b/quilt/scripts/patchfns.in
+@@ -323,6 +323,9 @@ cat_series()
+ sed -e '/^#/d' -e 's/^[ '$'\t'']*//' \
+ -e 's/[ '$'\t''].*//' -e '/^$/d' $SERIES
+ else
++ if [ "$opt_verbose" ]; then
++ echo "series file not found: $SERIES" >&2
++ fi
+ return 1
+ fi
+ }
diff --git a/quilt/patches/dep3_headers b/quilt/patches/dep3_headers
new file mode 100644
index 0000000..b653226
--- /dev/null
+++ b/quilt/patches/dep3_headers
@@ -0,0 +1,88 @@
+Description: Adds the --dep3 option to include a DEP-3 template in the header.
+ .
+ Intensively using quilt for Debian packages and trying to adopt the
+ DEP-3 Patch Tagging Guidelines for my patches, I often get to go on
+ http://dep.debian.net/ to find the correct fields.
+ .
+ The proposed patch adds a --dep3 option to "quilt -e header" that
+ adds a template feeded to $EDITOR if the header is empty. The
+ template contains all fields and documents them, with indications of
+ required/optional.
+Origin: vendor
+Author: Didier Raboud <didier@raboud.com>
+Reviewed-by: Martin Quinson <mquinson@debian.org>
+Last-Update: 2012-02-02
+Bug-Debian: http://bugs.debian.org/543355
+
+---
+NOTE: Even if DEP-3 has started within Debian, it has been written as a
+vendor neutral specification and this patch should be forwarded upstream
+too. --Raphael Hertzog
+
+--- a/quilt/header.in
++++ b/quilt/header.in
+@@ -19,7 +19,7 @@ fi
+
+ usage()
+ {
+- printf $"Usage: quilt header [-a|-r|-e] [--backup] [--strip-diffstat] [--strip-trailing-whitespace] [patch]\n"
++ printf $"Usage: quilt header [-a|-r|-e] [--backup] [--dep3] [--strip-diffstat] [--strip-trailing-whitespace] [patch]\n"
+
+ if [ x$1 = x-h ]
+ then
+@@ -39,6 +39,10 @@ Print or change the header of the topmos
+
+ --backup
+ Create a backup copy of the old version of a patch as patch~.
++
++--dep3
++ When editing (-e), insert a template with DEP-3 headers.
++ DEP-3 is http://dep.debian.net/deps/dep3/ Patch Tagging Guidelines.
+ " "$EDITOR"
+ exit 0
+ else
+@@ -66,7 +70,7 @@ maybe_strip_diffstat()
+ fi
+ }
+
+-options=`getopt -o areh --long backup,strip-trailing-whitespace,strip-diffstat -- "$@"`
++options=`getopt -o areh --long backup,dep3,strip-trailing-whitespace,strip-diffstat -- "$@"`
+
+ if [ $? -ne 0 ]
+ then
+@@ -90,6 +94,9 @@ do
+ --backup)
+ QUILT_BACKUP=1
+ shift ;;
++ --dep3)
++ opt_use_dep3_headers=1
++ shift ;;
+ --strip-diffstat)
+ opt_strip_diffstat=1
+ shift ;;
+@@ -147,6 +154,25 @@ else
+ fi
+ ) > $tmp
+
++ # If triggered and file is empty, cat dep-3 headers into it
++ if [ -n "$opt_use_dep3_headers" -a ! -s $tmp ]
++ then
++ cat >$tmp <<-END
++ Description: <short description, required>
++ <long description that can span multiple lines, optional>
++ Author: <name and email of author, optional>
++ Origin: <upstream|backport|vendor|other>, <URL, required except if Author is present>
++ Bug: <URL to the upstream bug report if any, implies patch has been forwarded, optional>
++ Bug-<Vendor>: <URL to the vendor bug report if any, optional>
++ Forwarded: <URL|no|not-needed, useless if you have a Bug field, optional>
++ Applied-Upstream: <version|URL|commit, identifies patches merged upstream, optional>
++ Reviewed-by: <name and email of a reviewer, optional>
++ Last-Update: <YYYY-MM-DD, last update of the meta-information, optional>
++ ---
++ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
++ END
++ fi
++
+ if [ -n "$opt_edit" ]
+ then
+ LANG=$ORIGINAL_LANG sensible-editor "$tmp" || exit 1
diff --git a/quilt/patches/fail_on_missing b/quilt/patches/fail_on_missing
new file mode 100644
index 0000000..7a1a875
--- /dev/null
+++ b/quilt/patches/fail_on_missing
@@ -0,0 +1,40 @@
+ * Make sure that quilt fails when trying to push a non existant patch (ie
+ if there is a typo in the serie file) unless -f is provided.
+ (Closes: #358875).
+
+Upstream status: they asked for some cleanups, which are done. To be submitted.
+
+---
+ quilt/push.in | 7 +++++++
+ test/missing.test | 4 ++++
+ 2 files changed, 11 insertions(+)
+
+--- a/quilt/push.in
++++ b/quilt/push.in
+@@ -184,6 +184,13 @@ add_patch()
+ no_reject_files="-r $tmp"
+ fi
+
++ if [ ! -e "$patch_file" -a -z "$opt_force" ]
++ then
++ printf $"Patch %s does not exist\n" \
++ "$(print_patch $patch)" >&2
++ return 1
++ fi
++
+ apply_patch $patch "$patch_file"
+ status=$?
+ trap "" SIGINT
+--- a/test/missing.test
++++ b/test/missing.test
+@@ -5,6 +5,10 @@
+ < missing2.diff
+
+ $ quilt push -qa
++ > Patch patches/missing1.diff does not exist
++ > Applying patch patches/missing1.diff
++
++ $ quilt push -qaf
+ > Applying patch patches/missing1.diff
+ > Patch patches/missing1.diff does not exist; applied empty patch
+ > Applying patch patches/missing2.diff
diff --git a/quilt/patches/fix-test-setup b/quilt/patches/fix-test-setup
new file mode 100644
index 0000000..86b3c23
--- /dev/null
+++ b/quilt/patches/fix-test-setup
@@ -0,0 +1,20 @@
+Subject: avoid test failure in setup.test by hardcoding QUILT_PATCHES
+
+Without this patch, quilt setup would try to use debian/patches instead
+of patches and would fail. This is because quilt now initializes
+QUILT_PATCHES by looking up parent directories and it would find
+.pc/.quilt_patches of the debian source package.
+
+The right upstream fix is probably to hardcode the location in quilt setup
+but until that is approved, this fix is less intrusive and doesn't change
+the behaviour of quilt setup.
+
+Bug-Debian: http://bugs.debian.org/573689
+
+--- a/test/setup.test
++++ b/test/setup.test
+@@ -1,3 +1,4 @@
++$ export QUILT_PATCHES=patches
+ $ mkdir dir
+
+ $ echo 1 > dir/foo.orig
diff --git a/quilt/patches/patch-wrapper_do_depend_on_proc b/quilt/patches/patch-wrapper_do_depend_on_proc
new file mode 100644
index 0000000..9801889
--- /dev/null
+++ b/quilt/patches/patch-wrapper_do_depend_on_proc
@@ -0,0 +1,21 @@
+Let patch-wrapper die with an informative message when /proc is not mounted
+althrough it needs it to pass the patching request to GNU patch since it
+fails to understand all options.
+
+---
+ bin/patch-wrapper.in | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/bin/patch-wrapper.in
++++ b/bin/patch-wrapper.in
+@@ -171,6 +171,10 @@ then
+ if [ -n "$opt_input" ]
+ then
+ patch=$opt_input
++ elif [ ! -e /proc/self ]
++ then
++ echo "patch-wrapper: /proc not mounted!" >&2
++ exit 1
+ elif [ -e /proc/self/fd/0 ]
+ then
+ patch=$(readlink /proc/self/fd/0)
diff --git a/quilt/patches/return2 b/quilt/patches/return2
new file mode 100644
index 0000000..9aa364f
--- /dev/null
+++ b/quilt/patches/return2
@@ -0,0 +1,58 @@
+ * Make sure that quilt returns 2 when there is nothing to do so that
+ patchsys-quilt.mk works again. Upstream regression since 0.33.
+ (Closes: #358792).
+
+Upstream status: Submitted 060427
+
+---
+ quilt/push.in | 2 +-
+ quilt/scripts/patchfns.in | 8 ++++----
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+--- a/quilt/push.in
++++ b/quilt/push.in
+@@ -362,7 +362,7 @@ else
+ [ -z "$opt_all" ] && number=1
+ fi
+
+-stop_at_patch=$(find_unapplied_patch "$stop_at_patch") || exit 1
++stop_at_patch=$(find_unapplied_patch "$stop_at_patch") || exit $?
+
+ [ -z "$opt_verbose" ] && silent_unless_verbose=-s
+ [ -n "$opt_force" ] && opt_leave_rejects=1
+--- a/quilt/scripts/patchfns.in
++++ b/quilt/scripts/patchfns.in
+@@ -477,7 +477,7 @@ find_last_patch()
+ else
+ printf $"No series file found\n" >&2
+ fi
+- return 1
++ return 2
+ fi
+
+ echo "$patch"
+@@ -582,7 +582,7 @@ find_unapplied_patch()
+ then
+ printf $"Patch %s is currently applied\n" \
+ "$(print_patch $patch)" >&2
+- return 1
++ return 2
+ fi
+ echo "$patch"
+ else
+@@ -592,13 +592,13 @@ find_unapplied_patch()
+ then
+ patch_after "$start"
+ else
+- find_first_patch || return 1
++ find_first_patch || return 2
+ fi
+ if [ $? -ne 0 ]
+ then
+ printf $"File series fully applied, ends at patch %s\n" \
+ "$(print_patch $start)" >&2
+- return 1
++ return 2
+ fi
+ fi
+ }
diff --git a/quilt/patches/shell-subcommand b/quilt/patches/shell-subcommand
new file mode 100644
index 0000000..48df2ab
--- /dev/null
+++ b/quilt/patches/shell-subcommand
@@ -0,0 +1,92 @@
+Description: Implement a new "quilt shell" command
+ The command launches a shell in a duplicate environment. After exiting
+ the shell, any modifications made in this environment are applied to the
+ topmost patch.
+Author: Josselin Mouette <joss@debian.org>
+Bug-Debian: http://bugs.debian.org/526141
+
+---
+ quilt/shell.in | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 67 insertions(+)
+
+--- /dev/null
++++ b/quilt/shell.in
+@@ -0,0 +1,67 @@
++#! @BASH@
++
++# This script is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License version 2 as
++# published by the Free Software Foundation.
++#
++# See the COPYING and AUTHORS files for more details.
++
++# Read in library functions
++if [ "$(type -t patch_file_name)" != function ]
++then
++ if ! [ -r $QUILT_DIR/scripts/patchfns ]
++ then
++ echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
++ exit 1
++ fi
++ . $QUILT_DIR/scripts/patchfns
++fi
++
++if [ "$1" = "-h" ]; then
++ printf $"Usage: quilt shell [command]\n"
++ printf $"
++Launch a shell in a duplicate environment. After exiting the shell, any
++modifications made in this environment are applied to the topmost patch.
++
++If a command is specified, it is executed instead of launching the shell.
++"
++ exit 0
++fi
++
++tmpdir=$(mktemp -d /tmp/quilt-XXXXXX)
++
++cp -a . $tmpdir
++
++(
++ cd $tmpdir/"$SUBDIR"
++ if [ $# -gt 0 ]; then
++ exec "$@"
++ else
++ $SHELL
++ fi
++)
++
++# Find new directories
++( cd $tmpdir; find . -type d ! -path ./"$QUILT_PC"/\* ! -path ./"$QUILT_PATCHES"/\* ) | while read dir; do
++ if [ ! -d "$dir" ]; then
++ mkdir -p "$dir"
++ fi
++done
++
++# New and modified files
++( cd $tmpdir; find . -type f ! -path ./"$QUILT_PC"/\* ! -path ./"$QUILT_PATCHES"/\* ) | while read file; do
++ if [ ! -f "$file" ] || ! diff -q "$file" $tmpdir/"$file" > /dev/null 2>&1; then
++ quilt_command add "$file"
++ cp -a $tmpdir/"$file" "$file"
++ fi
++done
++
++# Removed files
++( find . -type f ! -path ./"$QUILT_PC"/\* ! -path ./"$QUILT_PATCHES"/\* ) | while read file; do
++ if [ ! -f $tmpdir/"$file" ]; then
++ quilt_command add "$file"
++ rm -f "$file"
++ fi
++done
++
++rm -rf $tmpdir
+--- a/bash_completion
++++ b/bash_completion
+@@ -97,7 +97,7 @@ _quilt_completion()
+ # quilt sub commands
+ cmds='add annotate applied delete diff edit files fold fork graph \
+ grep header import mail new next patches pop previous push refresh \
+- remove rename revert series setup snapshot top unapplied'
++ remove rename revert series setup shell snapshot top unapplied'
+
+ # if no command were given, complete on commands
+ if [[ $COMP_CWORD -eq 1 ]] ; then
diff --git a/quilt/patches/test_broken_patches b/quilt/patches/test_broken_patches
new file mode 100644
index 0000000..c161288
--- /dev/null
+++ b/quilt/patches/test_broken_patches
@@ -0,0 +1,39 @@
+---
+ test/file-not-found.test | 30 ++++++++++++++++++++++++++++++
+ 1 file changed, 30 insertions(+)
+
+Index: b/test/file-not-found.test
+===================================================================
+--- /dev/null
++++ b/test/file-not-found.test
+@@ -0,0 +1,30 @@
++# Try to push a patch touching a file which does not exist in this tree
++
++$ rm -rf d
++$ mkdir -p d/patches
++$ cd d
++
++$ mkdir subdir
++$ echo foo > subdir/file.txt
++$ echo bar > subdir/other.txt
++$ diff -u subdir/file.txt subdir/other.txt > patches/patch
++# simulate --no-timestamp
++$ sed 's|subdir/file.txt.*|subdir/file.txt|' patches/patch > patches/patch2
++$ sed 's|subdir/other.txt.*|subdir/other.txt|' patches/patch2 > patches/patch
++$ rm subdir/other.txt patches/patch2
++$ echo patch > patches/series
++
++$ quilt push
++> Applying patch patches/patch
++> patching file other.txt
++> Hunk #1 FAILED at 1.
++> 1 out of 1 hunk FAILED -- rejects in file other.txt
++> Patch patches/patch does not apply (enforce with -f)
++
++$ quilt push -qf
++> Applying patch patches/patch
++> 1 out of 1 hunk FAILED -- saving rejects to file other.txt.rej
++> Applied patch patches/patch (forced; needs refresh)
++
++$ cd ..
++$ rm -rf d
diff --git a/quilt/patches/use-sensible-editor b/quilt/patches/use-sensible-editor
new file mode 100644
index 0000000..a61c219
--- /dev/null
+++ b/quilt/patches/use-sensible-editor
@@ -0,0 +1,82 @@
+Description: use Debian's sensible-editor instead of trying to guess the editor
+ the original bug that triggered this change was that quilt doesn't honour $VISUAL
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=509076
+Forwarded: not-needed
+Author: Ryan Niebur <ryanryan52@gmail.com>
+
+---
+ quilt/edit.in | 4 +---
+ quilt/header.in | 4 +---
+ quilt/mail.in | 4 +---
+ 3 files changed, 3 insertions(+), 9 deletions(-)
+
+--- a/quilt/edit.in
++++ b/quilt/edit.in
+@@ -6,8 +6,6 @@
+ #
+ # See the COPYING and AUTHORS files for more details.
+
+-: ${EDITOR:=vi}
+-
+ # Read in library functions
+ if [ "$(type -t patch_file_name)" != function ]
+ then
+@@ -65,7 +63,7 @@ if [ $status -ne 0 -a $status -ne 2 ]
+ then
+ exit $status
+ fi
+-LANG=$ORIGINAL_LANG $EDITOR "${@/#/$SUBDIR}"
++LANG=$ORIGINAL_LANG sensible-editor "${@/#/$SUBDIR}"
+ status=$?
+ for file in "$@"
+ do
+--- a/quilt/header.in
++++ b/quilt/header.in
+@@ -17,8 +17,6 @@ then
+ . $QUILT_DIR/scripts/patchfns
+ fi
+
+-: ${EDITOR:=vi}
+-
+ usage()
+ {
+ printf $"Usage: quilt header [-a|-r|-e] [--backup] [--strip-diffstat] [--strip-trailing-whitespace] [patch]\n"
+@@ -151,7 +149,7 @@ else
+
+ if [ -n "$opt_edit" ]
+ then
+- LANG=$ORIGINAL_LANG $EDITOR "$tmp" || exit 1
++ LANG=$ORIGINAL_LANG sensible-editor "$tmp" || exit 1
+ fi
+
+ maybe_strip_diffstat < $tmp \
+--- a/quilt/mail.in
++++ b/quilt/mail.in
+@@ -6,8 +6,6 @@
+ #
+ # See the COPYING and AUTHORS files for more details.
+
+-: ${EDITOR:=vi}
+-
+ # Read in library functions
+ if [ "$(type -t patch_file_name)" != function ]
+ then
+@@ -524,7 +522,7 @@ introduction="$(gen_tempfile)"
+
+ if [ -z "$opt_message" ]
+ then
+- if ! LANG=$ORIGINAL_LANG $EDITOR $introduction
++ if ! LANG=$ORIGINAL_LANG sensible-editor $introduction
+ then
+ rm -f $introduction
+ exit 1
+--- a/test/edit.test
++++ b/test/edit.test
+@@ -6,6 +6,7 @@ $ cat > editor
+ < sed -e 's:foo:bar:' $1 > $1.new
+ < mv $1.new $1
+ $ chmod +x editor
++$ unset VISUAL
+ $ export EDITOR=%{PWD}/editor
+
+ $ quilt new patch