[SCM] Debian Qt/KDE packaging tools branch, master, updated. debian/0.5.3-53-gbac2493

Modestas Vainius modax at alioth.debian.org
Fri Jan 29 23:51:17 UTC 2010


The following commit has been merged in the master branch:
commit 600491a64e18b2e5b5bb708382dd59edd006730f
Author: Modestas Vainius <modestas at vainius.eu>
Date:   Fri Jan 29 20:15:04 2010 +0200

    Update Dpkg/Shlibs/ to the latest version.
---
 symbolshelper/Dpkg/Shlibs/Cppfilt.pm    |    9 ++++-
 symbolshelper/Dpkg/Shlibs/Symbol.pm     |   59 +++++++++++++++++++-----------
 symbolshelper/Dpkg/Shlibs/SymbolFile.pm |   56 ++++++++++++++--------------
 symbolshelper/dpkg-gensymbols.1         |    5 +++
 symbolshelper/dpkg-gensymbols.pl        |    8 +++-
 5 files changed, 83 insertions(+), 54 deletions(-)

diff --git a/symbolshelper/Dpkg/Shlibs/Cppfilt.pm b/symbolshelper/Dpkg/Shlibs/Cppfilt.pm
index c2cfdae..2dfcb4f 100644
--- a/symbolshelper/Dpkg/Shlibs/Cppfilt.pm
+++ b/symbolshelper/Dpkg/Shlibs/Cppfilt.pm
@@ -23,7 +23,8 @@ use Dpkg::ErrorHandling;
 use Dpkg::IPC;
 use IO::Handle;
 
-our @EXPORT = qw(cppfilt_demangle);
+our @EXPORT = qw(cppfilt_demangle_cpp);
+our @EXPORT_OK = qw(cppfilt_demangle);
 
 # A hash of 'objects' referring to preforked c++filt processes for the distinct
 # demangling types.
