> > After constructing a regression testsuite to test the problem, > > I'm more inclined to go into a '1' option with a check. > > > > If dpatch-edit-patch is invoked with a patch name that is > > already found in debian/patched/ dir, > > abort if --clean is not specified. > > This has been pending for a while; > I'm now inclined to make --clean the default. > > Not cleaning is volatile and requires new information to dpatch-edit-patch.
Anyway, here is the patch and I'm committing this change. I've decided to add a --stampdir option to dpep, and detect that a patch is already applied, and give an error message advising to use '--clean' option in that case. [OK] 02_create_patch.sh [OK] 03_edit_patch.sh [OK] 04_add_new_patch.sh +[OK] 05_edit_with_patched.sh [OK] 06_dpatch_edit_patch_description.sh [OK] 07_dpatch_edit_patch_description_preserve.sh * looking for [EMAIL PROTECTED]/dpatch--mainline--2.0--patch-122 to compare with * comparing to [EMAIL PROTECTED]/dpatch--mainline--2.0--patch-122 M dpep/dpatch-edit-patch.functions M dpep/dpatch-edit-patch.1 M dpep/dpatch-edit-patch M debian/changelog M tests/05_edit_with_patched.sh M tests/run-test.sh M tests/test.log M tests/test.log.summary * modified files --- orig/debian/changelog +++ mod/debian/changelog @@ -7,10 +7,17 @@ reversed. (mh) * add testsuite in tests/ directory. (dancerj) * dpatch-edit-patch.functions (dpep_template_hardcoded): change to - accept patch description lines. + accept patch description lines. (dancerj) - -d option works now with hardcoded default, when 00template does not exist. + * dpatch-edit-patch.1, dpatch-edit-patch: new option --stampdir to specify + debian/patched directory. (dancerj) + * Bug fix: "running dpatch-edit-patch in a patched source tree leads to + errors during clean target" (Closes: #314494). (dancerj) + - dpep: Check for debian/patched/patch.dpatch, and require --clean option to be + specified in that case. + - tests/05_edit_with_patched now passes. - -- Junichi Uekawa <[EMAIL PROTECTED]> Tue, 28 Jun 2005 08:43:08 +0900 + -- Junichi Uekawa <[EMAIL PROTECTED]> Mon, 4 Jul 2005 08:29:42 +0900 dpatch (2.0.13) unstable; urgency=low --- orig/dpep/dpatch-edit-patch +++ mod/dpep/dpatch-edit-patch @@ -20,12 +20,14 @@ unset conf_keeptemp unset conf_tmpdir unset conf_shell +unset conf_stampdir # Read in the user's configuration file, should it exist. [[ -f ~/.dpatch.conf ]] && . ~/.dpatch.conf DPEP_SOURCEDIR="${DPEP_SOURCEDIR:-${conf_sourcedir:-$(pwd)}}" DPEP_OUTDIR="${DPEP_OUTDIR:-${conf_outdir:-$DPEP_SOURCEDIR/debian/patches}}" +DPEP_STAMPDIR="${DPEP_STAMPDIR:-${conf_stampdir:-$DPEP_SOURCEDIR/debian/patched}}" DPEP_CLEAN="${DPEP_CLEAN:-${conf_clean:-}}" DPEP_ORIGTARGZ="${DPEP_ORIGTARGZ:-${conf_origtargz:-}}" DPEP_GETORIGTARGZ="${DPEP_GETORIGTARGZ:-${conf_getorigtargz:-dpatch-get-origtargz}}" @@ -158,6 +160,10 @@ REFDIR="$DPEP_SOURCEDIR" dpep_message debug1 "Using source directory $DPEP_SOURCEDIR as reference directory" else + if [ -f "$DPEP_STAMPDIR/$DPEP_PATCH" ]; then + dpep_message error "Patch $DPEP_PATCH is applied on working directory, use --clean option" + exit 1 + fi REFPDIR="$(TMPDIR=$DPEP_TMPDIR mktemp -d -p /tmp dpep-ref.XXXXXX)" dpep_message debug1 "Reference directory is $REFPDIR" if [ -n "$DPEP_DEBIANONLY" ]; then --- orig/dpep/dpatch-edit-patch.1 +++ mod/dpep/dpatch-edit-patch.1 @@ -1,5 +1,5 @@ .\" Hey, EMACS: -*- nroff -*- -.TH DPATCH-EDIT-PATCH 1 "Jan 25 2005" DPATCH "dpatch users manual" +.TH DPATCH-EDIT-PATCH 1 "Jul 4 2005" DPATCH "dpatch users manual" .SH NAME dpatch\-edit\-patch \- maintain dpatch patches for a Debian source package @@ -167,6 +167,18 @@ will fall back to .IR /tmp . .TP +.IB "\-p, \-\-stampdir="value +The directory +.B dpatch +has used for creating patch stamps. +Used for checking if patch to be edited is already applied +to the working tree. +Configuration variable \fBconf_stampdir\fR (\fI~/.dpatch.conf\fR), environment variable +\fBDPEP_STAMPDIR\fR. Should none of the above be set, +.B dpatch\-edit\-patch +will fall back to +.B debian/patched +.TP .IB "\-e, \-\-exclude="valuelist Space-separated list of file- and directory names that .B dpatch\-edit\-patch --- orig/dpep/dpatch-edit-patch.functions +++ mod/dpep/dpatch-edit-patch.functions @@ -30,6 +30,8 @@ \$(pwd)/debian/patches/ -s|--sourcedir=dir Source directory, defaults to \$(pwd) -t|--tmpdir=dir Temporary directory, defaults to \$TMPDIR or /tmp/ + -p|--stampdir=dir Stamp directory, defaults to + \$(pwd)/debian/patched/ -e|--exclude List of files and directories to be excluded -b|--debianonly[=path] Unpack .orig.tar.gz before invoking the shell -k|--keeptemp Keep working source tree after exit. @@ -111,6 +113,7 @@ case "$1" in -s|--sourcedir) DPEP_SOURCEDIR="$2"; shift 2;; -t|--tmpdir) DPEP_TMPDIR="$2"; shift 2;; + -p|--stampdir) DPEP_STAMPDIR="$2"; shift 2;; -e|--exclude) DPEP_EXCLUDE="$2"; shift 2;; -b|--debianonly) DPEP_DEBIANONLY=1; DPEP_ORIGTARGZ="$2"; shift 2;; -k|--keeptemp) DPEP_KEEPTEMP=1; shift;; --- orig/tests/05_edit_with_patched.sh +++ mod/tests/05_edit_with_patched.sh @@ -7,12 +7,23 @@ #make sure it's patched debian/rules patch -echo 'echo this-is-a-more-modified-line > one1 ' | dpatch-edit-patch 01_edpatch + +# make sure without --clean option, it fails. +if echo 'echo this-is-a-more-modified-line > one1 ' | dpatch-edit-patch 01_edpatch; then + echo Unexpected success + exit 1 +else + : +fi + +# make sure --clean option works here. +echo 'echo this-is-a-more-modified-line2 > one1 ' | dpatch-edit-patch --clean 01_edpatch + debian/rules unpatch debian/rules patch echo '=== check file one1 contains the right content' -[ `cat one1` = this-is-a-more-modified-line ] +[ `cat one1` = this-is-a-more-modified-line2 ] debian/rules unpatch echo '=== check file one1 does not exist' --- orig/tests/run-test.sh +++ mod/tests/run-test.sh @@ -21,7 +21,7 @@ run_test 02_create_patch.sh run_test 03_edit_patch.sh run_test 04_add_new_patch.sh -#run_test 05_edit_with_patched.sh # -- this one will always fail as of 2.0.13.0 +run_test 05_edit_with_patched.sh # -- this one will always fail as of 2.0.13.0 run_test 06_dpatch_edit_patch_description.sh # -- this one will always fail as of 2.0.13.0 run_test 07_dpatch_edit_patch_description_preserve.sh # -- this one will always fail as of 2.0.13.0 rm -r "$TESTDIR" --- orig/tests/test.log +++ mod/tests/test.log @@ -5,9 +5,9 @@ + echo '[OK]' 01_create_env.sh + run_test 02_create_patch.sh + ./02_create_patch.sh -dpatch-edit-patch: * /tmp/tmp.Fj551L/dpatch-test/debian/patches/01_edpatch.dpatch does not exist, it will be created as a new dpatch. -dpatch-edit-patch: * Copying /tmp/tmp.Fj551L/dpatch-test to reference directory. -dpatch-edit-patch: * Cleaning /tmp/dpep-ref.eoPTYL/dpatch-test +dpatch-edit-patch: * /tmp/tmp.97AI7Z/dpatch-test/debian/patches/01_edpatch.dpatch does not exist, it will be created as a new dpatch. +dpatch-edit-patch: * Copying /tmp/tmp.97AI7Z/dpatch-test to reference directory. +dpatch-edit-patch: * Cleaning /tmp/dpep-ref.gAlIaf/dpatch-test --- Cleaning dh_testdir dh_testroot @@ -16,7 +16,7 @@ rm -rf patch-stamp debian/patched make: Nothing to be done for `unpatch'. dpatch-edit-patch: Warning: * No base-patch supplied, not applying any patches. -dpatch-edit-patch: * Copying reference directory /tmp/dpep-ref.eoPTYL/dpatch-test to work directory. +dpatch-edit-patch: * Copying reference directory /tmp/dpep-ref.gAlIaf/dpatch-test to work directory. dpatch-edit-patch: @@ -27,9 +27,9 @@ If you wish to abort the process, exit the shell such that it returns an exit code of "230". This is typically done by exiting the shell with the command 'exit 230'. -dpatch-edit-patch: * Creating new patch /tmp/tmp.Fj551L/dpatch-test/debian/patches/01_edpatch.dpatch +dpatch-edit-patch: * Creating new patch /tmp/tmp.97AI7Z/dpatch-test/debian/patches/01_edpatch.dpatch dpatch-edit-patch: Warning: debian/patches/00template not exist, using hardcoded default. -dpatch-edit-patch: /tmp/tmp.Fj551L/dpatch-test/debian/patches/01_edpatch.dpatch created. +dpatch-edit-patch: /tmp/tmp.97AI7Z/dpatch-test/debian/patches/01_edpatch.dpatch created. dpatch apply-all applying patch 01_edpatch to ./ ... ok. #dpatch call-all -a=pkg-info >patch-stamp @@ -44,9 +44,9 @@ dpatch deapply-all 01_edpatch not applied to ./ . rm -rf patch-stamp debian/patched -dpatch-edit-patch: * /tmp/tmp.Fj551L/dpatch-test/debian/patches/01_edpatch.dpatch exists, this patch will be updated. -dpatch-edit-patch: * Copying /tmp/tmp.Fj551L/dpatch-test to reference directory. -dpatch-edit-patch: * Cleaning /tmp/dpep-ref.UlTSz1/dpatch-test +dpatch-edit-patch: * /tmp/tmp.97AI7Z/dpatch-test/debian/patches/01_edpatch.dpatch exists, this patch will be updated. +dpatch-edit-patch: * Copying /tmp/tmp.97AI7Z/dpatch-test to reference directory. +dpatch-edit-patch: * Cleaning /tmp/dpep-ref.05sROZ/dpatch-test --- Cleaning dh_testdir dh_testroot @@ -57,7 +57,7 @@ make: Nothing to be done for `unpatch'. 01_edpatch not applied to ./ . dpatch-edit-patch: * Applying patches -dpatch-edit-patch: * Copying reference directory /tmp/dpep-ref.UlTSz1/dpatch-test to work directory. +dpatch-edit-patch: * Copying reference directory /tmp/dpep-ref.05sROZ/dpatch-test to work directory. dpatch-edit-patch: * Applying current 01_edpatch.dpatch for editing. applying patch 01_edpatch to ./ ... ok. @@ -70,9 +70,9 @@ If you wish to abort the process, exit the shell such that it returns an exit code of "230". This is typically done by exiting the shell with the command 'exit 230'. -dpatch-edit-patch: Updating patch /tmp/tmp.Fj551L/dpatch-test/debian/patches/01_edpatch.dpatch +dpatch-edit-patch: Updating patch /tmp/tmp.97AI7Z/dpatch-test/debian/patches/01_edpatch.dpatch dpatch-edit-patch: @DPATCH@ tag found, preserving dpatch header. -dpatch-edit-patch: /tmp/tmp.Fj551L/dpatch-test/debian/patches/01_edpatch.dpatch updated. +dpatch-edit-patch: /tmp/tmp.97AI7Z/dpatch-test/debian/patches/01_edpatch.dpatch updated. dpatch apply-all applying patch 01_edpatch to ./ ... ok. #dpatch call-all -a=pkg-info >patch-stamp @@ -87,9 +87,9 @@ dpatch deapply-all 01_edpatch not applied to ./ . rm -rf patch-stamp debian/patched -dpatch-edit-patch: * /tmp/tmp.Fj551L/dpatch-test/debian/patches/02_another.dpatch does not exist, it will be created as a new dpatch. -dpatch-edit-patch: * Copying /tmp/tmp.Fj551L/dpatch-test to reference directory. -dpatch-edit-patch: * Cleaning /tmp/dpep-ref.aeU6C2/dpatch-test +dpatch-edit-patch: * /tmp/tmp.97AI7Z/dpatch-test/debian/patches/02_another.dpatch does not exist, it will be created as a new dpatch. +dpatch-edit-patch: * Copying /tmp/tmp.97AI7Z/dpatch-test to reference directory. +dpatch-edit-patch: * Cleaning /tmp/dpep-ref.eG6aye/dpatch-test --- Cleaning dh_testdir dh_testroot @@ -101,7 +101,7 @@ 01_edpatch not applied to ./ . dpatch-edit-patch: * Applying patches applying patch 01_edpatch to ./ ... ok. -dpatch-edit-patch: * Copying reference directory /tmp/dpep-ref.aeU6C2/dpatch-test to work directory. +dpatch-edit-patch: * Copying reference directory /tmp/dpep-ref.eG6aye/dpatch-test to work directory. dpatch-edit-patch: @@ -112,9 +112,9 @@ If you wish to abort the process, exit the shell such that it returns an exit code of "230". This is typically done by exiting the shell with the command 'exit 230'. -dpatch-edit-patch: * Creating new patch /tmp/tmp.Fj551L/dpatch-test/debian/patches/02_another.dpatch +dpatch-edit-patch: * Creating new patch /tmp/tmp.97AI7Z/dpatch-test/debian/patches/02_another.dpatch dpatch-edit-patch: Warning: debian/patches/00template not exist, using hardcoded default. -dpatch-edit-patch: /tmp/tmp.Fj551L/dpatch-test/debian/patches/02_another.dpatch created. +dpatch-edit-patch: /tmp/tmp.97AI7Z/dpatch-test/debian/patches/02_another.dpatch created. dpatch apply-all applying patch 01_edpatch to ./ ... ok. applying patch 02_another to ./ ... ok. @@ -126,15 +126,69 @@ rm -rf patch-stamp debian/patched === check file one2 does not exist + echo '[OK]' 04_add_new_patch.sh ++ run_test 05_edit_with_patched.sh ++ ./05_edit_with_patched.sh +dpatch apply-all +applying patch 01_edpatch to ./ ... ok. +applying patch 02_another to ./ ... ok. +#dpatch call-all -a=pkg-info >patch-stamp +dpatch-edit-patch: * /tmp/tmp.97AI7Z/dpatch-test/debian/patches/01_edpatch.dpatch exists, this patch will be updated. +dpatch-edit-patch: Error: Patch 01_edpatch.dpatch is applied on working directory, use --clean option +dpatch-edit-patch: * /tmp/tmp.97AI7Z/dpatch-test/debian/patches/01_edpatch.dpatch exists, this patch will be updated. +dpatch-edit-patch: * Cleaning /tmp/tmp.97AI7Z/dpatch-test +--- Cleaning +dh_testdir +dh_testroot +dh_clean -k +dpatch deapply-all +reverting patch 02_another from ./ ... ok. +reverting patch 01_edpatch from ./ ... ok. +rm -rf patch-stamp debian/patched +make: Nothing to be done for `unpatch'. +02_another not applied to ./ . +01_edpatch not applied to ./ . +dpatch-edit-patch: * Applying patches +dpatch-edit-patch: * Copying reference directory /tmp/tmp.97AI7Z/dpatch-test to work directory. +dpatch-edit-patch: * Applying current 01_edpatch.dpatch for editing. +applying patch 01_edpatch to ./ ... ok. + +dpatch-edit-patch: + +Now launching an interactive shell in your work directory. Edit your files. +When you are done, exit the shell. When you exit the shell, your patch will be +automatically updated based on the changes in your work directory. + +If you wish to abort the process, exit the shell such that it returns an exit +code of "230". This is typically done by exiting the shell with the command +'exit 230'. +dpatch-edit-patch: Updating patch /tmp/tmp.97AI7Z/dpatch-test/debian/patches/01_edpatch.dpatch +dpatch-edit-patch: @DPATCH@ tag found, preserving dpatch header. +dpatch-edit-patch: /tmp/tmp.97AI7Z/dpatch-test/debian/patches/01_edpatch.dpatch updated. +dpatch-edit-patch: * Not deleting reference directory /tmp/tmp.97AI7Z/dpatch-test/, as it is the same as source directory. +dpatch deapply-all +02_another not applied to ./ . +01_edpatch not applied to ./ . +rm -rf patch-stamp debian/patched +dpatch apply-all +applying patch 01_edpatch to ./ ... ok. +applying patch 02_another to ./ ... ok. +#dpatch call-all -a=pkg-info >patch-stamp +=== check file one1 contains the right content +dpatch deapply-all +reverting patch 02_another from ./ ... ok. +reverting patch 01_edpatch from ./ ... ok. +rm -rf patch-stamp debian/patched +=== check file one1 does not exist ++ echo '[OK]' 05_edit_with_patched.sh + run_test 06_dpatch_edit_patch_description.sh + ./06_dpatch_edit_patch_description.sh dpatch deapply-all 02_another not applied to ./ . 01_edpatch not applied to ./ . rm -rf patch-stamp debian/patched -dpatch-edit-patch: * /tmp/tmp.Fj551L/dpatch-test/debian/patches/03_description.dpatch does not exist, it will be created as a new dpatch. -dpatch-edit-patch: * Copying /tmp/tmp.Fj551L/dpatch-test to reference directory. -dpatch-edit-patch: * Cleaning /tmp/dpep-ref.SVaKn3/dpatch-test +dpatch-edit-patch: * /tmp/tmp.97AI7Z/dpatch-test/debian/patches/03_description.dpatch does not exist, it will be created as a new dpatch. +dpatch-edit-patch: * Copying /tmp/tmp.97AI7Z/dpatch-test to reference directory. +dpatch-edit-patch: * Cleaning /tmp/dpep-ref.7kVSin/dpatch-test --- Cleaning dh_testdir dh_testroot @@ -147,7 +201,7 @@ 02_another not applied to ./ . 01_edpatch not applied to ./ . dpatch-edit-patch: Warning: * No base-patch supplied, not applying any patches. -dpatch-edit-patch: * Copying reference directory /tmp/dpep-ref.SVaKn3/dpatch-test to work directory. +dpatch-edit-patch: * Copying reference directory /tmp/dpep-ref.7kVSin/dpatch-test to work directory. dpatch-edit-patch: @@ -158,9 +212,9 @@ If you wish to abort the process, exit the shell such that it returns an exit code of "230". This is typically done by exiting the shell with the command 'exit 230'. -dpatch-edit-patch: * Creating new patch /tmp/tmp.Fj551L/dpatch-test/debian/patches/03_description.dpatch +dpatch-edit-patch: * Creating new patch /tmp/tmp.97AI7Z/dpatch-test/debian/patches/03_description.dpatch dpatch-edit-patch: Warning: debian/patches/00template not exist, using hardcoded default. -dpatch-edit-patch: /tmp/tmp.Fj551L/dpatch-test/debian/patches/03_description.dpatch created. +dpatch-edit-patch: /tmp/tmp.97AI7Z/dpatch-test/debian/patches/03_description.dpatch created. dpatch apply-all applying patch 01_edpatch to ./ ... ok. applying patch 02_another to ./ ... ok. @@ -183,9 +237,9 @@ 02_another not applied to ./ . 01_edpatch not applied to ./ . rm -rf patch-stamp debian/patched -dpatch-edit-patch: * /tmp/tmp.Fj551L/dpatch-test/debian/patches/03_description.dpatch exists, this patch will be updated. -dpatch-edit-patch: * Copying /tmp/tmp.Fj551L/dpatch-test to reference directory. -dpatch-edit-patch: * Cleaning /tmp/dpep-ref.0t0vKa/dpatch-test +dpatch-edit-patch: * /tmp/tmp.97AI7Z/dpatch-test/debian/patches/03_description.dpatch exists, this patch will be updated. +dpatch-edit-patch: * Copying /tmp/tmp.97AI7Z/dpatch-test to reference directory. +dpatch-edit-patch: * Cleaning /tmp/dpep-ref.3dd81D/dpatch-test --- Cleaning dh_testdir dh_testroot @@ -202,7 +256,7 @@ dpatch-edit-patch: * Applying patches applying patch 01_edpatch to ./ ... ok. applying patch 02_another to ./ ... ok. -dpatch-edit-patch: * Copying reference directory /tmp/dpep-ref.0t0vKa/dpatch-test to work directory. +dpatch-edit-patch: * Copying reference directory /tmp/dpep-ref.3dd81D/dpatch-test to work directory. dpatch-edit-patch: * Applying current 03_description.dpatch for editing. applying patch 03_description to ./ ... ok. @@ -215,9 +269,9 @@ If you wish to abort the process, exit the shell such that it returns an exit code of "230". This is typically done by exiting the shell with the command 'exit 230'. -dpatch-edit-patch: Updating patch /tmp/tmp.Fj551L/dpatch-test/debian/patches/03_description.dpatch +dpatch-edit-patch: Updating patch /tmp/tmp.97AI7Z/dpatch-test/debian/patches/03_description.dpatch dpatch-edit-patch: @DPATCH@ tag found, preserving dpatch header. -dpatch-edit-patch: /tmp/tmp.Fj551L/dpatch-test/debian/patches/03_description.dpatch updated. +dpatch-edit-patch: /tmp/tmp.97AI7Z/dpatch-test/debian/patches/03_description.dpatch updated. dpatch apply-all applying patch 01_edpatch to ./ ... ok. applying patch 02_another to ./ ... ok. @@ -233,4 +287,4 @@ === check the description ## DP: Description of this patch + echo '[OK]' 07_dpatch_edit_patch_description_preserve.sh -+ rm -r /tmp/tmp.Fj551L ++ rm -r /tmp/tmp.97AI7Z --- orig/tests/test.log.summary +++ mod/tests/test.log.summary @@ -2,5 +2,6 @@ [OK] 02_create_patch.sh [OK] 03_edit_patch.sh [OK] 04_add_new_patch.sh +[OK] 05_edit_with_patched.sh [OK] 06_dpatch_edit_patch_description.sh [OK] 07_dpatch_edit_patch_description_preserve.sh -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]