/usr/bin/dh_golang is in dh-golang 1.5.
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 | #!/usr/bin/perl -w
eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
if 0; # not running under some shell
=head1 NAME
dh_golang - Generates Built-Using substvar
=cut
use strict;
use Debian::Debhelper::Dh_Lib;
use Parse::DebControl; # not in core
=head1 SYNOPSIS
B<dh_golang> [S<I<debhelper options>>]
=head1 DESCRIPTION
B<dh_golang> is a debhelper program which adds the misc:Built-Using substvar
based on the Build-Dependencies of your packages. Every package starting with
golang is queried for the precise version number.
As an example, if you Build-Depend on golang-pq-dev, the resulting
misc:Built-Using value (aside from the precise version number) will look like
this:
golang (= 2:1.1.1-1), golang-pq-dev (= 0.0~git20130606-1),
=head1 NOTES
The best way to invoke B<dh_golang> is by using B<dh --with=golang>.
=cut
init();
############################################################################
# Generate misc:Built-Using substvar with the versions of all golang-*
# build-dependency packages.
############################################################################
my $built_using;
# TODO: switch to Dpkg::Control::Info, maybe?
my $control_parser = Parse::DebControl->new();
my $control_data = $control_parser->parse_file('./debian/control');
my $source_data = $control_data->[0];
if (!defined($source_data)) {
error('Could not parse ./debian/control');
}
if (defined($source_data->{'Build-Depends'})) {
my $golang_deps = join(' ', grep { defined }
map { /^\s*(golang-[^\s]+)/; $1 }
split(',', $source_data->{'Build-Depends'}));
if ($golang_deps ne '') {
$built_using = `dpkg-query -f='\${source:Package} (= \${source:Version}), ' -W $golang_deps`;
}
}
# If there is an easier way to have a universal misc:Built-Using on all binary
# packages, I am happy to merge your patch :).
foreach my $package (@{$dh{DOPACKAGES}}) {
addsubstvar($package, "misc:Built-Using", $built_using);
}
=head1 SEE ALSO
dh(1)
=head1 AUTHORS
Michael Stapelberg <stapelberg@debian.org>
=cut
# vim:ts=4:sw=4:et
|