@@ -41,7 +42,6 @@ sub get_cppfilt {
 	$filt = { from => undef, to => undef,
 	            last_symbol => "", last_result => "" };
 	$filt->{pid} = fork_and_exec(exec => [ 'c++filt',
-	                                       '--no-verbose',
 	                                       "--format=$type" ],
 	                             from_pipe => \$filt->{from},
 	                             to_pipe => \$filt->{to});
@@ -82,6 +82,11 @@ sub cppfilt_demangle {
     return $filt->{last_result};
 }
 
+sub cppfilt_demangle_cpp {
+    my $symbol = shift;
+    return cppfilt_demangle($symbol, 'auto');
+}
+
 sub terminate_cppfilts {
     foreach (keys %cppfilts) {
 	next if not defined $cppfilts{$_}{pid};
diff --git a/symbolshelper/Dpkg/Shlibs/Symbol.pm b/symbolshelper/Dpkg/Shlibs/Symbol.pm
index 2964f1d..337e498 100644
--- a/symbolshelper/Dpkg/Shlibs/Symbol.pm
+++ b/symbolshelper/Dpkg/Shlibs/Symbol.pm
@@ -70,7 +70,7 @@ sub dclone {
 sub parse_tagspec {
     my ($self, $tagspec) = @_;
 
-    if ($tagspec =~ /^\((.*?)\)(.*)$/ && $1) {
+    if ($tagspec =~ /^\s*\((.*?)\)(.*)$/ && $1) {
 	# (tag1=t1 value|tag2|...|tagN=tNp)
 	# Symbols ()|= cannot appear in the tag names and values
 	my $tagspec = $1;
@@ -197,11 +197,18 @@ sub get_symboltempl {
 }
 
 sub set_symbolname {
-    my ($self, $name, $quoted) = @_;
-    if (defined $name) {
-	$self->{symbol} = $name;
+    my ($self, $name, $templ, $quoted) = @_;
+    unless (defined $name) {
+	$name = $self->{symbol};
     }
-    $self->{symbol_templ} = undef;
+    if (!defined $templ && $name =~ /\s/) {
+	$templ = $name;
+    }
+    if (!defined $quoted && defined $templ && $templ =~ /\s/) {
+	$quoted = '"';
+    }
+    $self->{symbol} = $name;
+    $self->{symbol_templ} = $templ;
     if ($quoted) {
 	$self->{symbol_quoted} = $quoted;
     } else {
@@ -246,23 +253,32 @@ sub get_tag_value {
     return $self->{tags}{$tag};
 }
 
-# Checks if the symbol is equal to another one (by name and tag set)
+# Checks if the symbol is equal to another one (by name and optionally,
+# tag sets, versioning info (minver and depid))
 sub equals {
-    my ($self, $other) = @_;
+    my ($self, $other, %opts) = @_;
 
-    # Compare names and tag sets
     return 0 if $self->{symbol} ne $other->{symbol};
-    return 0 if scalar(@{$self->{tagorder}}) != scalar(@{$other->{tagorder}});
-
-    for (my $i = 0; $i < scalar(@{$self->{tagorder}}); $i++) {
-	my $tag = $self->{tagorder}->[$i];
-	return 0 if $tag ne $other->{tagorder}->[$i];
-	if (defined $self->{tags}{$tag} && defined $other->{tags}{$tag}) {
-	    return 0 if $self->{tags}{$tag} ne defined $other->{tags}{$tag};
-	} elsif (defined $self->{tags}{$tag} || defined $other->{tags}{$tag}) {
-	    return 0;
+
+    if (!exists $opts{versioning} || $opts{versioning}) {
+	return 0 if $self->{minver} ne $other->{minver};
+	return 0 if $self->{dep_id} ne $other->{dep_id};
+    }
+
+    if  (!exists $opts{tags} || $opts{tags}) {
+	return 0 if scalar(@{$self->{tagorder}}) != scalar(@{$other->{tagorder}});
+
+	for (my $i = 0; $i < scalar(@{$self->{tagorder}}); $i++) {
+	    my $tag = $self->{tagorder}->[$i];
+	    return 0 if $tag ne $other->{tagorder}->[$i];
+	    if (defined $self->{tags}{$tag} && defined $other->{tags}{$tag}) {
+		return 0 if $self->{tags}{$tag} ne defined $other->{tags}{$tag};
+	    } elsif (defined $self->{tags}{$tag} || defined $other->{tags}{$tag}) {
+		return 0;
+	    }
 	}
     }
+
     return 1;
 }
 
@@ -365,7 +381,7 @@ sub convert_to_alias {
 	    # rawname.
 	    return "$1" if ($rawname =~ /\@([^@]+)$/);
 	} elsif ($rawname =~ /^_Z/ && $type eq "c++") {
-	    return cppfilt_demangle($rawname, "auto");
+	    return cppfilt_demangle_cpp($rawname);
 	}
     }
     return undef;
@@ -453,12 +469,11 @@ sub mark_not_found_in_library {
     }
 }
 
-# Quickly checks if the symbol (or pattern) can be considered as new due to its
-# status or current environment settings.
-sub is_eligible_as_new {
+# Checks if the symbol (or pattern) is legitimate as a real symbol for the
+# specified architecture.
+sub is_legitimate {
     my ($self, $arch) = @_;
     return ! $self->{deprecated} &&
-           ! $self->is_optional() &&
            $self->arch_is_concerned($arch);
 }
 
diff --git a/symbolshelper/Dpkg/Shlibs/SymbolFile.pm b/symbolshelper/Dpkg/Shlibs/SymbolFile.pm
index 2105ffe..4a1dc7e 100644
--- a/symbolshelper/Dpkg/Shlibs/SymbolFile.pm
+++ b/symbolshelper/Dpkg/Shlibs/SymbolFile.pm
@@ -80,7 +80,7 @@ sub new {
     my $class = ref($this) || $this;
     my $self = \%opts;
     bless $self, $class;
-    $self->{arch} = get_host_arch() unless exists $self->{arch};
+    $self->{arch} = get_host_arch() unless defined $self->{arch};
     $self->clear();
     if (exists $self->{file}) {
 	$self->load($self->{file}) if -e $self->{file};
@@ -123,14 +123,9 @@ sub add_symbol {
 	    unless (exists $object->{patterns}{aliases}{$alias_type}) {
 		$object->{patterns}{aliases}{$alias_type} = {};
 	    }
-	    my $aliases = $object->{patterns}{aliases}{$alias_type};
-	    # A converter object for transforming a raw symbol name to alias
-	    # of this type. Must support convert_to_alias() method.
-	    unless (exists $aliases->{converter}) {
-		$aliases->{converter} = $symbol;
-	    }
 	    # Alias hash for matching.
-	    $aliases->{names}{$symbol->get_symbolname()} = $symbol;
+	    my $aliases = $object->{patterns}{aliases}{$alias_type};
+	    $aliases->{$symbol->get_symbolname()} = $symbol;
 	} else {
 	    # Otherwise assume this is a generic sequential pattern. This
 	    # should be always safe.
@@ -315,11 +310,12 @@ sub find_matching_pattern {
 
 	my $all_aliases = $obj->{patterns}{aliases};
 	for my $type (Dpkg::Shlibs::Symbol::ALIAS_TYPES) {
-	    if (exists $all_aliases->{$type}) {
+	    if (exists $all_aliases->{$type} && keys(%{$all_aliases->{$type}})) {
 		my $aliases = $all_aliases->{$type};
-		if (my $alias = $aliases->{converter}->convert_to_alias($name)) {
-		    if ($alias && exists $aliases->{names}{$alias}) {
-			$pattern = $aliases->{names}{$alias};
+		my $converter = $aliases->{(keys %$aliases)[0]};
+		if (my $alias = $converter->convert_to_alias($name)) {
+		    if ($alias && exists $aliases->{$alias}) {
+			$pattern = $aliases->{$alias};
 			last if &$pattern_ok($pattern);
 			$pattern = undef; # otherwise not found yet
 		    }
@@ -500,11 +496,13 @@ sub lookup_pattern {
 
 	next unless defined $object;
 	if (my $type = $refpat->get_alias_type()) {
-	    $pat = $object->{patterns}{aliases}{$type}{names}{$refpat->get_symbolname()};
+	    if (exists $object->{patterns}{aliases}{$type}) {
+		$pat = $object->{patterns}{aliases}{$type}{$refpat->get_symbolname()};
+	    }
 	} elsif ($refpat->get_pattern_type() eq "generic") {
 	    for my $p (@{$object->{patterns}{generic}}) {
 		if (($inc_deprecated || !$p->{deprecated}) &&
-		    $p->equals($refpat))
+		    $p->equals($refpat, versioning => 0))
 		{
 		    $pat = $p;
 		    last;
@@ -525,13 +523,15 @@ sub get_soname_patterns {
     my @aliases;
 
     foreach my $alias (values %{$object->{patterns}{aliases}}) {
-	push @aliases, values %{$alias->{names}};
+	push @aliases, values %$alias;
     }
     return (@aliases, @{$object->{patterns}{generic}});
 }
 
 sub get_new_symbols {
-    my ($self, $ref) = @_;
+    my ($self, $ref, %opts) = @_;
+    my $with_optional = (exists $opts{with_optional}) ?
+	$opts{with_optional} : 0;
     my @res;
     foreach my $soname (keys %{$self->{objects}}) {
 	my $mysyms = $self->{objects}{$soname}{syms};
@@ -540,17 +540,16 @@ sub get_new_symbols {
 	my @soname = ( $soname );
 
 	# Scan raw symbols first.
-	foreach my $sym (grep { $_->is_eligible_as_new($self->{arch}) }
+	foreach my $sym (grep { ($with_optional || ! $_->is_optional())
+	                        && $_->is_legitimate($self->{arch}) }
 	                      values %$mysyms)
 	{
 	    my $refsym = $refsyms->{$sym->get_symbolname()};
 	    my $isnew;
 	    if (defined $refsym) {
-		# If the symbol exists in the reference symbol file, it might
-		# still be new if it is either deprecated or from foreign arch
-		# there.
-		$isnew = ($refsym->{deprecated} or
-		    not $refsym->arch_is_concerned($self->{arch}));
+		# If the symbol exists in the $ref symbol file, it might
+		# still be new if $refsym is not legitimate.
+		$isnew = not $refsym->is_legitimate($self->{arch});
 	    } else {
 		# If the symbol does not exist in the $ref symbol file, it does
 		# not mean that it's new. It might still match a pattern in the
@@ -566,14 +565,15 @@ sub get_new_symbols {
 	}
 
 	# Now scan patterns
-	foreach my $p (grep { $_->is_eligible_as_new($self->{arch}) }
+	foreach my $p (grep { ($with_optional || ! $_->is_optional())
+	                      && $_->is_legitimate($self->{arch}) }
 	                    $self->get_soname_patterns($soname))
 	{
 	    my $refpat = $ref->lookup_pattern($p, \@soname, 0);
-	    # If reference pattern was not found or it is deprecated or
-	    # it's from foreign arch, considering current one as new.
+	    # If reference pattern was not found or it is not legitimate,
+	    # considering current one as new.
 	    if (not defined $refpat or
-		not $refpat->arch_is_concerned($self->{arch}))
+	        not $refpat->is_legitimate($self->{arch}))
 	    {
 		push @res, $p->sclone(soname => $soname);
 	    }
@@ -583,8 +583,8 @@ sub get_new_symbols {
 }
 
 sub get_lost_symbols {
-    my ($self, $ref) = @_;
-    return $ref->get_new_symbols($self);
+    my ($self, $ref, %opts) = @_;
+    return $ref->get_new_symbols($self, %opts);
 }
 
 
diff --git a/symbolshelper/dpkg-gensymbols.1 b/symbolshelper/dpkg-gensymbols.1
index 0721d4e..a527c5d 100644
--- a/symbolshelper/dpkg-gensymbols.1
+++ b/symbolshelper/dpkg-gensymbols.1
@@ -415,6 +415,11 @@ libraries have been introduced.
 This value can be overridden by the environment variable
 DPKG_GENSYMBOLS_CHECK_LEVEL.
 .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
diff --git a/symbolshelper/dpkg-gensymbols.pl b/symbolshelper/dpkg-gensymbols.pl
index 48eacdc..98bdfff 100755
--- a/symbolshelper/dpkg-gensymbols.pl
+++ b/symbolshelper/dpkg-gensymbols.pl
@@ -82,6 +82,8 @@ Options:
   -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.
@@ -121,6 +123,8 @@ while (@ARGV) {
 	$template_mode = 1;
     } elsif (m/^-V$/) {
 	$verbose_output = 1;
+    } elsif (m/^-a(.+)$/) {
+	$host_arch = $1;
     } elsif (m/^-(h|-help)$/) {
 	usage();
 	exit(0);
@@ -280,9 +284,9 @@ if ($compare) {
 		    $output);
 	}
 	my ($a, $b) = ($before->filename, $after->filename);
-	my $diff_label = sprintf("%s (%s %s)",
+	my $diff_label = sprintf("%s (%s_%s_%s)",
 	($ref_symfile->{file}) ? $ref_symfile->{file} : "new_symbol_file",
-	$oppackage, $host_arch);
+	$oppackage, $sourceversion, $host_arch);
 	system("diff", "-u", "-L", $diff_label, $a, $b) if -x "/usr/bin/diff";
     }
 }

-- 
Debian Qt/KDE packaging tools



More information about the pkg-kde-commits mailing list