Bug#21236: tag 21236 patch: preserve .orig directory
tag 21236 patch
thanks
The following patch moves the .orig out of the way while
extracting a source package, and restores it once the process is
complete. I've tested it with native and non-native source
packages, and with existing and missing .orig directories.
diff -ur dpkg-1.10.10~/scripts/dpkg-source.pl dpkg-1.10.10/scripts/dpkg-source.pl
--- dpkg-1.10.10~/scripts/dpkg-source.pl 2003-09-16 00:34:17.000000000 -0700
+++ dpkg-1.10.10/scripts/dpkg-source.pl 2003-09-16 00:57:35.000000000 -0700
@@ -620,7 +620,10 @@
|| &syserr("write extracting message");
&erasedir($newdirectory);
- &erasedir("$newdirectory.orig");
+ ! -e "$newdirectory.orig"
+ || rename("$newdirectory.orig","$newdirectory.orig.tmp-old")
+ || &syserr("unable to rename \`$newdirectory.orig' "
+ ."to \`$newdirectory.orig.tmp-old'");
mkdir("$expectprefix.tmp-nest",0755)
|| &syserr("unable to create \`$expectprefix.tmp-nest'");
@@ -739,6 +742,10 @@
&syserr(sprintf("cannot change mode of \`%s' to 0%o from 0%o",
$fn,$newmode,$mode));
}
+ ! -e "$newdirectory.orig.tmp-old"
+ || rename("$newdirectory.orig.tmp-old","$newdirectory.orig")
+ || &syserr("unable to rename \`$newdirectory.orig.tmp-old' "
+ ."to \`$newdirectory.orig'");
exit(0);
}
--
Matt
Reply to: