1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
#!/usr/bin/perl
# Copyright (C) 2010 Modestas Vainius <modax@debian.org>
#
# 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 3 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 Debian::PkgKde qw(setup_datalibdir);
my $old_symbolfile_parse;
sub new_symbolfile_parse {
# Use Debian::PkgKde::SymbolsHelper::Symbol as base symbol
my ($self, $fh, $file, $seen, $obj_ref, $base_symbol) = @_;
unless (defined $base_symbol) {
$base_symbol = 'Debian::PkgKde::SymbolsHelper::Symbol';
}
return &$old_symbolfile_parse($self, $fh, $file, $seen, $obj_ref,
$base_symbol);
}
sub check_dpkg_version {
my @need = @_;
my @ver = split(/[.]/, $Dpkg::version);
my $ok = 0;
for (my $i = 0; ! $ok && $i < @need && $i < @ver; $i++) {
if ($ver[$i] > $need[$i]) {
$ok = 1;
} elsif ($ver[$i] == $need[$i]) {
if ($i == $#need) {
$ok = 1;
}
} else {
# Less
last;
}
}
return $ok;
}
if (check_dpkg_version(1, 15, 5)) {
# Export global datalibdir if needed
my $dir = setup_datalibdir(qw(Dpkg/Shlibs/SymbolFile.pm dpkg-gensymbols.pl));
if (defined $dir) {
# Finally, run stock dpkg-gensymbols
my $exe = "$dir/dpkg-gensymbols.pl";
eval "use Dpkg::Shlibs::SymbolFile";
eval "use Debian::PkgKde::SymbolsHelper::Symbol";
# Replace Dpkg::Shlibs::SymbolFile::load with a custom version
# which uses Debian::PkgKde::SymbolsHelper::Symbol rather than
# Dpkg::Shlibs::Symbol
$old_symbolfile_parse = *Dpkg::Shlibs::SymbolFile::parse;
*Dpkg::Shlibs::SymbolFile::parse = *new_symbolfile_parse;
do "$exe";
} else {
print STDERR "pkgkde-gensymbols: unable to determine execution context.", "\n";
exit 1;
}
} else {
exec '/usr/bin/dpkg-gensymbols', @ARGV;
}
|