Pārlūkot izejas kodu

Add support "package types" to dpkg-shlibdeps. Patch by
Joey Hess. Closes: #345475

* scripts/dpkg-shlibdeps: Add possibility to
specify a package type in the shlibs file
and add a -t switch to dpkg-shlibdeps to
specify the wanted type. Entries without
package type will have type 'deb' and will
serve as fallback if no entry with the
correct type is found
* man/C/dpkg-source.1: Document new -t
switch for dpkg-shlibdeps

Frank Lichtenheld 20 gadi atpakaļ
vecāks
revīzija
5ac4c8e199
4 mainītis faili ar 51 papildinājumiem un 20 dzēšanām
  1. 12 0
      ChangeLog
  2. 2 0
      debian/changelog
  3. 10 1
      man/C/dpkg-source.1
  4. 27 19
      scripts/dpkg-shlibdeps.pl

+ 12 - 0
ChangeLog

@@ -1,3 +1,15 @@
+2006-01-18  Joey Hess  <joeyh@debian.org>
+
+	* scripts/dpkg-shlibdeps: Add possibility to
+	specify a package type in the shlibs file
+	and add a -t switch to dpkg-shlibdeps to
+	specify the wanted type. Entries without
+	package type will have type 'deb' and will
+	serve as fallback if no entry with the
+	correct type is found
+	* man/C/dpkg-source.1: Document new -t
+	switch for dpkg-shlibdeps
+
 2005-10-07  Frank Lichtenheld  <djpig@debian.org>
 2005-10-07  Frank Lichtenheld  <djpig@debian.org>
 
 
 	* scripts/controllib.pl:
 	* scripts/controllib.pl:

+ 2 - 0
debian/changelog

@@ -20,6 +20,8 @@ dpkg (1.13.12~) unstable; urgency=low
   * Check for illegal architecture strings in dpkg-gencontrol and
   * Check for illegal architecture strings in dpkg-gencontrol and
     dpkg-source. dpkg-gencontrol will only issue a warning while
     dpkg-source. dpkg-gencontrol will only issue a warning while
     dpkg-source will error out. Closes: #96920
     dpkg-source will error out. Closes: #96920
+  * Add support "package types" to dpkg-shlibdeps. Patch by
+    Joey Hess. Closes: #345475
 
 
  --
  --
 
 

+ 10 - 1
man/C/dpkg-source.1

@@ -516,7 +516,7 @@ are removed from the the substitution variables file.
 .TP
 .TP
 .BI \-L localshlibsfile
 .BI \-L localshlibsfile
 Causes
 Causes
-.B dpkg\-shlibs
+.B dpkg\-shlibdeps
 to read overriding shared library dependency information from
 to read overriding shared library dependency information from
 .I localshlibsfile
 .I localshlibsfile
 instead of
 instead of
@@ -527,6 +527,15 @@ Causes the substitution variable settings to be printed to standard
 output, rather than being added to the substitution variables file
 output, rather than being added to the substitution variables file
 .RB ( debian/substvars
 .RB ( debian/substvars
 by default).
 by default).
+.TP
+.BI \-t type
+Causes
+.B dpkg\-shlibdeps
+to prefer shared library dependency information tagged for the given
+package type. If no tagged information is available, falls back to untagged
+information. The default package type is "deb". Shared library dependency
+information is tagged for a given type by prefixing it with the name of the
+type, a colon, and whitespace.
 .SH dpkg\-GENCHANGES OPTIONS
 .SH dpkg\-GENCHANGES OPTIONS
 .B dpkg\-genchanges
 .B dpkg\-genchanges
 does not take any non-option arguments.
 does not take any non-option arguments.

+ 27 - 19
scripts/dpkg-shlibdeps.pl

@@ -17,6 +17,7 @@ $shlibsppext= '.shlibs';
 $varnameprefix= 'shlibs';
 $varnameprefix= 'shlibs';
 $dependencyfield= 'Depends';
 $dependencyfield= 'Depends';
 $varlistfile= 'debian/substvars';
 $varlistfile= 'debian/substvars';
