From b24e222d00025941b4a46a5532e81631d6f17116 Mon Sep 17 00:00:00 2001 From: Raphael Hertzog Date: Sun, 9 Dec 2007 17:21:10 +0100 Subject: [PATCH] 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. --- ChangeLog | 9 +++++++++ debian/changelog | 2 ++ man/ChangeLog | 5 +++++ man/dpkg-gensymbols.1 | 12 ++++-------- scripts/Dpkg/Shlibs/SymbolFile.pm | 6 +++--- scripts/t/200_Dpkg_Shlibs/symbols.fake-1 | 1 - scripts/t/200_Dpkg_Shlibs/symbols.include-1 | 2 +- 7 files changed, 24 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index ff9e8507..c6d459be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-12-09 Raphael Hertzog + + * 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 * scripts/dpkg-shlibdeps.pl: Doesn't warn any more about libm.so.6 diff --git a/debian/changelog b/debian/changelog index 54d55a37..c46062e2 100644 --- a/debian/changelog +++ b/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) diff --git a/man/ChangeLog b/man/ChangeLog index 6d4a8953..6ff77aec 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,8 @@ +2007-12-09 Raphael Hertzog + + * dpkg-gensymbols.1: Remove the restriction that included files + must be valid symbol files on their own. + 2007-12-04 Frank Lichtenheld * po/po4a.cfg: Add deb-version.5. diff --git a/man/dpkg-gensymbols.1 b/man/dpkg-gensymbols.1 index cc33389a..81fd7d9f 100644 --- a/man/dpkg-gensymbols.1 +++ b/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 diff --git a/scripts/Dpkg/Shlibs/SymbolFile.pm b/scripts/Dpkg/Shlibs/SymbolFile.pm index c640afac..fcaed80b 100644 --- a/scripts/Dpkg/Shlibs/SymbolFile.pm +++ b/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, diff --git a/scripts/t/200_Dpkg_Shlibs/symbols.fake-1 b/scripts/t/200_Dpkg_Shlibs/symbols.fake-1 index 59c29392..f0a230eb 100644 --- a/scripts/t/200_Dpkg_Shlibs/symbols.fake-1 +++ b/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 diff --git a/scripts/t/200_Dpkg_Shlibs/symbols.include-1 b/scripts/t/200_Dpkg_Shlibs/symbols.include-1 index e069029c..e2ef4f7c 100644 --- a/scripts/t/200_Dpkg_Shlibs/symbols.include-1 +++ b/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 -- 2.39.5