]> git.donarmstrong.com Git - debhelper.git/blobdiff - dh_makeshlibs
r376: * Rats, the previous change makes duplicate lines be created in the
[debhelper.git] / dh_makeshlibs
index c3742267eeaf78a5ecdb22bfd3ff4d74f7ec7ba9..66781c7e6c3715efeeba1424f2179b5f30722444 100755 (executable)
@@ -2,16 +2,17 @@
 #
 # Automatically generate shlibs files.
 
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
 init();
 
 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
        $TMP=tmpdir($PACKAGE);
 
+       my %seen;
+
        doit("rm", "-f", "$TMP/DEBIAN/shlibs");
 
-       open (FIND, "find $TMP -type f -name '*.so.*' |");
+       open (FIND, "find $TMP -xtype f -name '*.so.*' |");
        while (<FIND>) {
                chomp;
                ($library, $major)=m#.*/(.*)\.so\.(\d*)\.?#;
@@ -35,13 +36,18 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
                }
                if (defined($library) && defined($major) && defined($deps) && 
                    $library ne '' && $major ne '' && $deps ne '') {
-                       complex_doit("echo '$library $major $deps' >>$TMP/DEBIAN/shlibs");
+                       # Prevent duplicate lines from entering the file.
+                       my $line="$library $major $deps";
+                       if (! $seen{$line}) {
+                               $seen{$line}=1;
+                               complex_doit("echo '$line' >>$TMP/DEBIAN/shlibs");
+                       }
                }
        }
        close FIND;
 
        if (-e "$TMP/DEBIAN/shlibs") {
                doit("chmod",644,"$TMP/DEBIAN/shlibs");
-               doit("chown","root.root","$TMP/DEBIAN/shlibs");
+               doit("chown","0.0","$TMP/DEBIAN/shlibs");
        }
 }