+$packagetype= 'deb';
 
 
 @depfields= qw(Suggests Recommends Depends Pre-Depends);
 @depfields= qw(Suggests Recommends Depends Pre-Depends);
 
 
@@ -42,6 +43,7 @@ Overall options (have global effect no matter where placed):
        -O                     print variable settings to stdout
        -O                     print variable settings to stdout
        -L<localshlibsfile>    shlibs override file, not debian/shlibs.local
        -L<localshlibsfile>    shlibs override file, not debian/shlibs.local
        -T<varlistfile>        update variables here, not debian/substvars
        -T<varlistfile>        update variables here, not debian/substvars
+       -t<type>               set package type (default is deb)
 Dependency fields recognised are ".join("/",@depfields)."
 Dependency fields recognised are ".join("/",@depfields)."
 ";
 ";
 }
 }
@@ -66,6 +68,8 @@ while (@ARGV) {
             &warn("unrecognised dependency field \`$dependencyfield'");
             &warn("unrecognised dependency field \`$dependencyfield'");
     } elsif (m/^-e/) {
     } elsif (m/^-e/) {
         push(@exec,$'); push(@execf,$dependencyfield);
         push(@exec,$'); push(@execf,$dependencyfield);
+    } elsif (m/^-t/) {
+        $packagetype= $';
     } elsif (m/^-/) {
     } elsif (m/^-/) {
         usageerr("unknown option \`$_'");
         usageerr("unknown option \`$_'");
     } else {
     } else {
@@ -237,33 +241,37 @@ sub scanshlibsfile {
 
 
     while (<SLF>) {
     while (<SLF>) {
         s/\s*\n$//; next if m/^\#/;
         s/\s*\n$//; next if m/^\#/;
-        if (!m/^\s*(\S+)\s+(\S+)/) {
+        if (!m/^\s*(?:(\S+):\s+)?(\S+)\s+(\S+)/) {
             &warn("shared libs info file \`$fn' line $.: bad line \`$_'");
             &warn("shared libs info file \`$fn' line $.: bad line \`$_'");
             next;
             next;
         }
         }
-        next if $1 ne $ln || $2 ne $lsn;
+        next if defined $1 && $1 ne $packagetype;
+        next if $2 ne $ln || $3 ne $lsn;
         return 1 if $fn eq "$curpackdir/DEBIAN/shlibs";
         return 1 if $fn eq "$curpackdir/DEBIAN/shlibs";
         $da= $';
         $da= $';
-        for $dv (split(/,/,$da)) {
-            $dv =~ s/^\s+//; $dv =~ s/\s+$//;
-            if (defined($depstrength{$lf})) {
-                if (!defined($predefdepfdep{$dv}) ||
-                    $depstrength{$predefdepfdep{$dv}} < $depstrength{$lf}) {
-                    $predefdepfdep{$dv}= $lf;
-                }
-            } else {
-                $dk= "$lf: $dv";
-                if (!defined($unkdepfdone{$dk})) {
-                    $unkdepfdone{$dk}= 1;
-                    $unkdepf{$lf}.= ', ' if length($unkdepf{$lf});
-                    $unkdepf{$lf}.= $dv;
-                }
+        last if defined $1; # exact match, otherwise keep looking
+    }
+    close(SLF);
+        
+    return 0 unless defined $da;
+
+    for $dv (split(/,/,$da)) {
+        $dv =~ s/^\s+//; $dv =~ s/\s+$//;
+        if (defined($depstrength{$lf})) {
+            if (!defined($predefdepfdep{$dv}) ||
+                $depstrength{$predefdepfdep{$dv}} < $depstrength{$lf}) {
+                $predefdepfdep{$dv}= $lf;
+            }
+        } else {
+            $dk= "$lf: $dv";
+            if (!defined($unkdepfdone{$dk})) {
+                $unkdepfdone{$dk}= 1;
+                $unkdepf{$lf}.= ', ' if length($unkdepf{$lf});
+                $unkdepf{$lf}.= $dv;
             }
             }
         }
         }
-        return 1;
     }
     }
-    close(SLF);
-    return 0;
+    return 1;
 }
 }
 
 
 if (!$stdout) {
 if (!$stdout) {