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.0 +1000
+++ dpatch-cowdancer-patch 2007-06-16 01:36:49.0 +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 21; 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
21; 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