/usr/bin/dh_ppp is in ppp-dev 2.4.7-2+2ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | #!/usr/bin/perl -w
=head1 NAME
dh_ppp - calculate ppp dependencies
=cut
use strict;
use warnings;
use Debian::Debhelper::Dh_Lib;
use Dpkg::Shlibs::Objdump;
use File::Find;
=head1 SYNOPSIS
B<dh_ppp> [S<I<debhelper options>>] [B<--breaks>] [B<--force>] [B<--plugin-dir>]
=head1 DESCRIPTION
B<dh_ppp> is a debhelper program that adds appropriate ppp dependencies on
packages that build pppd plugins.
By default, some entries are added to B<misc:Depends> that ensure that
packages which contain plugins that are loaded into pppd depend on an
appropriate version of the ppp package.
You may prefer to use a B<Breaks> relationship instead, for example if your
package supplies a pppd plugin but does not require it for normal operation. In
that case you should supply the B<--breaks> option and B<misc:Breaks> will be
populated instead of B<misc:Depends>.
Substvars entries are only added if a pppd plugin is detected in the build
products, unless B<--force> is specified. Plugins are detected by searching a
package's build products for libraries with a symbol named B<plugin_init>.
A warning is emitted if a plugin is found that does not also contain a
B<pppd_version> symbol.
Please note there is a B<dh> addon named B<ppp> which can be used to
automatically invoke B<dh_ppp> for you.
=head1 FILES
=over 4
=item /usr/share/ppp-dev/substvars
Template substitution variables. The values in this file are used when
populating the B<misc:Depends> or B<misc:Breaks> substition variables, or they
may be manually copied into a package's substvars if one wishes not to use
B<dh_ppp>.
=back
=head1 OPTIONS
=over 4
=item B<--breaks>
Rather than populating B<misc:Depends> to ensure an appropriate version of
B<ppp> is used, populate B<misc:Breaks> such that a inappropriate version of
B<ppp> may not be used.
=item B<--force>
Do not try to detect pppd plugins in the package, and always assume that a
plugin is present. This will cause B<misc:Depends> (or B<misc:Breaks>) to
always be populated.
=item B<--plugin-dir>
Simply outputs the path to the pppd plugins directory for the current ABI
version. When this flag is specified, B<dh_ppp> makes no attempt to detect any
plugins nor does it update any substitution variables.
=back
=head1 NOTES
Note that this command is not idempotent. L<dh_prep(1)> should be called
between invocations of this command (with the same arguments). Otherwise, it
may cause multiple instances of the same text to be added to the substition
variables.
Note that B<dh_ppp> should be run before B<dh_gencontrol>. The B<ppp> sequence
addon for B<dh> does the right thing, this note is only relevant when you are
calling B<dh_ppp> manually.
=cut
init(options => {
"breaks" => \$dh{BREAKS},
"force" => \$dh{FORCE},
"plugin-dir" => \$dh{PLUGIN_DIR},
});
sub detect_plugins {
my $package = shift;
my $tmpdir = tmpdir($package);
my @shared_objects;
my @plugins;
find({
wanted => sub {
my $name = $File::Find::name;
return unless -f $name;
return unless $name =~ m,^$tmpdir/usr/lib/.*\.so$,;
push @shared_objects, $name;
},
no_chdir => 1,
}, $tmpdir);
my $od = new Dpkg::Shlibs::Objdump();
for my $so (@shared_objects) {
verbose_print("Scanning $so for symbol information");
my $objid = $od->analyze($so);
unless (defined($objid) && $objid) {
warning("Dpkg::Shlibs::Objdump couldn't parse $so");
next;
}
my $object = $od->get_object($objid);
my $init = $object->get_symbol("plugin_init");
if (!defined($init)) {
verbose_print("File $so does not look like a pppd " .
"plugin. Ignoring.");
next;
}
push @plugins, $so;
my $ver = $object->get_symbol("pppd_version");
if (!defined($ver)) {
warning("File $so looks like a pppd plugin but " .
"lacks a pppd_version symbol!");
}
}
return @plugins;
}
my %substvars;
sub load_substvars {
return if %substvars;
open(VARS, '<', '/usr/share/ppp-dev/substvars') or
error("Failed to load template substvars");
while (<VARS>) {
chomp;
my ($var, $value) = split /=/, $_, 2;
my @pkgs = split /, /, $value;
$substvars{$var} = \@pkgs;
}
close(VARS);
for my $var (qw(ppp:Depends ppp:Breaks)) {
error("$var not defined in substvars template")
unless defined($substvars{$var});
}
}
if ($dh{PLUGIN_DIR}) {
inhibit_log();
load_substvars();
print join(', ', @{$substvars{'ppp:PluginDir'}}) . "\n";
exit 0;
}
foreach my $package (@{$dh{DOPACKAGES}}) {
next unless $dh{FORCE} or detect_plugins($package);
load_substvars();
my $var = $dh{BREAKS} ? 'Breaks' : 'Depends';
for my $pkg (@{$substvars{"ppp:$var"}}) {
addsubstvar($package, "misc:$var", $pkg);
}
}
=head1 SEE ALSO
L<debhelper(7)>
=head1 AUTHORS
Chris Boot <bootc@debian.org>
=cut
|