Package: dpatch Version: 2.0.14 Severity: wishlist Tags: patch So, dpatch-edit-patch produces horrid-looking diff headers:
diff -urNad --exclude=CVS --exclude=.svn ./src/foo.h /tmp/dpep-work.XujkX1/foo-1.0/src/foo.h --- ./src/foo.h 1996-03-16 10:58:58.000000000 -0600 +++ /tmp/dpep-work.XujkX1/foo-1.0/src/foo.h 2005-08-04 13:39:08.000000000 -0500 These look bad, but also, the /tmp/dpep-work.XujkX1 changes every time dpatch-edit-patch runs. So diffing two versions of a patch produces lots of noise, for *every* file touched by the patch - even the files I did not modify this time. That noise also ends up in the cvs/svn commit. Compare: diff -urNad foo-1.0~/src/foo.h foo-1.0/src/foo.h --- foo-1.0~/src/foo.h 2005-08-04 10:58:58.000000000 -0600 +++ foo-1.0/src/foo.h 2005-08-04 13:39:08.000000000 -0500 I've attached 2 patches - the first is minimal, the second also includes a trivial cleanup I found hard to resist. Peter
--- dpatch-edit-patch~ 2005-07-19 10:46:36.000000000 -0500 +++ dpatch-edit-patch 2005-08-04 15:36:40.000000000 -0500 @@ -285,7 +285,10 @@ DIFFHOLDER="$(tempfile -d "$WORKDIR" -p "dpep." -s ".diff")" dpep_message debug1 "Diff temporary file is $DIFFHOLDER" cd "$REFDIR" -diff -urNad $DPEP_DIFF_EXCLUDE . "$WORKDIR/$(basename "$DPEP_SOURCEDIR")" > "$DIFFHOLDER" || true +diff -urNad $DPEP_DIFF_EXCLUDE . "$WORKDIR/$(basename "$DPEP_SOURCEDIR")" | + sed -e "/^--- \|^diff /s: \./: $(basename "$DPEP_SOURCEDIR")~/:" \ + -e "/^+++ \|^diff /s: $WORKDIR/: :" \ + -e "/^diff /s: $DPEP_DIFF_EXCLUDE::" > "$DIFFHOLDER" || true # Diff created, let's switch back to the original directory, and start the # process of updating or creating the patch.
--- dpatch-edit-patch~ 2005-07-19 10:46:36.000000000 -0500 +++ dpatch-edit-patch 2005-08-04 15:46:27.000000000 -0500 @@ -154,8 +154,9 @@ # $PWD: $DPEP_SOURCEDIR # Hopefully mktemp(1), part of debianutils, does the Right Thing :) We're # pretty sure it does :) +BASENAME="$(basename "$DPEP_SOURCEDIR")" WORKDIR="$(TMPDIR=$DPEP_TMPDIR mktemp -d -p /tmp dpep-work.XXXXXX)" -dpep_message debug1 "Working directory is $WORKDIR" +dpep_message debug1 "Working directory is $WORKDIR/$BASENAME" if [ -n "$DPEP_CLEAN" ]; then REFDIR="$DPEP_SOURCEDIR" @@ -191,20 +192,20 @@ tar --extract --gzip --file $ORIGTARGZ # this heuristic is stolen from dpkg-source if [ "$(find . -maxdepth 1 -mindepth 1 -type d -print | wc -l)" -eq 1 ]; then - if [ "$(readlink -f "$(find . -maxdepth 1 -mindepth 1 -type d -print)")" != "$(readlink -f "$(basename "$DPEP_SOURCEDIR")")" ]; then - mv "$(find . -maxdepth 1 -mindepth 1 -type d -print)" "$(basename "$DPEP_SOURCEDIR")" + if [ "$(readlink -f "$(find . -maxdepth 1 -mindepth 1 -type d -print)")" != "$(readlink -f "$BASENAME")" ]; then + mv "$(find . -maxdepth 1 -mindepth 1 -type d -print)" "$BASENAME" fi else - mkdir "$(basename "$DPEP_SOURCEDIR")" - find . -maxdepth 1 -mindepth 1 -type d -name "$(basename "$DPEP_SOURCEDIR")" -prune -o -print0 | \ - xargs --null mv --target-directory="$(basename "$DPEP_SOURCEDIR")" + mkdir "$BASENAME" + find . -maxdepth 1 -mindepth 1 -type d -name "$BASENAME" -prune -o -print0 | + xargs --null mv --target-directory="$BASENAME" fi fi cd "$REFPDIR" dpep_message norm "* Copying $DPEP_SOURCEDIR to reference directory." - mkdir -p "$(basename "$DPEP_SOURCEDIR")" + mkdir -p "$BASENAME" tar --create --file - --dereference $DPEP_TAR_EXCLUDE --directory "$DPEP_SOURCEDIR" . | \ - tar --extract --file - --directory "$(basename "$DPEP_SOURCEDIR")" + tar --extract --file - --directory "$BASENAME" REFDIR="$REFPDIR/$(basename $DPEP_SOURCEDIR)" fi cd "$REFDIR" @@ -244,14 +245,14 @@ dpep_message norm "* Copying reference directory $REFDIR to work directory." cd "$WORKDIR" -mkdir "$(basename "$DPEP_SOURCEDIR")" +mkdir "$BASENAME" 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") + tar --extract --file - --directory "$BASENAME" +# this was previously cp --dereference --archive "$REFDIR" "$BASENAME" # Change to the workdirectory, apply the patch we're editing if we're # editing one, and launch an interactive shell. -cd "$WORKDIR/$(basename "$DPEP_SOURCEDIR")" +cd "$WORKDIR/$BASENAME" if [[ "$DPEP_EDITPATCH" = "1" ]]; then dpep_message norm "* Applying current $DPEP_PATCH for editing." if ! dpatch apply --no-stamp "$DPEP_PATCH"; then @@ -285,7 +286,11 @@ DIFFHOLDER="$(tempfile -d "$WORKDIR" -p "dpep." -s ".diff")" dpep_message debug1 "Diff temporary file is $DIFFHOLDER" cd "$REFDIR" -diff -urNad $DPEP_DIFF_EXCLUDE . "$WORKDIR/$(basename "$DPEP_SOURCEDIR")" > "$DIFFHOLDER" || true + +diff -urNad $DPEP_DIFF_EXCLUDE . "$WORKDIR/$BASENAME" | + sed -e "/^--- \|^diff /s: \./: $BASENAME~/:" \ + -e "/^+++ \|^diff /s: $WORKDIR/: :" \ + -e "/^diff /s: $DPEP_DIFF_EXCLUDE::" > "$DIFFHOLDER" || true # Diff created, let's switch back to the original directory, and start the # process of updating or creating the patch.
signature.asc
Description: Digital signature