/usr/bin/dh_di_numbers is in dh-di 8.
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 | #!/usr/bin/perl -w
=head1 NAME
dh_di_numbers - install numbered scripts into package build directories
=cut
use strict;
use Debian::Debhelper::Dh_Lib;
=head1 SYNOPSIS
B<dh_di_numbers> [S<B<debhelper options>>] [S<I<dir [...] dest>>]
=head1 DESCRIPTION
dh_di_numbers is a debhelper program that installs directories of numbered
scripts into package build directories.
Within each directory, there should be a C<_numbers> file in which each line
contains at least two space-separated fields. The first field in each line
is a two-digit number, which will be prefixed to the entry name to provide
ordering within the directory; the second is the entry name, which must
correspond to a file or directory alongside the C<_numbers> file; and the
third field, if present, is another two-digit number which identifies
another entry with the same entry name to which this entry should be a
symlink.
Any additional directory names specified as parameters will be installed in
the package build directory of the first package dh_di_numbers is told to
act on. By default, this is the first binary package in debian/control, but
if you use -p, -i, or -a flags, it will be the first package specified by
those flags.
=head1 FILES
=over 4
=item debian/I<package>.di-numbers
List the directories to install into each package and the directory they
should be installed to. The format is a set of lines, where each line lists
a directory or directories to install, and at the end of the line tells the
directory they should be installed in. The name of the directories to
install should be given relative to the current directory, while the
installation directory is given relative to the package build directory. You
may use wildcards in the names of the files to install (in v3 mode and
above).
=back
=head1 OPTIONS
=over 4
=item I<dir [...] dest>
Lists directories to install and where to install them to. The files will be
installed into the first package dh_di_numbers acts on.
=back
=cut
sub install_dir {
my $tmp = shift;
my $dir = shift;
my $dest = shift;
$dest = "$tmp/$dest/" . basename($dir);
doit("install", "-d", $dest);
my %numbers;
my %links;
local (*NUMBERS, $_);
if (open NUMBERS, "$dir/_numbers") {
while (<NUMBERS>) {
my @fields = split;
if (@fields < 2) {
next;
} elsif (@fields == 2) {
push @{$numbers{$fields[1]}}, $fields[0];
} else {
push @{$links{$fields[1]}}, [@fields[0, 2]];
}
}
}
close NUMBERS;
foreach my $file (glob("$dir/*")) {
my $base = basename($file);
next if $base eq "_numbers";
if (exists $numbers{$base}) {
for my $number (@{$numbers{$base}}) {
doit("cp", "-r", $file,
"$dest/$number$base");
}
} else {
doit("cp", "-r", $file, "$dest/$base");
}
if (exists $links{$base}) {
for my $linkpair (@{$links{$base}}) {
my ($link, $target) = @$linkpair;
doit("ln", "-s", "$target$base",
"$dest/$link$base");
}
}
}
}
init();
# PROMISE: DH NOOP WITHOUT di-numbers
foreach my $package (@{$dh{DOPACKAGES}}) {
my $tmp = tmpdir($package);
my $file = pkgfile($package,"di-numbers");
my @di_numbers;
if ($file) {
@di_numbers = filedoublearray($file, '.');
}
if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
push @di_numbers, [@ARGV];
}
foreach my $set (@di_numbers) {
if (@$set <= 1) {
error("$file or parameters lists a directory without a destination.");
}
my $dest = pop @$set;
foreach my $src (@$set) {
if (-d $src) {
install_dir($tmp, $src, $dest);
}
}
}
}
=head1 SEE ALSO
L<debhelper(7)>
This program is a part of dh-di.
=head1 AUTHOR
Colin Watson <cjwatson@debian.org>
=cut
|