From 2c9ec8dcf5a6e58d92750a8ae19d202f86aa868d Mon Sep 17 00:00:00 2001 From: Raphael Hertzog Date: Tue, 25 Sep 2007 20:06:37 +0200 Subject: [PATCH] Extend SymbolFile API to be able to dump it while leaving deprecated symbols out --- scripts/Dpkg/Shlibs/SymbolFile.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/Dpkg/Shlibs/SymbolFile.pm b/scripts/Dpkg/Shlibs/SymbolFile.pm index 6489bd16..64448a1d 100644 --- a/scripts/Dpkg/Shlibs/SymbolFile.pm +++ b/scripts/Dpkg/Shlibs/SymbolFile.pm @@ -151,7 +151,7 @@ sub load { } sub save { - my ($self, $file) = @_; + my ($self, $file, $with_deprecated) = @_; $file = $self->{file} unless defined($file); my $fh; if ($file eq "-") { @@ -160,17 +160,19 @@ sub save { open($fh, ">", $file) || syserr(sprintf(_g("Can't open %s for writing: %s"), $file, $!)); } - $self->dump($fh); + $self->dump($fh, $with_deprecated); close($fh) if ($file ne "-"); } sub dump { - my ($self, $fh) = @_; + my ($self, $fh, $with_deprecated) = @_; + $with_deprecated = 1 unless defined($with_deprecated); foreach my $soname (sort keys %{$self->{objects}}) { print $fh "$soname $self->{objects}{$soname}{deps}[0]\n"; print $fh "| $_" foreach (@{$self->{objects}{$soname}{deps}}[ 1 .. -1 ]); foreach my $sym (sort keys %{$self->{objects}{$soname}{syms}}) { my $info = $self->{objects}{$soname}{syms}{$sym}; + next if $info->{deprecated} and not $with_deprecated; print $fh "#DEPRECATED: $info->{deprecated}#" if $info->{deprecated}; print $fh " $sym $info->{minver}"; print $fh " $info->{dep_id}" if $info->{dep_id}; -- 2.39.5