Package: dpatch Version: 2.0.25 Severity: wishlist Tags: patch Here's my current patch to turn dpatch-edit-patch into dpatch-cowdancer-patch.
I've not tested it hard, but I have tested it both with and
without -c, and it's wildly faster than tar for the secondlife
client, which is 32MB cleaned, and something like 250MB uncleaned.
I'm not sure if you want to make this a seperate command, or
just react to a cowshell option on the command line/configuration.
--- /usr/bin/dpatch-edit-patch 2007-05-27 03:59:09.000000000 +1000
+++ dpatch-cowdancer-patch 2007-06-16 01:36:49.000000000 +1000
@@ -35,7 +35,7 @@
DPEP_KEEPTEMP="${DPEP_KEEPTEMP:-${conf_keeptemp:-0}}"
DPEP_TMPDIR="${DPEP_TMPDIR:-${conf_tmpdir:-${TMPDIR:-/tmp}}}"
DPEP_SHELL="${DPEP_SHELL:-${conf_shell:-${SHELL:-$(getent passwd $(id -un) |
cut -f7- -d:)}}}"
-DPEP_EXCLUDE="${DPEP_EXCLUDE:-${conf_exclude:-CVS .svn .git .arch .hg _darcs
.bzr}}"
+DPEP_EXCLUDE="${DPEP_EXCLUDE:-${conf_exclude:-CVS .svn .git .arch .hg _darcs
.bzr .ilist}}"
DPEP_ORIGTARGZPATH="${DPEP_ORIGTARGZPATH:-${conf_origtargzpath:-}}"
# We special-case $DPEP_ROOTCMD later, after dpep_parse_options()
@@ -72,6 +72,28 @@
fi
fi
+# We special-case $DPEP_COWCMD here; We _ought_ to be switching behaviour
+# instead. We do this after option parsing, to ensure that they can supply
+# a COWCMD on the CLI.
+if [[ -z "$DPEP_COWCMD" ]]; then
+ # We're only here if $DPEP_COWCMD hasn't already been set via either a CLI
+ # argument or the environment variable itself.
+ if [[ ! -z "$conf_rootcmd" ]]; then
+ # If we're here, the configuration variable has been set
+ DPEP_COWCMD="$conf_rootcmd"
+ elif command -v fakeroot > /dev/null 2>&1; then
+ # If we're here, nothing's been set, but fakeroot exists.
+ DPEP_COWCMD="cow-shell"
+ else
+ # We're here, nothing's set, fakeroot's not found. Bail.
+ dpep_message error " "
+ printf "cow-shell is not installed, nor has the option --cowcmd been
given, nor has the\n"
+ printf "environment variable \$DPEP_COWCMD been set, nor has the
configuration file\n"
+ printf "variable conf_cowcmd been set. Please see the manual page for
more details.\n"
+ exit 1
+ fi
+fi
+
# All argument and option parsing has been done. Time to accomplish something.
# Change to source directory
cd "$DPEP_SOURCEDIR"
@@ -208,10 +230,15 @@
fi
fi
cd "$REFPDIR"
- dpep_message norm "* Copying $DPEP_SOURCEDIR to reference directory."
- mkdir -p "$(basename "$DPEP_SOURCEDIR")"
- tar --create --file - --dereference $DPEP_TAR_EXCLUDE --directory
"$DPEP_SOURCEDIR" . | \
- tar --extract --file - --directory "$(basename "$DPEP_SOURCEDIR")"
+ dpep_message norm "* Hardlinking $DPEP_SOURCEDIR to reference directory."
+# mkdir -p "$(basename "$DPEP_SOURCEDIR")"
+# tar --create --file - --dereference $DPEP_TAR_EXCLUDE --directory
"$DPEP_SOURCEDIR" . | \
+# tar --extract --file - --directory "$(basename "$DPEP_SOURCEDIR")"
+ cp --archive --link "$DPEP_SOURCEDIR" $(basename "$DPEP_SOURCEDIR")
+ if [ -n "$DPEP_CLEAN" ]; then
+ # Remove the files from the working directory that we don't want to be
part of the diff
+ for igfile in "$DPEP_EXCLUDE"; do find $(basename "$DPEP_SOURCEDIR")
-name "$igfile" -print0; done | xargs -0 -r rm -r
+ fi
REFDIR="$REFPDIR/$(basename $DPEP_SOURCEDIR)"
fi
cd "$REFDIR"
@@ -219,8 +246,9 @@
# $PWD: reference directory
# Copy, clean, and clone $DPEP_SOURCEDIR
dpep_message norm "* Cleaning $REFDIR"
-$DPEP_ROOTCMD debian/rules clean unpatch
-dpatch deapply-all
+export COWDANCER_REUSE=yes
+$DPEP_COWCMD $DPEP_ROOTCMD debian/rules clean unpatch
+$DPEP_COWCMD dpatch deapply-all
if [[ ! -z "$DPEP_BASEPATCH" ]]; then
if ! dpatch list-all | grep -F "${DPEP_BASEPATCH%%.dpatch}" > /dev/null
2>&1; then
@@ -239,22 +267,28 @@
# 00list. That's a bug, we'll hack around it by explicitly
# checking for it, and if we find it, we'll do nothing here
if [ ! "$DPEP_apply_until" = "${DPEP_PATCH%%.dpatch}" ]; then
- dpatch apply-until "$DPEP_apply_until"
+ $DPEP_COWCMD dpatch apply-until "$DPEP_apply_until"
fi
else
- dpatch apply-until "${DPEP_BASEPATCH%%.dpatch}"
+ $DPEP_COWCMD dpatch apply-until "${DPEP_BASEPATCH%%.dpatch}"
fi
fi
else
dpep_message warn "* No base-patch supplied, not applying any patches."
fi
-dpep_message norm "* Copying reference directory $REFDIR to work directory."
+export COWDANCER_REUSE=no
+dpep_message norm "* Hard linking directory $REFDIR to work directory."
cd "$WORKDIR"
-mkdir "$(basename "$DPEP_SOURCEDIR")"
-tar --create --file - --dereference $DPEP_TAR_EXCLUDE --directory "$REFDIR" .
| \
- tar --extract --file - --directory "$(basename "$DPEP_SOURCEDIR")"
+#mkdir "$(basename "$DPEP_SOURCEDIR")"
+#tar --create --file - --dereference $DPEP_TAR_EXCLUDE --directory "$REFDIR" .
| \
+# tar --extract --file - --directory "$(basename "$DPEP_SOURCEDIR")"
# this was previously cp --dereference --archive "$REFDIR" $(basename
"$DPEP_SOURCEDIR")
+cp --archive --link "$REFDIR" $(basename "$DPEP_SOURCEDIR")
+if [ -n "$DPEP_CLEAN" ]; then
+ # Remove the files from the working directory that we don't want to be
part of the diff
+ for igfile in "$DPEP_EXCLUDE"; do find $(basename "$DPEP_SOURCEDIR")
-name "$igfile" -print0; done | xargs -0 -r rm -r
+fi
# Change to the workdirectory, apply the patch we're editing if we're
# editing one, and launch an interactive shell.
@@ -277,7 +311,7 @@
code of "230". This is typically done by exiting the shell with the command
'exit 230'.
EOF
-$DPEP_SHELL && EXITVAL=0 || EXITVAL="$?"
+$DPEP_COWCMD $DPEP_SHELL && EXITVAL=0 || EXITVAL="$?"
if [[ "$EXITVAL" = "230" ]]; then
dpep_message error "Shell exited with an exit value of 230, aborting."
dpep_cleanup
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.18-4-686 (SMP w/1 CPU core)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
dpatch depends on no packages.
Versions of packages dpatch recommends:
ii dpkg-dev 1.14.4 package building tools for Debian
ii fakeroot 1.7.1 Gives a fake root environment
ii patchutils 0.2.31-4 Utilities to work with patches
-- no debconf information
--
Paul "TBBle" Hampson, [EMAIL PROTECTED]
Shorter .sig for a more eco-friendly paperless office.
pgpgNKaxyt08F.pgp
Description: PGP signature

