[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Quick attempt to fix it



tag 296917 +patch
thanks

Hi,

following the discussion about this bug on debian-devel, with some late,
I looked quickly in the code of the debhelper package, and I think I
could understand it very fast (proof that it is written in a very
maintainable way), so I tried to write this patch. I don't make much
Debian packaging yet, so I let others test it.

diff -ur debhelper-4.2.31/Debian/Debhelper/Dh_Getopt.pm debhelper-4.2.31.new/Debian/Debhelper/Dh_Getopt.pm
--- debhelper-4.2.31/Debian/Debhelper/Dh_Getopt.pm	2004-06-29 01:59:57.000000000 +0200
+++ debhelper-4.2.31.new/Debian/Debhelper/Dh_Getopt.pm	2005-03-22 20:39:02.000000000 +0100
@@ -165,6 +165,10 @@
 		"error-handler=s" => \$options{ERROR_HANDLER},
 
 		"<>" => \&NonOption,
+
+		"move=s" => \$options{MOVE},
+
+		"hard-link=s" => \$options{HARD_LINK},
 	);
 
 	if (!$ret) {
diff -ur debhelper-4.2.31/dh_install debhelper-4.2.31.new/dh_install
--- debhelper-4.2.31/dh_install	2004-01-16 04:47:14.000000000 +0100
+++ debhelper-4.2.31.new/dh_install	2005-03-22 23:01:22.200594648 +0100
@@ -12,7 +12,7 @@
 
 =head1 SYNOPSIS
 
-B<dh_install> [B<-X>I<item>] [B<--autodest>] [B<--sourcedir=>I<dir>] [S<I<debhelper options>>] [S<I<file [...] dest>>]
+B<dh_install> [B<-X>I<item>] [B<--autodest>] [B<--sourcedir=>I<dir>] [B<--move>] [B<--hard-link>] [S<I<debhelper options>>] [S<I<file [...] dest>>]
 
 =head1 DESCRIPTION
 
@@ -96,6 +96,17 @@
 approximate dh_movefiles behaviour, except it will copy files instead
 of moving them.
 
+=item B<--move>
+
+Moves the files instead of copying them. B<Caution!> It breaks idempotency!. Ignored
+when B<--hard-link> is used
+
+=item B<--hard-link>
+
+Copies the files by creating hard links, to perform faster and save disk space.
+B<Caution!> Don't use it if you wan't to be able to modify the source files
+after having installed them.
+
 =item I<file [...] dest>
 
 Lists files (or directories) to install and where to install them to.
@@ -180,7 +191,15 @@
 				complex_doit("cd $src/.. && find $dir_basename $exclude \\( -type d -and -empty \\) -exec cp --parents -a {} $pwd/$tmp/$dest/ \\;");
 			}
 			else {
-				doit("cp", "-a", $src, "$tmp/$dest/");
+				if ($dh{HARD_LINK}) {
+					doit("cp", "-al", $src, "$tmp/$dest/");
+				}
+				elsif ($dh{MOVE}) {
+					doit("mv", "", $src, "$tmp/$dest/");
+				}
+				else {
+					doit("cp", "-a", $src, "$tmp/$dest/");
+				}
 			}
 
 			if ($tmpdest) {

Quickly,
Nowhere man
-- 
nowhere.man@levallois.eu.org
OpenPGP 0xD9D50D8A

Attachment: signature.asc
Description: Digital signature


Reply to: