/usr/bin/dh_components is in pkg-components 0.6.
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 195 196 197 198 199 200 201 202 203 204 | #!/usr/bin/perl
use strict;
use warnings;
use Debian::Debhelper::Dh_Lib;
use Debian::Debhelper::Dh_components;
use Readonly;
use Cwd;
Readonly my $COMMA_RE => qr/,/;
Readonly my $CWD => getcwd;
init(options=>{
"purge!"=>\$dh{PURGE},
"components=s" => \$dh{COMPONENTS},
"build_stages=s" => \$dh{BUILD_STAGES},
"rules_locations=s" => \$dh{RULES_LOCATIONS},
});
# Work through the packages and components
foreach my $package (getpackages()) {
my $dir = find_components_dir($package);
next if !$dir;
my %args = (dir=>$dir, package=>$package);
if ($dh{BUILD_STAGES}) {
$args{build_stages} = [split $COMMA_RE, $dh{BUILD_STAGES}];
}
if ($dh{COMPONENTS}) {
$args{components} = [split $COMMA_RE, $dh{COMPONENTS}];
}
if ($dh{RULE_LOCATIONS}) {
$args{rules_locations} = [split $COMMA_RE, $dh{RULES_LOCATIONS}];
}
my $component_data = Debian::Debhelper::Dh_components->new(%args);
foreach my $c ($component_data->components) {
foreach my $bs ($component_data->build_stages) {
my $script = $component_data->script($c, $bs);
my $command = "CURDIR=$CWD PACKAGE=$package DH_COMPONENT=$c $script";
doit($command);
}
}
my $copyright_file = "$CWD/debian/$package.copyright";
if (not -f $copyright_file) {
verbose_print("Building $copyright_file");
$component_data->build_copyright($copyright_file);
}
foreach my $dependency ($component_data->substvars) {
my $var = "$dependency->{component}:$dependency->{substvar}";
my $verrel =
$dependency->{rel} ? "($dependency->{rel} $dependency->{ver})" : "";
my $deppackage = $dependency->{deppackage};
addsubstvar($package, $var, $deppackage, $verrel);
}
}
# Clean up the old components directory
if ($dh{PURGE} or not defined $dh{PURGE}) {
doit("rm -rf COMPONENTS");
}
exit(0);
sub find_components_dir {
my $package = shift;
my $dir = "debian/$package.components";
return $dir if -d $dir;
$dir = "debian/components";
return $dir if -d $dir && $package eq $dh{FIRSTPACKAGE};
return;
}
=head1 NAME
dh_components - build additional components
=head1 SYNOPSIS
B<dh_components> [S<I<debhelper options>>] [B<--components> I<comp>[,I<comp>,...]] [B<--build_stages> I<stage>[,I<stage>,...]] [B<--rules_locations> I<dir>[,I<dir>,...]]
=head1 DESCRIPTION
C<dh_components> is a debhelper program that is responsible for handling
additional components that come from separate upstream sources. The aim
is to turn each component into a "mini Debian package". It takes the
following actions:
=over
=item Run through the various build stages for each package and component.
=item Optionally stitch together the Debian copyright files.
=item Generate the C<substvar> file from the component control files.
=item Purge the components working directory (unless the I<--no-purge> option
is set).
=back
=head1 FILES
=over 4
=item debian/I<package>.components
=item debian/components
These directories contain all the component data for a given binary package.
The second form only works for the first binary in a source package and is
overridden by the equivalent first form.
=item debian/[I<package>.]components/I<component>
This is a directory that contains the files specific to that component.
In some ways it is like a cut-down version of the debian directory.
=item debian/[I<package>.]components/I<component>
=item debian/[I<package>.]components/
=item /usr/share/pkg-components/build_stages
These are the default locations of the build stage scripts in the order of
precedence with highest first. These can be overridden using the
C<--rules_locations>.
=item debian/[I<package>.]components/copyright.in
This file provides the DEP-5 copyright stanzas for the package but without
any of the component stanzas. It forms the basis for the I<package>.copyright
file.
=item debian/[I<package>.]components/I<component>/copyright
This file provides a DEP-5 fragment of the Debian copyright for this component.
It will be merged into the main copyright file at I<package>.copyright. Any
duplicate C<License> clauses will be shown only once.
=item debian/[I<package>.]components/I<component>/control
If present this file should look like a Debian control file for the component.
The package name of the binary stanza should match the component name.
The C<Depends>, C<Recommends>, C<Suggests>, C<Enhances>, C<Replaces>,
C<Pre-Depends>, C<Conflicts>, C<Breaks> fields are read and turned into
substitution variables. So if you have a component C<X> which declares a
Depends on C<Y>, then a substvar variable C<X:Depends> will be created with
the value C<Y>.
The source package stanza is ignored but can be used to document which
build dependencies are due to the component.
=back
=head1 OPTIONS
=over 4
=item B<--build_stages b1,b2,...>
If this option is listed the sequence described will be used instead
of the normal one.
=item B<--components c1,c2,...>
If this option is listed only those components listed will be considered.
=item B<--rules_locations r1,r2,...>
If this option is listed the specified locations will be used instead
of the default ones. One can use C<%> to mean the component. Thus to
explicitly specify the default one would set:
--rules_locations debian/components/%,debian/components,/usr/share/pkg-components/build_stages
=back
=head1 CONFIGURATION
To enable this functionality it is necessary to pass the argument
C<--with components> to the C<dh> programa in the C<debian/rules>
file.
=head1 SEE ALSO
L<debhelper(1)>
This program is used with debhelper.
L<quilt(1)>
=head1 AUTHOR
Nicholas Bamber <nicholas@periapt.co.uk>
=cut
|