Package: quilt Version: 0.44-4 Severity: wishlist Tags: patch Hi Martin,
Since quilt is now quite deeply embedded as a build-dependency in Debian, used both for glibc and for etch, bootstrapping a new port is a lot more painful due to quilt's own rich build-deps. So since there was only one architecture-dependent file in the whole package, and it came from a single 600-line C file, I thought I'd take a look at making quilt arch: all instead of arch: any. The result is the attached patch, replacing lib/backup-files.c with a Very Small Shell Script. (Ok, it's 230 lines... not small, but still smaller than the C version.) No new dependencies are introduced, as it makes use only of features of essential packages. It does use bash as a shell, rather than just /bin/sh, because it makes use of non-POSIX array variables. If you would consider applying this patch (and/or submitting it upstream), I'm sure future generations of porters would appreciate it. :) -- Steve Langasek Give me a lever long enough and a Free OS Debian Developer to set it on, and I can move the world. [EMAIL PROTECTED] http://www.debian.org/
diff -u quilt-0.44/Makefile.in quilt-0.44/Makefile.in
--- quilt-0.44/Makefile.in
+++ quilt-0.44/Makefile.in
@@ -81,7 +81,7 @@
DIRT += $(QUILT_IN:%=quilt/%)
SCRIPTS_IN := patchfns parse-patch inspect dependency-graph edmail \
- remove-trailing-ws
+ remove-trailing-ws backup-files
SCRIPTS_SRC := $(SCRIPTS_IN:%=%.in)
SCRIPTS := $(SCRIPTS_IN)
@@ -92,10 +92,6 @@
DIRT += $(patsubst %.in,%,$(wildcard compat/*.in))
COMPAT := $(COMPAT_PROGRAMS:%=compat/%) $(COMPAT_SYMLINKS:%=compat/%)
-LIB_SRC := backup-files.c
-LIB := backup-files$(EXEEXT)
-SRC += $(LIB_SRC:%=lib/%)
-DIRT += lib/backup-files$(EXEEXT) $(LIB_SRC:%.c=lib/%.o)
DOC_IN := README
DOC_SRC := $(DOC_IN:%=doc/%.in)
@@ -126,7 +122,7 @@
# Settings for running the uninstalled version of quilt in the source tree:
PATH := $(CURDIR)/bin:$(CURDIR)/compat:$(PATH)
QUILT_DIR := $(CURDIR)/quilt
-QUILT_LIB := $(CURDIR)/lib
+QUILT_LIB := $(CURDIR)/quilt/scripts
QUILTRC := $(CURDIR)/test/test.quiltrc
export QUILT_DIR QUILT_LIB QUILTRC
@@ -149,7 +145,7 @@
$(MSGMERGE) -o $@ $@ $^
scripts : $(BIN:%=bin/%) $(QUILT:%=quilt/%) \
- $(SCRIPTS:%=quilt/scripts/%) $(LIB:%=lib/%) \
+ $(SCRIPTS:%=quilt/scripts/%) \
$(if $(PATCH_WRAPPER),bin/patch-wrapper)
dist : clean $(PACKAGE)-$(VERSION).tar.gz
@@ -249,7 +245,7 @@
$(patsubst %.in,%,$(wildcard bin/*.in quilt/*.in quilt/scripts/*.in)) ::
Makefile
% :: %.in
@echo "$< -> $@" >&2
- @$(SED) -e 's:@QUILT_LIB''@:$(libdir)/$(PACKAGE):g' \
+ @$(SED) -e 's:@QUILT_LIB''@:$(datadir)/$(PACKAGE)/scripts:g' \
-e 's:@QUILT_DIR''@:$(datadir)/$(PACKAGE):g' \
-e 's:@PERL''@:$(PERL):g' \
-e 's:@BASH''@:$(BASH):g' \
@@ -261,8 +257,6 @@
$< > $@
@$(if $(filter-out $<,$(NON_EXEC_IN)),chmod +x $@)
-lib/backup-files.o :: Makefile
-
configure : configure.ac
autoconf
@echo "Please run ./configure"
@@ -318,9 +312,6 @@
$(BUILD_ROOT)$(datadir)/$(PACKAGE)/wrapper/patch
endif
- $(INSTALL) -d $(BUILD_ROOT)$(libdir)/$(PACKAGE)
- $(INSTALL) -m 755 $(LIB:%=lib/%) $(BUILD_ROOT)$(libdir)/$(PACKAGE)/
-
$(INSTALL) -d $(BUILD_ROOT)$(docdir)/$(PACKAGE)-$(VERSION)/
$(INSTALL) -m 644 doc/README \
$(BUILD_ROOT)$(docdir)/$(PACKAGE)-$(VERSION)/
diff -u quilt-0.44/debian/changelog quilt-0.44/debian/changelog
--- quilt-0.44/debian/changelog
+++ quilt-0.44/debian/changelog
@@ -1,3 +1,11 @@
+quilt (0.44-4.1) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * Make backup-files a shell script instead of a binary, so we can make
+ quilt arch: all
+
+ -- Steve Langasek <[EMAIL PROTECTED]> Wed, 19 Apr 2006 17:53:06 -0700
+
quilt (0.44-4) unstable; urgency=low
* Build-depend on diffstat so that diffstat support gets compiled in
diff -u quilt-0.44/debian/control quilt-0.44/debian/control
--- quilt-0.44/debian/control
+++ quilt-0.44/debian/control
@@ -4,11 +4,11 @@
Section: devel
Priority: optional
Maintainer: Martin Quinson <[EMAIL PROTECTED]>
-Build-Depends: cdbs (>= 0.4.23-1.1), debhelper (>= 4.1.0), gettext, hevea,
lynx, gawk, diffstat
+Build-Depends-Indep: cdbs (>= 0.4.23-1.1), debhelper (>= 4.1.0), gettext,
hevea, lynx, gawk, diffstat
Standards-Version: 3.6.1.0
Package: quilt
-Architecture: any
+Architecture: all
Depends: patch, diffstat, bzip2, gettext, gawk, ${shlibs:Depends}
Description: Tool to work with series of patches
Quilt manages a series of patches by keeping track of the changes
diff -u quilt-0.44/debian/rules quilt-0.44/debian/rules
--- quilt-0.44/debian/rules
+++ quilt-0.44/debian/rules
@@ -22,7 +22,7 @@
DEB_CONFIGURE_EXTRA_FLAGS := --with-awk=/usr/bin/gawk
--with-mta=/usr/sbin/sendmail
# distribute a text version of the doc for fool souls
-common-build-arch::
+common-build-indep::
mkdir doc/tmp || true
cd doc/tmp; LC_ALL=C hevea ../main.tex ; LC_ALL=C hevea ../main.tex;
LC_ALL=C hevea ../main.tex
cp doc/tmp/main.html doc/quilt.html
only in patch2:
unchanged:
--- quilt-0.44.orig/quilt/scripts/backup-files.in
+++ quilt-0.44/quilt/scripts/backup-files.in
@@ -0,0 +1,230 @@
+#! @BASH@
+
+set -e
+
+# File: backup-files.sh
+
+# Copyright (C) 2006 Steve Langasek <[EMAIL PROTECTED]>
+# portions Copyright (C) 2003, 2004, 2005, 2006 Andreas Gruenbacher
+# <[EMAIL PROTECTED]>, SuSE Labs
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 dated June, 1991.
+
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+
+# Create backup files of a list of files similar to GNU patch. A path
+# name prefix and suffix for the backup file can be specified with the
+# -B and -z options.
+
+usage () {
+ progname="$1"
+ echo -e "Usage: $progname [-B prefix] [-z suffix] [-f {file|-}] [-s]
[-b|-r|-x] [-t] [-L] {file|-} ...\n"\
+ "\n"\
+ "\tCreate hard linked backup copies of a list of files\n"\
+ "\tread from standard input.\n"\
+ "\n"\
+ "\t-b\tCreate backup\n"\
+ "\t-r\tRestore the backup\n"\
+ "\t-x\tRemove backup files and empty parent directories\n"\
+ "\t-B\tPath name prefix for backup files\n"\
+ "\t-z\tPath name suffix for backup files\n"\
+ "\t-s\tSilent operation; only print error messages\n"\
+ "\t-f\tRead the filenames to process from file (- = standard input)\n"\
+ "\t-t\tTouch original files after restore (update their mtimes)\n\n"\
+ "\t-L\tEnsure that when finished, the source file has a link count of
1\n\n"
+}
+
+link_or_copy_file() {
+ from="$1"
+ to="$2"
+ ln -T "$from" "$to" || cp -dp --remove-destination "$from" "$to"
+}
+
+ensure_nolinks() {
+ filename="$1"
+
+ link_count=$(stat -c '%h' "$filename")
+ if [ -z "$link_count" ] || [ "$link_count" -gt 1 ]; then
+ dirname=$(dirname "$filename")
+ basename=$(basename "$filename")
+ # Temp file name is "path/to/.file.XXXXXX"
+ tmpname=$(mktemp "${dirname}/.${basename}.XXXXXX")
+ cp -dp "$filename" "$tmpname"
+ mv "$tmpname" "$filename"
+ fi
+}
+
+process_file() {
+ file="$1"
+ backup="${OPT_PREFIX}${file}${OPT_SUFFIX}"
+
+ if [ "$OPT_WHAT" == "backup" ]; then
+ if [ -e "$backup" ]; then
+ rm "$backup"
+ else
+ mkdir -p "$(dirname "$backup")"
+ fi
+ if [ ! -e "$file" ]; then
+ $ECHO "New file $file"
+ touch "$backup"
+ chmod 000 "$backup"
+ else
+ $ECHO "Copying $file"
+ link_or_copy_file "$file" "$backup"
+ if [ -n "$OPT_NOLINKS" ]; then
+ ensure_nolinks "$file"
+ fi
+ if [ -n "OPT_TOUCH" ]; then
+ touch "$backup"
+ fi
+ fi
+ elif [ "$OPT_WHAT" == "restore" ]; then
+ mkdir -p "$(dirname "$file")"
+
+ if [ ! -e "$backup" ]; then
+ return 1
+ fi
+ if [ ! -s "$backup" ]; then
+ if [ -e "$file" ]; then
+ rm "$file"
+ fi
+ $ECHO "Removing $file"
+ rm "$backup"
+ rmdir --ignore-fail-on-non-empty -p "$(dirname
"$backup")" 2> /dev/null
+ else
+ $ECHO "Restoring $file"
+ if [ -e "$file" ]; then
+ rm "$file"
+ fi
+ link_or_copy_file "$backup" "$file"
+ rm "$backup"
+ rmdir --ignore-fail-on-non-empty -p "$(dirname
"$backup")" 2>/dev/null
+ if [ -n "$OPT_NOLINKS" ]; then
+ ensure_nolinks "$file"
+ fi
+ if [ -n "$OPT_TOUCH" ]; then
+ touch "$file"
+ fi
+ fi
+ elif [ "$OPT_WHAT" == "remove" ]; then
+ if [ -e "$backup" ]; then
+ rm "$backup"
+ fi
+ rmdir --ignore-fail-on-non-empty -p "$(dirname "$backup")"
2>/dev/null
+ elif [ "$OPT_WHAT" == "noop" ]; then
+ if [ -e "$file" ] && [ -n "$OPT_NOLINKS" ]; then
+ ensure_nolinks "$file"
+ fi
+ else
+ return 1
+ fi
+}
+
+walk() {
+ path="$1"
+ if [ ! -f "$path" ]; then
+ return 0
+ fi
+
+ if [ "${path#$OPT_PREFIX}" == "$path" ]
+ then
+ # prefix does not match
+ return 0
+ fi
+ path="${path#$OPT_PREFIX}"
+
+ if [ -n "$OPT_SUFFIX" ] && [ "${path%$OPT_SUFFIX}" == "$path" ]
+ then
+ # suffix does not match
+ return 0
+ fi
+ path="${path%$OPT_SUFFIX}"
+
+ process_file "$path"
+}
+
+
+ECHO=echo
+declare -a FILELIST
+progname="$0"
+while [ $# -gt 0 ]; do
+ case $1 in
+ -b) OPT_WHAT=backup
+ ;;
+ -r) OPT_WHAT=restore
+ ;;
+ -x) OPT_WHAT=remove
+ ;;
+ -B) OPT_PREFIX=$2
+ shift
+ ;;
+ -f) OPT_FILE=$2
+ shift
+ ;;
+ -z) OPT_SUFFIX=$2
+ shift
+ ;;
+ -s) ECHO=:
+ ;;
+ -L) OPT_NOLINKS=1
+ ;;
+ -t) OPT_TOUCH=1
+ ;;
+ -?*) usage "$progname"
+ exit 0
+ ;;
+ *) FILELIST=($1)
+ ;;
+ esac
+
+ shift
+done
+
+if [ -z "${OPT_PREFIX}${OPT_SUFFIX}" ]; then
+ usage "$progname"
+ exit 1
+fi
+if [ [EMAIL PROTECTED] == 0 ] && [ -z "$OPT_FILE" ]; then
+ usage "$progname"
+ exit 1
+fi
+
+if [ -n "$OPT_FILE" ]; then
+ cat "$OPT_FILE" \
+ | while read nextfile; do
+ process_file "$nextfile"
+ done
+fi
+
+I=0
+while [ $I -lt [EMAIL PROTECTED] ]; do
+
+ case "${FILELIST[$I]}" in
+ -)
+ path="${OPT_PREFIX%/*}"
+ [ -n "$path" ] && [ -d "$path" ] || continue
+
+ find "$path" -mindepth 1 -type f -print \
+ | while read
+ do
+ walk "$REPLY"
+ done
+ ;;
+ *)
+ process_file "${FILELIST[$I]}"
+ ;;
+ esac
+
+ I=$(($I+1))
+done
signature.asc
Description: Digital signature

