summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoey <joey>1999-08-17 05:07:14 +0000
committerjoey <joey>1999-08-17 05:07:14 +0000
commitaa3db12b0c4892841179e5b135de6568f8ebdd3c (patch)
treee10677c9107b657641fef26cbc06d78ed7fa3c46
parent35e3686ae9a536a4b91ccc97f9b1c8dbf6593af6 (diff)
downloaddebhelper-aa3db12b0c4892841179e5b135de6568f8ebdd3c.tar.gz
r156: Initial Import
-rw-r--r--debian/changelog7
-rwxr-xr-xdh_compress36
2 files changed, 26 insertions, 17 deletions
diff --git a/debian/changelog b/debian/changelog
index ddd85269..3db2cd84 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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
diff --git a/dh_compress b/dh_compress
index 2933e516..ffca30af 100755
--- a/dh_compress
+++ b/dh_compress
@@ -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);