OBS User unknown 2007-04-18 16:37:36 +00:00 committed by Git OBS Bridge
parent 9bcd7b669b
commit 23cc7daa94
6 changed files with 38 additions and 426 deletions

View File

@ -1,17 +1,20 @@
Index: quilt-0.46/Makefile.in ---
=================================================================== Makefile.in | 10 +++++-----
--- quilt-0.46.orig/Makefile.in doc/quilt.1.in | 2 +-
+++ quilt-0.46/Makefile.in 2 files changed, 6 insertions(+), 6 deletions(-)
@@ -257,7 +257,7 @@ $(patsubst %.in,%,$(wildcard bin/*.in qu
--- a/Makefile.in
+++ b/Makefile.in
@@ -258,7 +258,7 @@ $(patsubst %.in,%,$(wildcard bin/*.in qu
-e 's:@VERSION''@:$(VERSION):g' \ -e 's:@VERSION''@:$(VERSION):g' \
-e 's:@RELEASE''@:$(RELEASE):g' \ -e 's:@RELEASE''@:$(RELEASE):g' \
-e 's:@LOCALEDIR''@:$(localedir):g' \ -e 's:@LOCALEDIR''@:$(localedir):g' \
- -e 's:@DOCSUBDIR''@:$(docdir)/$(PACKAGE)-$(VERSION):g' \ - -e 's:@DOCSUBDIR''@:$(docdir)/$(PACKAGE)-$(VERSION):g' \
+ -e 's:@DOCSUBDIR''@:$(docdir)/$(PACKAGE):g' \ + -e 's:@DOCSUBDIR''@:$(docdir)/$(PACKAGE):g' \
$< > $@ $< > $@
@$(if $(filter-out $<,$(NON_EXEC_IN)),chmod +x $@) @$(if $(filter-out $<,$(NON_EXEC_IN)),chmod +x $@)
@@ -316,11 +316,11 @@ endif @@ -317,11 +317,11 @@ endif
$(INSTALL) -d $(BUILD_ROOT)$(libdir)/$(PACKAGE) $(INSTALL) -d $(BUILD_ROOT)$(libdir)/$(PACKAGE)
$(INSTALL) -m 755 $(LIB:%=lib/%) $(BUILD_ROOT)$(libdir)/$(PACKAGE)/ $(INSTALL) -m 755 $(LIB:%=lib/%) $(BUILD_ROOT)$(libdir)/$(PACKAGE)/
@ -26,19 +29,17 @@ Index: quilt-0.46/Makefile.in
$(INSTALL) -d $(BUILD_ROOT)$(mandir)/man1 $(INSTALL) -d $(BUILD_ROOT)$(mandir)/man1
$(INSTALL) -m 644 $(MAN1) $(BUILD_ROOT)$(mandir)/man1/ $(INSTALL) -m 644 $(MAN1) $(BUILD_ROOT)$(mandir)/man1/
@@ -356,7 +356,7 @@ uninstall :: @@ -359,7 +359,7 @@ uninstall ::
$(notdir $(MAN1))) \ $(notdir $(MAN1))) \
$(BUILD_ROOT)$(etcdir)/bash_completion.d/quilt \ $(BUILD_ROOT)$(etcdir)/bash_completion.d/quilt \
$(BUILD_ROOT)$(etcdir)/quilt.quiltrc \ $(BUILD_ROOT)$(etcdir)/quilt.quiltrc \
- $(BUILD_ROOT)$(docdir)/$(PACKAGE)-$(VERSION)/ - $(BUILD_ROOT)$(docdir)/$(PACKAGE)-$(VERSION)/ \
+ $(BUILD_ROOT)$(docdir)/$(PACKAGE)/ + $(BUILD_ROOT)$(docdir)/$(PACKAGE)/ \
$(BUILD_ROOT)$(emacsdir)/quilt.el
check: $(TESTS:test/%.test=test/.%.ok) check: $(TESTS:test/%.test=test/.%.ok)
check-all: $(TESTS:test/%.test=check-%) --- a/doc/quilt.1.in
Index: quilt-0.46/doc/quilt.1.in +++ b/doc/quilt.1.in
===================================================================
--- quilt-0.46.orig/doc/quilt.1.in
+++ quilt-0.46/doc/quilt.1.in
@@ -212,7 +212,7 @@ the pdf documentation, and in the help m @@ -212,7 +212,7 @@ the pdf documentation, and in the help m
.SH SEE ALSO .SH SEE ALSO

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:11e896e80663a8ab9aebd27407c8db731903effcf3863516c1b0f6553a1b938c oid sha256:a4775f180bdbb609f2ae27ebe2cc86b2b7c17b7025c5f62c62767e1991d4b116
size 369012 size 373803

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Apr 18 13:40:40 CEST 2007 - agruen@suse.de
- Add emacs quilt mode.
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Mar 26 15:24:05 CEST 2007 - agruen@suse.de Mon Mar 26 15:24:05 CEST 2007 - agruen@suse.de

View File

@ -16,15 +16,15 @@ Summary: A Tool for Working with Many Patches
License: GNU General Public License (GPL) License: GNU General Public License (GPL)
Group: Productivity/Text/Utilities Group: Productivity/Text/Utilities
Version: 0.46 Version: 0.46
Release: 24 Release: 27
Requires: coreutils diffutils patch gzip bzip2 perl mktemp Requires: coreutils diffutils patch gzip bzip2 perl mktemp
Autoreqprov: off Autoreqprov: off
Source: %{name}-%{version}.tar.bz2 Source: %{name}-%{version}.tar.bz2
Source1: suse-start-quilt-mode.el
Patch1: expand.diff Patch1: expand.diff
Patch2: docdir.diff Patch2: docdir.diff
Patch3: quiltrc.diff Patch3: quiltrc.diff
Patch4: patch-wrapper-rpm.diff Patch4: patch-wrapper-rpm.diff
Patch5: refresh-z.diff
Url: http://savannah.nongnu.org/projects/quilt Url: http://savannah.nongnu.org/projects/quilt
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -44,7 +44,7 @@ Authors:
%prep %prep
%setup -q %setup -q
%patch -p1 -P 1 -P 2 -P 3 -P 4 -P 5 %patch -p1 -P 1 -P 2 -P 3 -P 4
%build %build
autoconf autoconf
@ -80,6 +80,9 @@ make install BUILD_ROOT=$RPM_BUILD_ROOT
%{find_lang} %{name} %{find_lang} %{name}
# Make "vi" an alias for the edit command # Make "vi" an alias for the edit command
ln -s edit $RPM_BUILD_ROOT/usr/share/quilt/vi ln -s edit $RPM_BUILD_ROOT/usr/share/quilt/vi
# Autoload quilt-mode in the SuSE emacs package
install -m 644 %_sourcedir/suse-start-quilt-mode.el \
$RPM_BUILD_ROOT/usr/share/emacs/site-lisp/
%clean %clean
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
@ -89,6 +92,7 @@ rm -rf $RPM_BUILD_ROOT
/usr/bin/guards /usr/bin/guards
/usr/bin/quilt /usr/bin/quilt
/usr/share/quilt/ /usr/share/quilt/
/usr/share/emacs/
/usr/lib/quilt/ /usr/lib/quilt/
/etc/bash_completion.d/quilt /etc/bash_completion.d/quilt
/etc/quilt.quiltrc /etc/quilt.quiltrc
@ -99,6 +103,8 @@ rm -rf $RPM_BUILD_ROOT
%doc doc/quilt.pdf %doc doc/quilt.pdf
%changelog %changelog
* Wed Apr 18 2007 - agruen@suse.de
- Add emacs quilt mode.
* Mon Mar 26 2007 - agruen@suse.de * Mon Mar 26 2007 - agruen@suse.de
- Quilt refresh: fix existing patch check. - Quilt refresh: fix existing patch check.
* Thu Feb 15 2007 - olh@suse.de * Thu Feb 15 2007 - olh@suse.de

View File

@ -1,406 +0,0 @@
Index: quilt-0.46/quilt/diff.in
===================================================================
--- quilt-0.46.orig/quilt/diff.in
+++ quilt-0.46/quilt/diff.in
@@ -80,7 +80,8 @@ included.
}
colorize() {
- if [ -n "$opt_color" ]; then
+ if [ -n "$opt_color" ]
+ then
sed -e '
s/^\(Index:\|---\|+++\|\*\*\*\) .*/'$color_diff_hdr'&'$color_clear'/
t ; s/^+.*/'$color_diff_add'&'$color_clear'/
@@ -304,42 +305,9 @@ fi
if [ -n "$opt_relative" ]
then
- patch_file=$(patch_file_name $last_patch)
- patch_args=$(patch_args $last_patch)
workdir=$(gen_tempfile -d $PWD/quilt)
-
- if [ ${#files[@]} -gt 0 ] \
- && ! ( cd $QUILT_PC/$last_patch &&
- cp -l --parents "${files[@]}" $workdir/ )
- then
- printf $"Failed to copy files to temporary directory\n" >&2
- die 1
- fi
- # Now we may have some zero-size files that have no permissions
- # (which represent files that the patch creates). Those may have
- # been created in the meantime, but patch would refuse to touch
- # them: We must remove them here.
- find $workdir -type f -size 0 -exec rm -f '{}' ';'
-
- if [ -s $patch_file ]
- then
- if ! cat_file $patch_file \
- | patch -d $workdir $QUILT_PATCH_OPTS $patch_args \
- --no-backup-if-mismatch -Ef \
- >/dev/null 2>/dev/null
- then
- # Generating a relative diff for a subset of files in
- # the patch will fail. Also, if a patch was force
- # applied, we know that it won't apply cleanly. In
- # all other cases, print a warning.
-
- if [ ! -e $QUILT_PC/$last_patch~refresh -a \
- ${#opt_files[@]} -eq 0 ]
- then
- printf $"Failed to patch temporary files\n" >&2
- fi
- fi
- fi
+ apply_patch_temporarily "$workdir" "$last_patch" "${files[@]}" \
+ || die 1
fi
for file in "${files[@]}"
Index: quilt-0.46/quilt/fork.in
===================================================================
--- quilt-0.46.orig/quilt/fork.in
+++ quilt-0.46/quilt/fork.in
@@ -72,11 +72,7 @@ if [ $# -eq 1 ]
then
new_patch="$1"
else
- base=$(echo "$top_patch" \
- | sed -r -e 's:(\.gz|\.bz2)$::' -e 's:(\.diff?|\.patch)$::')
- num=$(echo "$base" | sed -nre 's:.*-([0-9]+)$:\1:'p)
- [ -n "$num" ] || num=1
- new_patch="${base%-$num}-$((num+1))${top_patch#$base}"
+ new_patch="$(next_filename "$top_patch")"
fi
new_patch=${new_patch#$QUILT_PATCHES/}
Index: quilt-0.46/quilt/refresh.in
===================================================================
--- quilt-0.46.orig/quilt/refresh.in
+++ quilt-0.46/quilt/refresh.in
@@ -19,7 +19,7 @@ fi
usage()
{
- printf $"Usage: quilt refresh [-p n|-p ab] [-u|-U num|-c|-C num] [-f] [--no-timestamps] [--no-index] [--diffstat] [--sort] [--backup] [--strip-trailing-whitespace] [patch]\n"
+ printf $"Usage: quilt refresh [-p n|-p ab] [-u|-U num|-c|-C num] [-z[new_name]] [-f] [--no-timestamps] [--no-index] [--diffstat] [--sort] [--backup] [--strip-trailing-whitespace] [patch]\n"
if [ x$1 = x-h ]
then
@@ -47,6 +47,11 @@ patch.
a context diff (-c, -C) with num lines of context. The number of
context lines defaults to 3.
+-z[new_name]
+ Create a new patch containing the changes instead of refreshing the
+ topmost patch. If no new name is specified, \`-2' is added to the
+ original patch name, etc. (See the fork command.)
+
--no-timestamps
Do not include file timestamps in patch headers.
@@ -77,14 +82,14 @@ die()
{
local status=$1
[ -n "$tmp_patch" ] && rm -f $tmp_patch
- [ -n "$tmp_header" ] && rm -f $tmp_header
[ -n "$tmp_result" ] && rm -f $tmp_result
+ [ -n "$workdir" ] && rm -rf $workdir
exit $status
}
-options=`getopt -o p:uU:cC:fh --long no-timestamps,diffstat,backup,sort \
- --long no-index \
- --long strip-trailing-whitespace -- "$@"`
+options=`getopt -o p:uU:cC:fz::h --long no-timestamps,diffstat,backup,sort \
+ --long no-index \
+ --long strip-trailing-whitespace -- "$@"`
if [ $? -ne 0 ]
then
@@ -109,6 +114,10 @@ do
-U|-C)
opt_format="$1 $2"
shift 2 ;;
+ -z)
+ opt_fork=1
+ opt_new_name=$2
+ shift 2 ;;
-h)
usage -h ;;
--no-timestamps)
@@ -144,6 +153,34 @@ QUILT_DIFF_OPTS="$QUILT_DIFF_OPTS $opt_f
patch=$(find_applied_patch "$1") || exit 1
+if [ -z "$opt_sort" ]
+then
+ files=( $(files_in_patch_ordered $patch) )
+else
+ files=( $(files_in_patch $patch | sort) )
+fi
+
+if [ -n "$opt_fork" -a $# -ne 0 ]
+then
+ printf $"Can only refresh the topmost patch with -z currently\n" >&2
+ exit 1
+fi
+
+if [ -n "$opt_fork" ]; then
+ old_patch=$patch
+ old_patch_args=$(patch_args "$old_patch")
+ if [ -n "$opt_new_name" ]
+ then
+ patch=$opt_new_name
+ else
+ patch=$(next_filename "$patch")
+ fi
+ if [ -e "$(patch_file_name "$patch")" ]; then
+ printf $"Patch %s exists already\n" "$(print_patch $patch)" >&2
+ exit 1
+ fi
+fi
+
if [ -z "$opt_strip_level" ]
then
opt_strip_level=$(patch_strip_level $patch)
@@ -163,27 +200,30 @@ esac
trap "die 1" SIGTERM
-tmp_patch=$(gen_tempfile)
-
-if [ -z "$opt_sort" ]
-then
- files=( $(files_in_patch_ordered $patch) )
-else
- files=( $(files_in_patch $patch | sort) )
+if [ -n "$opt_fork" ]; then
+ workdir=$(gen_tempfile -d $PWD/quilt)
+ apply_patch_temporarily "$workdir" "$old_patch" || exit 1
fi
+tmp_patch=$(gen_tempfile)
+
for file in "${files[@]}"
do
- old_file=$(backup_file_name $patch $file)
- next_patch=$(next_patch_for_file $patch $file)
- if [ -z "$next_patch" ]
- then
+ if [ -n "$opt_fork" ]; then
+ old_file=$workdir/$file
new_file=$file
else
- new_file=$(backup_file_name $next_patch $file)
- files_were_shadowed=1
+ old_file=$(backup_file_name $patch $file)
+ next_patch=$(next_patch_for_file $patch $file)
+ if [ -z "$next_patch" ]
+ then
+ new_file=$file
+ else
+ new_file=$(backup_file_name $next_patch $file)
+ files_were_shadowed=1
+ fi
fi
- if ! diff_file $file $old_file $new_file >> $tmp_patch
+ if ! diff_file $file $old_file $new_file
then
printf $"Diff failed, aborting\n" >&2
die 1
@@ -199,7 +239,7 @@ do
then
printf $"Cannot use --strip-trailing-whitespace on a patch that has shadowed files.\n" >&2
fi
-done
+done >> $tmp_patch
if ! [ -s $tmp_patch ]
then
@@ -227,25 +267,17 @@ patch_file=$(patch_file_name $patch)
trap "" SIGINT
-if ! tmp_header=$(gen_tempfile)
-then
- die 1
-fi
-
-mkdir -p $(dirname $patch_file)
-
-if ! cat_file $patch_file | patch_header > $tmp_header
-then
- die 1
-fi
-
tmp_result=$(gen_tempfile) || die 1
+prev_patch_file=$patch_file
+[ -e "$prev_patch_file" ] || prev_patch_file=/dev/null
+
if [ -n "$opt_diffstat" ]
then
diffstat="$(diffstat $QUILT_DIFFSTAT_OPTS \
-p$num_strip_level $tmp_patch)" || die 1
- awk '
+ cat_file "$prev_patch_file" | patch_header \
+ | awk '
function print_diffstat(arr, i) {
split(diffstat, arr, "\n")
for (i=1; i in arr; i++)
@@ -271,13 +303,16 @@ then
}
}
' diffstat="$diffstat" \
- $tmp_header > $tmp_result
+ > $tmp_result
else
- cat $tmp_header > $tmp_result
+ cat_file "$prev_patch_file" | patch_header \
+ > $tmp_result
fi
cat $tmp_patch >> $tmp_result
+mkdir -p $(dirname $patch_file)
+
if [ -e $patch_file ] && \
diff -q $patch_file $tmp_result > /dev/null
then
@@ -286,8 +321,30 @@ elif ( [ -z "$QUILT_BACKUP" -o ! -e $pat
mv $patch_file $patch_file~ ) && \
cat_to_new_file $patch_file < $tmp_result
then
+ if [ -n "$opt_fork" ]
+ then
+ if ! insert_in_series "$patch" "$old_patch_args"
+ then
+ printf $"Failed to insert patch %s into file series\n" \
+ "$(print_patch $patch)" >&2
+ rm -f "$patch_file"
+ exit 1
+ fi
+ if ! rm -rf "$QUILT_PC/$patch" || \
+ ! mv "$workdir" "$QUILT_PC/$patch" || \
+ ! echo "$patch" >> $QUILT_PC/applied-patches
+ then
+ printf $"Failed to create patch %s\n" \
+ "$(print_patch $patch)" >&2
+ exit 1
+ fi
+ printf $"Fork of patch %s created as %s\n" \
+ "$(print_patch $old_patch)" \
+ "$(print_patch $patch)"
+ else
+ printf $"Refreshed patch %s\n" "$(print_patch $patch)"
+ fi
touch $QUILT_PC/$patch/.timestamp
- printf $"Refreshed patch %s\n" "$(print_patch $patch)"
else
die 1
fi
Index: quilt-0.46/quilt/scripts/patchfns.in
===================================================================
--- quilt-0.46.orig/quilt/scripts/patchfns.in
+++ quilt-0.46/quilt/scripts/patchfns.in
@@ -838,6 +838,65 @@ first_modified_by()
return 1
}
+apply_patch_temporarily()
+{
+ local workdir=$1 patch=$2 patch_file patch_args files
+
+ patch_file=$(patch_file_name "$patch")
+ patch_args=$(patch_args "$patch")
+
+ shift 2
+ if [ $# -gt 0 ]
+ then
+ files=( "$@" )
+ else
+ files=( $(files_in_patch "$patch") )
+ fi
+
+ if [ ${#files[@]} -gt 0 ] \
+ && ! ( cd $QUILT_PC/$patch &&
+ cp -l --parents "${files[@]}" $workdir/ )
+ then
+ printf $"Failed to copy files to temporary directory\n" >&2
+ return 1
+ fi
+ # Now we may have some zero-size files that have no permissions
+ # (which represent files that the patch creates). Those may have
+ # been created in the meantime, but patch would refuse to touch
+ # them: We must remove them here.
+ find $workdir -type f -size 0 -exec rm -f '{}' ';'
+
+ if [ -s $patch_file ]
+ then
+ if ! cat_file $patch_file \
+ | patch -d $workdir $QUILT_PATCH_OPTS $patch_args \
+ --no-backup-if-mismatch -Ef \
+ >/dev/null 2>/dev/null
+ then
+ # Generating a relative diff for a subset of files in
+ # the patch will fail. Also, if a patch was force
+ # applied, we know that it won't apply cleanly. In
+ # all other cases, print a warning.
+
+ if [ ! -e $QUILT_PC/$patch~refresh -a $# -eq 0 ]
+ then
+ printf $"Failed to patch temporary files\n" >&2
+ return 1
+ fi
+ fi
+ fi
+}
+
+next_filename()
+{
+ local patch=$1 base num
+ base=$(echo "$patch" \
+ | sed -r -e 's:(\.gz|\.bz2)$::' -e 's:(\.diff?|\.patch)$::')
+ num=$(echo "$base" | sed -nre 's:.*-([0-9]+)$:\1:'p)
+ [ -n "$num" ] || num=1
+ echo "${base%-$num}-$((num+1))${patch#$base}"
+}
+
create_db() {
if ! [ -e $QUILT_PC ]
then
Index: quilt-0.46/test/refresh-z.test
===================================================================
--- /dev/null
+++ quilt-0.46/test/refresh-z.test
@@ -0,0 +1,29 @@
+ $ rm -rf d
+ $ mkdir -p d/patches
+ $ cd d
+
+ $ quilt new test.diff
+ > Patch patches/test.diff is now on top
+
+ $ quilt add foo
+ > File foo added to patch patches/test.diff
+
+ $ echo foo > foo
+ $ quilt refresh
+ > Refreshed patch patches/test.diff
+
+ $ echo bar >> foo
+ $ quilt refresh -z
+ > Fork of patch patches/test.diff created as patches/test-2.diff
+
+ $ echo baz >> foo
+ $ quilt refresh -zbaz.diff
+ > Fork of patch patches/test-2.diff created as patches/baz.diff
+
+ $ quilt series
+ > patches/test.diff
+ > patches/test-2.diff
+ > patches/baz.diff
+
+ $ cd ..
+ $ rm -rf d

6
suse-start-quilt-mode.el Normal file
View File

@ -0,0 +1,6 @@
;; /usr/share/emacs/site-lisp/suse-start-quilt-mode.el
(autoload 'quilt-mode "quilt"
"Toggle quilt-mode. With positive arg, enable quilt-mode." t)
;; /usr/share/emacs/site-lisp/suse-start-quilt-mode.el ends here