The following commit has been merged in the master branch:
commit 2294cc63c0cae9fa95a2908b455c770d9c3feb40
Author: Modestas Vainius <[email protected]>
Date:   Sat Jan 23 18:55:54 2010 +0200

    Dpkg::Shlibs::SymbolFile::get_new_symbols(): add option to return optional 
symbols.
    
    Also includes a bit of refactoring for relevant Dpkg::Shlibs::Symbol bits.
    is_eligible_as_new() was renamed to is_legitimate() and its usage in
    get_new_symbols() was expanded.

diff --git a/scripts/Dpkg/Shlibs/Symbol.pm b/scripts/Dpkg/Shlibs/Symbol.pm
index 2d27202..c3ef562 100644
--- a/scripts/Dpkg/Shlibs/Symbol.pm
+++ b/scripts/Dpkg/Shlibs/Symbol.pm
@@ -453,12 +453,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/scripts/Dpkg/Shlibs/SymbolFile.pm 
b/scripts/Dpkg/Shlibs/SymbolFile.pm
index cf3443c..436e78d 100644
--- a/scripts/Dpkg/Shlibs/SymbolFile.pm
+++ b/scripts/Dpkg/Shlibs/SymbolFile.pm
@@ -531,7 +531,9 @@ sub get_soname_patterns {
 }
 
 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 +542,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 +567,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 +585,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);
 }
 
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to