]> git.donarmstrong.com Git - debhelper.git/commitdiff
r156: Initial Import
authorjoey <joey>
Tue, 17 Aug 1999 05:07:14 +0000 (05:07 +0000)
committerjoey <joey>
Tue, 17 Aug 1999 05:07:14 +0000 (05:07 +0000)
debian/changelog
dh_compress

index ddd852690c06e8edd5e58814310b13ca5fb0395a..3db2cd84abbafa3a929c59d487490c96b93c0943 100644 (file)
@@ -1,3 +1,10 @@
+debhelper (1.2.20) unstable; urgency=low
+
+  * dh_compress: handle the hard link stuff properly, it was broken. Also
+    faster now.
+
+ -- Joey Hess <joeyh@master.debian.org>  Wed, 23 Dec 1998 19:53:03 -0500
+
 debhelper (1.2.19) unstable; urgency=low
 
   * dh_listpackages: new command. Takes the standard options taken by other
index 2933e516312829d2658a7080dc695147ef6c1f57..ffca30af73828644e84e3f33fb4eb5c194935d76 100755 (executable)
@@ -57,33 +57,35 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
        # Look for files with hard links. If we are going to compress both,
        # we can preserve the hard link across the compression and save
        # space in the end.
+       my @f=();
        foreach (@files) {
                ($dev, $inode, undef, $nlink)=stat($_);
                if ($nlink > 1) {
-                       @{$hardlinks{$_}}=($dev,$inode);
+                       if (! $seen{"$inode.$dev"}) {
+                               $seen{"$inode.$dev"}=$_;
+                               push @f, $_;
+                       }
+                       else {
+                               # This is a hardlink.
+                               $hardlinks{$_}=$seen{"$inode.$dev"};
+                       }
+               }
+               else {
+                       push @f, $_;
                }
        }
-       # TODO: with the info we have now, we could remove the hard link files
-       # from the list of files to compress and save some time.
 
-       if (@files) {
-               doit("gzip","-9f",@files);
+       if (@f) {
+               doit("gzip","-9f",@f);
        }
        
        # Now change over any files we can that used to be hard links so
        # they are again.
-       my $old_dev='';
-       my $old_inode='';
-       my $old_fn='';
-       foreach (sort keys %hardlinks) {
-               if ($hardlinks{$_}[0] eq $old_dev &&
-                   $hardlinks{$_}[1] eq $old_inode) {
-                       doit("rm","-f","$_.gz");
-                       doit("ln","$old_fn.gz","$_.gz");
-               }       
-               $old_dev=$hardlinks{$_}[0];
-               $old_inode=$hardlinks{$_}[1];
-               $old_fn=$_;
+       foreach (keys %hardlinks) {
+               # Remove old file.
+               doit("rm","-f","$_");
+               # Make new hardlink.
+               doit("ln","$hardlinks{$_}.gz","$_.gz");
        }
 
        chdir($olddir);