Explorar el Código

Dpkg::Shlibs::SymbolFile: included files don't need to repeat the header line

Adjust the parser to remember the current soname when processing an
included file so that it doesn't need to repeat (and duplicate!) a header
line. Update dpkg-gensymbols's manual page accordingly. And add a
non-regression test for this feature.
Raphael Hertzog hace 18 años
padre
commit
b24e222d00

+ 9 - 0
ChangeLog

@@ -1,3 +1,12 @@
+2007-12-09  Raphael Hertzog  <hertzog@debian.org>
+
+	* scripts/Dpkg/Shlibs/SymbolFile.pm (load): Pass the current
+	object as last parameter so that included files do not need to
+	repeat the header line.
+	* scripts/t/200_Dpkg_Shlibs/symbols.fake-1,
+	scripts/t/200_Dpkg_Shlibs/symbols.include-1: Adjust some tests
+	to also test inclusions with included files lacking a header line.
+
 2007-12-08  Raphael Hertzog  <hertzog@debian.org>
 
 	* scripts/dpkg-shlibdeps.pl: Doesn't warn any more about libm.so.6

+ 2 - 0
debian/changelog

@@ -24,6 +24,8 @@ dpkg (1.14.13) UNRELEASED; urgency=low
   * dpkg-shlibdeps doesn't warn any more about libm.so.6 being unused if the
     binary is also linked against libstdc++ since g++ always add an implicit
     -lm. Closes: #454616
+  * Included files in symbols files (via #include) do no more need to repeat
+    the header line. Closes: #455260
 
   [ Updated man pages translations ]
   * Swedish (Peter Karlsson)

+ 5 - 0
man/ChangeLog

@@ -1,3 +1,8 @@
+2007-12-09  Raphael Hertzog  <hertzog@debian.org>
+
+	* dpkg-gensymbols.1: Remove the restriction that included files
+	must be valid symbol files on their own.
+
 2007-12-04  Frank Lichtenheld  <djpig@debian.org>
 
 	* po/po4a.cfg: Add deb-version.5.

+ 4 - 8
man/dpkg-gensymbols.1

@@ -67,16 +67,12 @@ the content of the included file can override any content that appeared
 before the include directive and that any content after the
 directive can override anything contained in the included file.
 .P
-An included file must be a valid symbols file on its own. Thus you have
-to repeat the header line containing the SONAME of the library and the
-dependency template. Remember that those lines might override the header
-defined previously in the main symbols file. Thus the recommended way to
-handle architecture specific information is to put include directives
-directly at the beginning of the symbols file:
+An included file can repeat the header line containing the SONAME of the
+library. In that case, it overrides any header line previously read.
+However, in general it's best to avoid duplicating header lines. One way
+to do it is the following:
 .PP
 #include "libsomething1.symbols.common"
-.br
-libsomething.so.1 libsomething1 #MINVER#
  arch_specific_symbol@Base 1.0
 .SS Good library management
 .P

+ 3 - 3
scripts/Dpkg/Shlibs/SymbolFile.pm

@@ -86,7 +86,7 @@ sub clear_except {
 
 # Parameter seen is only used for recursive calls
 sub load {
-    my ($self, $file, $seen) = @_;
+    my ($self, $file, $seen, $current_object) = @_;
 
     if (defined($seen)) {
 	return if exists $seen->{$file}; # Avoid include loops
@@ -98,7 +98,7 @@ sub load {
 
     open(my $sym_file, "<", $file)
 	|| syserr(sprintf(_g("Can't open %s: %s"), $file));
-    my ($object);
+    my $object = $current_object;
     while (defined($_ = <$sym_file>)) {
 	chomp($_);
 	if (/^\s+(\S+)\s(\S+)(?:\s(\d+))?/) {
@@ -116,7 +116,7 @@ sub load {
 	    my $filename = $1;
 	    my $dir = $file;
 	    $dir =~ s{[^/]+$}{}; # Strip filename
-	    $self->load("$dir$filename", $seen);
+	    $self->load("$dir$filename", $seen, $object);
 	} elsif (/^#DEPRECATED: ([^#]+)#\s*(\S+)\s(\S+)(?:\s(\d+))?/) {
 	    my $sym = {
 		minver => $3,

+ 0 - 1
scripts/t/200_Dpkg_Shlibs/symbols.fake-1

@@ -1,4 +1,3 @@
-libfake.so.1 libfake1 #MINVER#
  symbol1_fake1@Base 1.0
  symbol2_fake1@Base 1.0
  symbol3_fake1@Base 1.0

+ 1 - 1
scripts/t/200_Dpkg_Shlibs/symbols.include-1

@@ -1,4 +1,4 @@
-libfake.so.1 libfake1
+libfake.so.1 libfake1 #MINVER#
  symbol1_fake1@Base 0.9
  symbol2_fake1@Base 0.9
  symbol_before@Base 0.9