diff options
author | Modestas Vainius <modestas@vainius.eu> | 2010-04-22 10:07:39 +0300 |
---|---|---|
committer | Modestas Vainius <modestas@vainius.eu> | 2010-04-22 10:58:52 +0300 |
commit | ee54915dea09b943e5b90695392c0105ec36ddb3 (patch) | |
tree | 834b94ce46269691bd74434e4fae1b1f66c7d21e | |
parent | ac077e4f3e664a0ddaf05dd8b786fff196810b66 (diff) | |
download | pkg-kde-tools-ee54915dea09b943e5b90695392c0105ec36ddb3.tar.gz |
No longer ship a backported dpkg-gensymbols.pl script.
The one from dpkg-dev (>= 1.15.6) is enough now. As a result, make appropriate
changes to pkgkde-gensymbols.
-rw-r--r-- | Makefile | 5 | ||||
-rwxr-xr-x | datalib/dpkg-gensymbols.pl | 304 | ||||
-rw-r--r-- | debian/changelog | 3 | ||||
-rw-r--r-- | debian/copyright | 2 | ||||
-rw-r--r-- | dpkg-gensymbols.1 | 459 | ||||
-rw-r--r-- | perllib/Debian/PkgKde.pm | 2 | ||||
-rwxr-xr-x | pkgkde-gensymbols | 12 |
7 files changed, 14 insertions, 773 deletions
@@ -52,9 +52,8 @@ install: # Install POD based manual packages for f in $(PERLPODS_1); do pod2man "$$f" > "$(MANDIR)/man1/$${f%.*}.1"; done - # Special overload of system dpkg-gensymbols - install -m 0755 dpkg-gensymbols.1 $(MANDIR)/man1/pkgkde-gensymbols.1 - install -d $(DATADIR)/bin # Make it possible to transparently replace dpkg-gensymbols with # pkgkde-gensymbols + install -d $(DATADIR)/bin ln -sf /usr/bin/pkgkde-gensymbols $(DATADIR)/bin/dpkg-gensymbols + ln -sf /usr/share/man/man1/dpkg-gensymbols.1.gz $(MANDIR)/man1/pkgkde-gensymbols.1.gz diff --git a/datalib/dpkg-gensymbols.pl b/datalib/dpkg-gensymbols.pl deleted file mode 100755 index e56747d..0000000 --- a/datalib/dpkg-gensymbols.pl +++ /dev/null @@ -1,304 +0,0 @@ -#!/usr/bin/perl -# -# dpkg-gensymbols -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -use strict; -use warnings; - -use Dpkg; -use Dpkg::Arch qw(get_host_arch); -use Dpkg::Shlibs qw(@librarypaths); -use Dpkg::Shlibs::Objdump; -use Dpkg::Shlibs::SymbolFile; -use Dpkg::Gettext; -use Dpkg::ErrorHandling; -use Dpkg::Control::Info; -use Dpkg::Changelog::Parse; -use Dpkg::Path qw(check_files_are_the_same); - -textdomain("dpkg-dev"); - -my $packagebuilddir = 'debian/tmp'; - -my $sourceversion; -my $stdout; -my $oppackage; -my $compare = 1; # Bail on missing symbols by default -my $quiet = 0; -my $input; -my $output; -my $template_mode = 0; # non-template mode by default -my $verbose_output = 0; -my $debug = 0; -my $host_arch = get_host_arch(); - -sub version { - printf _g("Debian %s version %s.\n"), $progname, $version; - - printf _g(" -Copyright (C) 2007 Raphael Hertzog. -"); - - printf _g(" -This is free software; see the GNU General Public Licence version 2 or -later for copying conditions. There is NO warranty. -"); -} - -sub usage { - printf _g( -"Usage: %s [<option> ...] - -Options: - -p<package> generate symbols file for package. - -P<packagebuilddir> temporary build dir instead of debian/tmp. - -e<library> explicitly list libraries to scan. - -v<version> version of the packages (defaults to - version extracted from debian/changelog). - -c<level> compare generated symbols file with the - reference template in the debian directory - and fail if difference is too important - (level goes from 0 for no check, to 4 - for all checks). By default checks at - level 1. - -q keep quiet and never emit any warnings or - generate a diff between generated symbols - file and the reference template. - -I<file> force usage of <file> as reference symbols - file instead of the default file. - -O<file> write to <file>, not .../DEBIAN/symbols. - -O write to stdout, not .../DEBIAN/symbols. - -t write in template mode (tags are not - processed and included in output). - -V verbose output. Write deprecated symbols and - pattern matching symbols as comments - (in template mode only). - -a<arch> assume <arch> as host architecture when processing - symbol files. - -d display debug information during work. - -h, --help show this help message. - --version show the version. -"), $progname; -} - -my @files; -while (@ARGV) { - $_ = shift(@ARGV); - if (m/^-p([-+0-9a-z.]+)$/) { - $oppackage = $1; - } elsif (m/^-c(\d)?$/) { - $compare = defined($1) ? $1 : 1; - } elsif (m/^-q$/) { - $quiet = 1; - } elsif (m/^-d$/) { - $debug = 1; - } elsif (m/^-v(.+)$/) { - $sourceversion = $1; - } elsif (m/^-e(.+)$/) { - my $file = $1; - if (-e $file) { - push @files, $file; - } else { - push @files, glob($file); - } - } elsif (m/^-p(.*)/) { - error(_g("Illegal package name \`%s'"), $1); - } elsif (m/^-P(.+)$/) { - $packagebuilddir = $1; - $packagebuilddir =~ s{/+$}{}; - } elsif (m/^-O$/) { - $stdout = 1; - } elsif (m/^-I(.+)$/) { - $input = $1; - } elsif (m/^-O(.+)$/) { - $output = $1; - } elsif (m/^-t$/) { - $template_mode = 1; - } elsif (m/^-V$/) { - $verbose_output = 1; - } elsif (m/^-a(.+)$/) { - $host_arch = $1; - } elsif (m/^-(h|-help)$/) { - usage(); - exit(0); - } elsif (m/^--version$/) { - version(); - exit(0); - } else { - usageerr(_g("unknown option \`%s'"), $_); - } -} - -umask 0022; # ensure sane default permissions for created files - -if (exists $ENV{DPKG_GENSYMBOLS_CHECK_LEVEL}) { - $compare = $ENV{DPKG_GENSYMBOLS_CHECK_LEVEL}; -} - -if (not defined($sourceversion)) { - my $changelog = changelog_parse(); - $sourceversion = $changelog->{"Version"}; -} -if (not defined($oppackage)) { - my $control = Dpkg::Control::Info->new(); - my @packages = map { $_->{'Package'} } $control->get_packages(); - @packages == 1 || - error(_g("must specify package since control info has many (%s)"), - "@packages"); - $oppackage = $packages[0]; -} - -my $symfile = Dpkg::Shlibs::SymbolFile->new(arch => $host_arch); -my $ref_symfile = Dpkg::Shlibs::SymbolFile->new(arch => $host_arch); -# Load source-provided symbol information -foreach my $file ($input, $output, "debian/$oppackage.symbols.$host_arch", - "debian/symbols.$host_arch", "debian/$oppackage.symbols", - "debian/symbols") -{ - if (defined $file and -e $file) { - print "Using references symbols from $file\n" if $debug; - $symfile->load($file); - $ref_symfile->load($file) if $compare || ! $quiet; - last; - } -} - -# Scan package build dir looking for libraries -if (not scalar @files) { - PATH: foreach my $path (@librarypaths) { - my $libdir = "$packagebuilddir$path"; - $libdir =~ s{/+}{/}g; - lstat $libdir; - next if not -d _; - next if -l _; # Skip directories which are symlinks - # Skip any directory _below_ a symlink as well - my $updir = $libdir; - while (($updir =~ s{/[^/]*$}{}) and - not check_files_are_the_same($packagebuilddir, $updir)) { - next PATH if -l $updir; - } - opendir(DIR, "$libdir") || - syserr(_g("Can't read directory %s: %s"), $libdir, $!); - push @files, grep { - /(\.so\.|\.so$)/ && -f $_ && - Dpkg::Shlibs::Objdump::is_elf($_); - } map { "$libdir/$_" } readdir(DIR); - close(DIR); - } -} - -# Merge symbol information -my $od = Dpkg::Shlibs::Objdump->new(); -foreach my $file (@files) { - print "Scanning $file for symbol information\n" if $debug; - my $objid = $od->analyze($file); - unless (defined($objid) && $objid) { - warning(_g("Objdump couldn't parse %s\n"), $file); - next; - } - my $object = $od->get_object($objid); - if ($object->{SONAME}) { # Objects without soname are of no interest - print "Merging symbols from $file as $object->{SONAME}\n" if $debug; - if (not $symfile->has_object($object->{SONAME})) { - $symfile->create_object($object->{SONAME}, "$oppackage #MINVER#"); - } - $symfile->merge_symbols($object, $sourceversion); - } else { - print "File $file doesn't have a soname. Ignoring.\n" if $debug; - } -} -$symfile->clear_except(keys %{$od->{objects}}); - -# Write out symbols files -if ($stdout) { - $output = _g("<standard output>"); - $symfile->output(\*STDOUT, package => $oppackage, - template_mode => $template_mode, - with_pattern_matches => $verbose_output, - with_deprecated => $verbose_output); -} else { - unless (defined($output)) { - unless($symfile->is_empty()) { - $output = "$packagebuilddir/DEBIAN/symbols"; - mkdir("$packagebuilddir/DEBIAN") if not -e "$packagebuilddir/DEBIAN"; - } - } - if (defined($output)) { - print "Storing symbols in $output.\n" if $debug; - $symfile->save($output, package => $oppackage, - template_mode => $template_mode, - with_pattern_matches => $verbose_output, - with_deprecated => $verbose_output); - } else { - print "No symbol information to store.\n" if $debug; - } -} - -# Check if generated files differs from reference file -my $exitcode = 0; -if ($compare || ! $quiet) { - # Compare - if (my @libs = $symfile->get_new_libs($ref_symfile)) { - warning(_g("new libraries appeared in the symbols file: %s"), "@libs") - unless $quiet; - $exitcode = 4 if ($compare >= 4); - } - if (my @libs = $symfile->get_lost_libs($ref_symfile)) { - warning(_g("some libraries disappeared in the symbols file: %s"), "@libs") - unless $quiet; - $exitcode = 3 if ($compare >= 3); - } - if ($symfile->get_new_symbols($ref_symfile)) { - warning(_g("some new symbols appeared in the symbols file: %s"), - _g("see diff output below")) unless $quiet; - $exitcode = 2 if ($compare >= 2); - } - if ($symfile->get_lost_symbols($ref_symfile)) { - warning(_g("some symbols or patterns disappeared in the symbols file: %s"), - _g("see diff output below")) unless $quiet; - $exitcode = 1 if ($compare >= 1); - } -} - -unless ($quiet) { - use File::Temp; - use Digest::MD5; - # Compare template symbols files before and after - my $before = File::Temp->new(TEMPLATE=>'dpkg-gensymbolsXXXXXX'); - my $after = File::Temp->new(TEMPLATE=>'dpkg-gensymbolsXXXXXX'); - $ref_symfile->output($before, package => $oppackage, template_mode => 1); - $symfile->output($after, package => $oppackage, template_mode => 1); - seek($before, 0, 0); seek($after, 0, 0); - my ($md5_before, $md5_after) = (Digest::MD5->new(), Digest::MD5->new()); - $md5_before->addfile($before); - $md5_after->addfile($after); - # Output diffs between symbols files if any - if ($md5_before->hexdigest() ne $md5_after->hexdigest()) { - if (defined($ref_symfile->{file})) { - warning(_g("%s doesn't match completely %s"), - $output, $ref_symfile->{file}); - } else { - warning(_g("no debian/symbols file used as basis for generating %s"), - $output); - } - my ($a, $b) = ($before->filename, $after->filename); - my $diff_label = sprintf("%s (%s_%s_%s)", - ($ref_symfile->{file}) ? $ref_symfile->{file} : "new_symbol_file", - $oppackage, $sourceversion, $host_arch); - system("diff", "-u", "-L", $diff_label, $a, $b) if -x "/usr/bin/diff"; - } -} -exit($exitcode); diff --git a/debian/changelog b/debian/changelog index 7f42423..cc013f8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,9 @@ pkg-kde-tools (0.7.1~pre1) UNRELEASED; urgency=low * pkgkde-symbolshelper: allow to specify confirmed arches for *patch. * Depend on libdpkg-perl (>= 1.15.6~), recommend dpkg-dev of the same version and break earlier dpkg-dev versions. + * No longer ship a backported dpkg-gensymbols.pl script. The one from + dpkg-dev (>= 1.15.6) is enough now. As a result, make appropriate changes + to pkgkde-gensymbols. -- Modestas Vainius <modax@debian.org> Wed, 14 Apr 2010 20:22:09 +0300 diff --git a/debian/copyright b/debian/copyright index a490645..0832adf 100644 --- a/debian/copyright +++ b/debian/copyright @@ -56,8 +56,6 @@ The follwing license applies to: | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - datalib/Dpkg/* - - datalib/dpkg-gensymbols.pl - - dpkg-gensymbols.1 Copyright © 2007 Raphaël Hertzog <hertzog@debian.org> Copyright © 2009-2010 Modestas Vainius <modax@debian.org> diff --git a/dpkg-gensymbols.1 b/dpkg-gensymbols.1 deleted file mode 100644 index 450abd0..0000000 --- a/dpkg-gensymbols.1 +++ /dev/null @@ -1,459 +0,0 @@ -.\" Author: Raphael Hertzog -.TH dpkg\-gensymbols 1 "2009-08-07" "Debian Project" "dpkg utilities" -.SH NAME -dpkg\-gensymbols \- generate symbols files (shared library dependency information) -. -.SH SYNOPSIS -.B dpkg\-gensymbols -.RI [ options ] -. -.SH DESCRIPTION -.B dpkg\-gensymbols -scans a temporary build tree (debian/tmp by default) looking for libraries -and generate a \fIsymbols\fR file describing them. This file, if -non-empty, is then installed in the DEBIAN subdirectory of the build tree -so that it ends up included in the control information of the package. -.P -When generating those files, it uses as input some symbols files -provided by the maintainer. It looks for the following files (and use the -first that is found): -.IP \(bu 4 -debian/\fIpackage\fR.symbols.\fIarch\fR -.IP \(bu 4 -debian/symbols.\fIarch\fR -.IP \(bu 4 -debian/\fIpackage\fR.symbols -.IP \(bu 4 -debian/symbols -.P -The main interest of those files is to provide the minimal version -associated to each symbol provided by the libraries. Usually it -corresponds to the first version of that package that provided the symbol, -but it can be manually incremented by the maintainer if the ABI of the -symbol is extended without breaking backwards compatibility. It's the -responsibility of the maintainer to keep those files up-to-date and -accurate, but \fBdpkg\-gensymbols\fR helps him. -.P -When the generated symbols files differ from the maintainer supplied -one, \fBdpkg\-gensymbols\fR will print a diff between the two versions. -Furthermore if the difference are too significant, it will even fail (you -can customize how much difference you can tolerate, see the \fB\-c\fR -option). -.SH MAINTAINING SYMBOLS FILES -The symbols files are really useful only if they reflect the evolution of -the package through several releases. Thus the maintainer has to update -them every time that a new symbol is added so that its associated minimal -version matches reality. To do this properly he can use the diffs contained -in the build logs. In most cases, the diff applies directly to his -debian/\fIpackage\fR.symbols file. That said, further tweaks are usually -needed: it's recommended for example to drop the Debian revision -from the minimal version so that backports with a lower version number -but the same upstream version still satisfy the generated dependencies. -If the Debian revision can't be dropped because the symbol really got -added by the Debian specific change, then one should suffix the version -with "~". -.P -Before applying any patch to the symbols file, the maintainer should -double-check that it's sane. Public symbols are not supposed to disappear, -so the patch should ideally only add new lines. -.SS Using #PACKAGE# substitution -.P -In some rare cases, the name of the library varies between architectures. -To avoid hardcoding the name of the package in the symbols file, you can -use the marker \fI#PACKAGE#\fR. It will be replaced by the real package -name during installation of the symbols files. Contrary to the -\fI#MINVER#\fR marker, \fI#PACKAGE#\fR will never appear in a symbols file -inside a binary package. -.SS Using symbol tags -.P -Symbol tagging is useful for marking symbols that are special in some way. Any -symbol can have an arbitrary number of tags associated with it. While all tags are -parsed and stored, only a some of them are understood by -\fBdpkg\-gensymbols\fR and trigger special handling of the symbols. See -subsection \fBStandard symbol tags\fR for reference of these tags. -.P -Tag specification comes right before the symbol name (no whitespace is allowed -in between). It always starts with an opening bracket \fB(\fR, ends with a -closing bracket \fB)\fR and must contain at least one tag. Multiple tags are -separated by the \fB|\fR character. Each tag can optionally have a value which -is separated form the tag name by the \fB=\fR character. Tag names and values -can be arbitrary strings except they cannot contain any of the special \fB)\fR -\fB|\fR \fB=\fR characters. Symbol names following a tag specification can -optionally be quoted with either \fB'\fR or \fB"\fR characters to allow -whitespaces in them. However, if there are no tags specified for the symbol, -quotes are treated as part of the symbol name which continues up until the -first space. -.P - (tag1=i am marked|tag name with space)"tagged quoted symbol"@Base 1.0 - (optional)tagged_unquoted_symbol@Base 1.0 1 - untagged_symbol@Base 1.0 -.P -The first symbol in the example is named \fItagged quoted symbol\fR and has two -tags: \fItag1\fR with value \fIi am marked\fR and \fItag name with space\fR -that has no value. The second symbol named \fItagged_unquoted_symbol\fR is -only tagged with the tag named \fIoptional\fR. The last symbol is an -example of the normal untagged symbol. -.P -Since symbol tags are an extension of the \fIdeb\-symbols(5)\fR format, they -can only be part of the symbols files used in source packages (those files -should then be seen as templates used to build the symbols files that are -embedded in binary packages). When -\fBdpkg\-gensymbols\fR is called without the \fI\-t\fR option, it will -output symbols files compatible to the \fIdeb\-symbols(5)\fR format: -it fully processes symbols according to the requirements of their standard tags -and strips all tags from the output. On the contrary, in template mode -(\fI\-t\fR) all symbols and their tags (both standard and unknown ones) -are kept in the output and are written in their orignal form as they were -loaded. -.SS Standard symbol tags -.TP -.B optional -A symbol marked as optional can disappear from the library at any time and that -will never cause \fBdpkg\-gensymbols\fR to fail. However, disappeared optional -symbols will continuously appear as MISSING in the diff in each new package -revision. This behaviour serves as a reminder for the maintainer that such a -symbol needs to be removed from the symbol file or readded to the library. When -the optional symbol, which was previously declared as MISSING, suddenly -reappears in the next revision, it will be upgraded back to the "existing" -status with its minimum version unchanged. - -This tag is useful for symbols which are private where their disappearance do -not cause ABI breakage. For example, most of C++ template instantiations fall -into this category. Like any other tag, this one may also have an arbitrary -value: it could be used to indicate why the symbol is considered optional. -.TP -.B arch=\fIarchitecture list\fR -This tag allows to restrict the set of architectures where the symbol -is supposed to exist. When the symbols list is updated with the symbols -discovered in the library, all arch-specific symbols which do not concern -the current host architecture are treated as if they did not exist. If an -arch-specific symbol matching the current host architecture does not exist -in the library, normal procedures for missing symbols apply and it may -cause \fBdpkg\-gensymbols\fR to fail. On the other hand, if the -arch-specific symbol is found when it was not supposed to exist (because -the current host architecture is not listed in the tag), it is made arch -neutral (i.e. the arch tag is dropped and the symbol will appear in the -diff due to this change), but it is not considered as new. - -When operating in the default non-template mode, among arch-specific symbols -only those that match the current host architecture are written to the -symbols file. On the contrary, all arch-specific symbols (including those -from foreign arches) are always written to the symbol file when operating -in template mode. - -The format of \fIarchitecture list\fR is the same as the one used in the -\fIBuild-Depends\fR field of \fIdebian/control\fR (except the enclosing -square brackets []). For example, the first symbol from the list below -will be considered only on alpha, amd64, kfreebsd-amd64 and ia64 architectures -while the second one anywhere except on armel. - - (arch=alpha amd64 kfreebsd-amd64 ia64)a_64bit_specific_symbol@Base 1.0 - (arch=!armel)symbol_armel_does_not_have@Base 1.0 -.TP -.B ignore\-blacklist -dpkg\-gensymbols has an internal blacklist of symbols that should not -appear in symbols files as they are usually only side-effects of -implementation details of the toolchain. If for some reason, you really -want one of those symbols to be included in the symbols file, you should -tag the symbol with \fBignore\-blacklist\fP. It can be necessary for -some low level toolchain libraries like libgcc. -.TP -.B c++ -Denotes \fIc++\fR symbol pattern. See \fBUsing symbol patterns\fR subsection -below. -.TP -.B symver -Denotes \fIsymver\fR (symbol version) symbol pattern. See \fBUsing symbol -patterns\fR subsection below. -.TP -.B regex -Denotes \fIregex\fR symbol pattern. See \fBUsing symbol patterns\fR subsection -below. -.SS Using symbol patterns -.P -Unlike a standard symbol specification, a pattern may cover multiple real -symbols from the library. \fBdpkg-gensymbols\fR will attempt to match each -pattern against each real symbol that does \fInot\fR have a specific symbol -counterpart defined in the symbol file. Whenever the first matching pattern is -found, all its tags and properties will be used as a basis specification of the -symbol. If none of the patterns matches, the symbol will be considered as new. - -A pattern is considered lost if it does not match any symbol in the library. By -default this will trigger a \fBdpkg-gensymbols\fR failure under \fI-c1\fR or -higher level. However, if the failure is undesired, the pattern may be marked -with the \fIoptional\fR tag. Then if the pattern does not match anything, it -will only appear in the diff as MISSING. Moreover, like any symbol, the pattern -may be limited to the specific architectures with the \fIarch\fR tag. Please -refer to \fBStandard symbol tags\fR subsection above for more information. - -Patterns are an extension of the \fIdeb\-symbols(5)\fR format hence they are -only valid in symbol file templates. Pattern specification syntax is not any -different from the one of a specific symbol. However, symbol name part of the -specification serves as an expression to be matched against \fIname@version\fR -of the real symbol. In order to distinguish among different pattern types, a -pattern will typically be tagged with a special tag. - -At the moment, \fBdpkg\-gensymbols\fR supports three basic pattern types: -.TP 3 -.B c++ -This pattern is denoted by the \fIc++\fR tag. It matches only C++ symbols by -their demangled symbol name (as emitted by \fBc++filt\fR(1) utility). This -pattern is very handy for matching symbols which mangled names might vary -across different architectures while their demangled names remain the same. One -group of such symbols is \fInon-virtual thunks\fR which have architecture -specific offsets embedded in their mangled names. A common instance of this -case is a virtual destructor which under diamond inheritance needs a -non-virtual thunk symbol. For example, even if _ZThn8_N3NSB6ClassDD1Ev@Base on -32bit architectures will probably be _ZThn16_N3NSB6ClassDD1Ev@Base on 64bit -ones, it can be matched with a single \fIc++\fR pattern: -.RS -.PP -libdummy.so.1 libdummy1 #MINVER# - [...] - (c++)"non-virtual thunk to NSB::ClassD::~ClassD()@Base" 1.0 - [...] -.P -The demangled name above can be obtained by executing the following command: -.PP - $ echo '_ZThn8_N3NSB6ClassDD1Ev@Base' | c++filt -.P -Please note that while mangled name is unique in the library by definition, -this is not necessarily true for demangled names. A couple of distinct real -symbols may have the same demangled name. For example, that's the case with -non-virtual thunk symbols in complex inheritance configurations or with most -constructors and destructors (since g++ typically generates two real symbols -for them). However, as these collisions happen on the ABI level, they should -not degrade quality of the symbol file. -.RE -.TP -.B symver -This pattern is denoted by the \fIsymver\fR tag. Well maintained libraries have -versioned symbols where each version corresponds to the upstream version where -the symbol got added. If that's the case, you can use a \fIsymver\fR pattern to -match any symbol associated to the specific version. For example: -.RS -.PP -libc.so.6 libc6 #MINVER# - (symver)GLIBC_2.0 2.0 - [...] - (symver)GLIBC_2.7 2.7 - access@GLIBC_2.0 2.2 -.PP -All symbols associated with versions GLIBC_2.0 and GLIBC_2.7 will lead to -minimal version of 2.0 and 2.7 respectively with the exception of the symbol -access@GLIBC_2.0. The latter will lead to a minimal dependency on libc6 version -2.2 despite being in the scope of the "(symver)GLIBC_2.0" pattern because -specific symbols take precedence over patterns. -.P -Please note that while old style wildcard patterns (denoted by "*@version" in -the symbol name field) are still supported, they have been deprecated by new -style syntax "(symver|optional)version". For example, "*@GLIBC_2.0 2.0" should -be written as "(symver|optional)GLIBC_2.0 2.0" if the same behaviour is needed. -.RE -.TP -.B regex -Regular expression patterns are denoted by the \fIregex\fR tag. They match by -the perl regular expression specified in the symbol name field. A regular -expression is matched as it is, therefore do not forget to start it with the -\fI^\fR character or it may match any part of the real symbol -\fIname@version\fR string. For example: -.RS -.PP -libdummy.so.1 libdummy1 #MINVER# - (regex)"^mystack_.*@Base$" 1.0 - (regex|optional)"private" 1.0 -.P -Symbols like "mystack_new@Base", "mystack_push@Base", "mystack_pop@Base" etc. -will be matched by the first pattern while e.g. "ng_mystack_new@Base" won't. -The second pattern will match all symbols having the string "private" in their -names and matches will inherit \fIoptional\fR tag from the pattern. -.RE -.P -Basic patterns listed above can be combined where it makes sense. In that case, -they are processed in the order in which the tags are specified. For example, -both -.PP - (c++|regex)"^NSA::ClassA::Private::privmethod\\d\\(int\\)@Base" 1.0 - (regex|c++)N3NSA6ClassA7Private11privmethod\\dEi@Base 1.0 -.P -will match symbols "_ZN3NSA6ClassA7Private11privmethod1Ei@Base" and -"_ZN3NSA6ClassA7Private11privmethod2Ei@Base". When matching the first pattern, -the raw symbol is first demangled as C++ symbol, then the demangled name is -matched against the regular expression. On the other hand, when matching the -second pattern, regular expression is matched against the raw symbol name, then -the symbol is tested if it is C++ one by attempting to demangle it. A failure -of any basic pattern will result in the failure of the whole pattern. -Therefore, for example, "__N3NSA6ClassA7Private11privmethod\\dEi@Base" will not -match either of the patterns because it is not a valid C++ symbol. -.P -In general, all patterns are divided into two groups: aliases (basic \fIc++\fR -and \fIsymver\fR) and generic patterns (\fIregex\fR, all combinations of -multiple basic patterns). Matching of basic alias-based patterns is fast (O(1)) -while generic patterns are O(N) (N - generic pattern count) for each symbol. -Therefore, it is recommended not to overuse generic patterns. -.P -When multiple patterns match the same real symbol, aliases (first \fIc++\fR, -then \fIsymver\fR) are preferred over generic patterns. Generic patterns are -matched in the order they are found in the symbol file template until the first -success. Please note, however, that manual reordering of template file entries -is not recommended because \fBdpkg-gensymbols\fR generates diffs based on the -alphanumerical order of their names. -.SS Using includes -.P -When the set of exported symbols differ between architectures, it may become -inefficient to use a single symbol file. In those cases, an include directive -may prove to be useful in a couple of ways: -.IP \(bu 4 -You can factorize the common part in some external file -and include that file in your \fIpackage\fR.symbols.\fIarch\fR file by -using an include directive like this: - -#include "\fIpackages\fR.symbols.common" -.IP \(bu -The include directive may also be tagged like any symbol: - -(tag|..|tagN)#include "file_to_include" - -As a result, all symbols included from \fIfile_to_include\fR will be considered -to be tagged with \fItag\fR .. \fItagN\fR by default. You can use this feature -to create a common \fIpackage\fR.symbols file which includes architecture -specific symbol files: - - common_symbol1@Base 1.0 - (arch=amd64 ia64 alpha)#include "package.symbols.64bit" - (arch=!amd64 !ia64 !alpha)#include "package.symbols.32bit" - common_symbol2@Base 1.0 -.P -The symbols files are read line by line, and include directives are processed -as soon as they are encountered. This means that 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. Any symbol (or even another #include directive) in the included -file can specify additional tags or override values of the inherited tags in -its tag specification. However, there is no way for the symbol to remove -any of the inherited tags. -.P -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" - arch_specific_symbol@Base 1.0 -.SS Good library management -.P -A well-maintained library has the following features: -.IP \(bu 4 -its API is stable (public symbols are never dropped, only new public -symbols are added) and changes in incompatible ways only when the SONAME -changes; -.IP \(bu 4 -ideally, it uses symbol versioning to achieve ABI stability despite -internal changes and API extension; -.IP \(bu 4 -it doesn't export private symbols (such symbols can be tagged optional as -workaround). -.P -While maintaining the symbols file, it's easy to notice appearance and -disappearance of symbols. But it's more difficult to catch incompatible -API and ABI change. Thus the maintainer should read thoroughly the -upstream changelog looking for cases where the rules of good library -management have been broken. If potential problems are discovered, -the upstream author should be notified as an upstream fix is always better -than a Debian specific work-around. -.SH OPTIONS -.TP -.BI \-P package-build-dir -Scan \fIpackage-build-dir\fR instead of debian/tmp. -.TP -.BI \-p package -Define the package name. Required if more than one binary package is listed in -debian/control (or if there's no debian/control file). -.TP -.BI \-v version -Define the package version. Defaults to the version extracted from -debian/changelog. Required if called outside of a source package tree. -.TP -.BI \-e library-file -Only analyze libraries explicitly listed instead of finding all public -libraries. You can use a regular expression in \fIlibrary-file\fR to match -multiple libraries with a single argument (otherwise you need multiple -\fB\-e\fR). -.TP -.BI \-I filename -Use \fIfilename\fR as reference file to generate the symbols file -that is integrated in the package itself. -.TP -.B \-O -Print the generated symbols file to standard output, rather than being -stored in the package build tree. -.TP -.BI \-O filename -Store the generated symbols file as \fIfilename\fR. If \fIfilename\fR is -pre-existing, its content is used as basis for the generated symbols file. -You can use this feature to update a symbols file so that it matches a -newer upstream version of your library. -.TP -.BI \-t -Write the symbol file in template mode rather than the format compatible with -\fIdeb\-symbols(5)\fR. The main difference is that in the template mode symbol -names and tags are written in their original form contrary to the -post-processed symbol names with tags stripped in the compatibility mode. -Moreover, some symbols might be omitted when writing a standard -\fIdeb\-symbols(5)\fR file (according to the tag processing rules) while all -symbols are always written to the symbol file template. -.TP -.BI \-c [0-4] -Define the checks to do when comparing the generated symbols file with the -template file used as starting point. By default the level is 1. Increasing -levels do more checks and include all checks of lower levels. Level 0 never -fails. Level 1 fails if some symbols have disappeared. Level 2 fails if some -new symbols have been introduced. Level 3 fails if some libraries have -disappeared. Level 4 fails if some libraries have been introduced. - -This value can be overridden by the environment variable -DPKG_GENSYMBOLS_CHECK_LEVEL. -.TP -.BI \-q -Keep quiet and never generate a diff between generated symbols file and the -template file used as starting point or show any warnings about new/lost -libraries or new/lost symbols. This option only disables informational output -but not the checks themselves (see \fI\-c\fR option). -.TP -.BI \-a arch -Assume \fIarch\fR as host architecture when processing symbol files. Use this -option to generate a symbol file or diff for any architecture provided its -binaries are already available. -.TP -.BI \-d -Enable debug mode. Numerous messages are displayed to explain what -.B dpkg\-gensymbols -does. -.TP -.BI \-V -Enable verbose mode. The generated symbols file contains deprecated -symbols as comments. Furthermore in template mode, pattern symbols -are followed by comments listing real symbols that have matched the -pattern. -.TP -.BR \-h ", " \-\-help -Show the usage message and exit. -.TP -.BR \-\-version -Show the version and exit. -. -.SH "SEE ALSO" -.BR http://people.redhat.com/drepper/symbol-versioning -.br -.BR http://people.redhat.com/drepper/goodpractice.pdf -.br -.BR http://people.redhat.com/drepper/dsohowto.pdf -.br -.BR deb\-symbols (5), -.BR dpkg\-shlibdeps (1). -. -.SH AUTHORS -Copyright \(co 2007-2009 Rapha\[:e]l Hertzog -.sp -This is free software; see the GNU General Public Licence version 2 or later -for copying conditions. There is NO WARRANTY. diff --git a/perllib/Debian/PkgKde.pm b/perllib/Debian/PkgKde.pm index 8ab7795..2f8b974 100644 --- a/perllib/Debian/PkgKde.pm +++ b/perllib/Debian/PkgKde.pm @@ -68,7 +68,7 @@ sub setup_datalibdir { } sub find_exe_in_path { - my $exe = (@_); + my ($exe) = @_; if (File::Spec->file_name_is_absolute($exe)) { return $exe; } elsif ($ENV{PATH}) { diff --git a/pkgkde-gensymbols b/pkgkde-gensymbols index b2c1250..fd3768d 100755 --- a/pkgkde-gensymbols +++ b/pkgkde-gensymbols @@ -19,7 +19,7 @@ use strict; use warnings; use Dpkg; -use Debian::PkgKde qw(setup_datalibdir); +use Debian::PkgKde qw(setup_datalibdir find_exe_in_path); my $old_symbolfile_parse; @@ -52,12 +52,16 @@ sub check_dpkg_version { return $ok; } -if (check_dpkg_version(1, 15, 5)) { +if (check_dpkg_version(1, 15, 6)) { # Export global datalibdir if needed - my $dir = setup_datalibdir(qw(Dpkg/Shlibs/SymbolFile.pm dpkg-gensymbols.pl)); + my $dir = setup_datalibdir(qw(Dpkg/Shlibs/SymbolFile.pm)); if (defined $dir) { # Finally, run stock dpkg-gensymbols - my $exe = "$dir/dpkg-gensymbols.pl"; + my $exe = find_exe_in_path("dpkg-gensymbols"); + unless ($exe) { + print STDERR "pkgkde-gensymbols: dpkg-gensymbols could not be found in PATH", "\n"; + exit 1; + } eval "use Dpkg::Shlibs::SymbolFile"; eval "use Debian::PkgKde::SymbolsHelper::Symbol"; |