This file is indexed.

/usr/bin/dcontrol is in devscripts 2.17.6+deb9u2.

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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
#!/usr/bin/perl
# vim:sw=4:sta:

#   dcontrol - Query Debian control files across releases and architectures
#   Copyright (C) 2009 Christoph Berg <myon@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 2 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, write to the Free Software
#   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA

use strict;
use warnings;
use File::Basename;
use Getopt::Long qw(:config bundling permute no_getopt_compat);

BEGIN {
    pop @INC if $INC[-1] eq '.';
    # Load the URI::Escape and LWP::UserAgent modules safely
    my $progname = basename($0,'.pl');
    eval { require URI::Escape; };
    if ($@) {
       if ($@ =~ /^Can\'t locate URI\/Escape\.pm/) {
           die "$progname: you must have the liburi-perl package installed\nto use this script\n";
       }
       die "$progname: problem loading the URI::Escape module:\n  $@\nHave you installed the liburi-perl package?\n";
    }
    import URI::Escape;

    eval { require LWP::UserAgent; };
    if ($@) {
       my $progname = basename $0;
       if ($@ =~ /^Can\'t locate LWP/) {
           die "$progname: you must have the libwww-perl package installed\nto use this script\n";
       }
       die "$progname: problem loading the LWP::UserAgent module:\n  $@\nHave you installed the libwww-perl package?\n";
    }
    import LWP::UserAgent;
}

# global variables

my $progname = basename($0,'.pl');  # the '.pl' is for when we're debugging
my $modified_conf_msg;
my $dcontrol_url;
my $opt;

my $ua = LWP::UserAgent->new(agent => "$progname 2.17.6+deb9u2");
$ua->env_proxy();

# functions

sub usage {
    print <<"EOT";
Usage: $progname [-sd] package[modifiers] [...]

Query package and source control files for all Debian distributions.

Options:
    -s --show-suite  Add headers for distribution the control file is from
    -d --debug       Print URL queried

Modifiers:
    =version         Exact version match
    \@architecture    Query this architecture
    /[archive:][suite][/component]
                     Restrict to archive (debian, debian-backports,
		     debian-security, debian-volatile), suite (always
		     codenames, with the exception of experimental), and/or
		     component (main, updates/main, ...). Use // if the suite
		     name contains slashes.

By default, all versions, suites, and architectures are queried.
Use \@source for source packages. \@binary returns no source packages.
Refer to $dcontrol_url for currently supported values.

Default settings modified by devscripts configuration files:
$modified_conf_msg
EOT
}

sub version {
    print <<"EOF";
This is $progname, from the Debian devscripts package, version 2.17.6+deb9u2
This code is copyright 2009 by Christoph Berg <myon\@debian.org>.
All rights reserved.
This program comes with ABSOLUTELY NO WARRANTY.
You are free to redistribute this code under the terms of the
GNU General Public License, version 2 or later.
EOF
}

sub apt_get {
    my ($arg) = @_;
    unless ($arg =~ /^([\w.+-]+)/) {
	die "$arg does not start with a valid package name\n";
    }
    my $url = "$dcontrol_url?package=" . uri_escape($1);
    if ($arg =~ /=([\w~:.+-]+)/) {
	$url .= "&version=" . uri_escape($1);
    }
    if ($arg =~ /@([\w.-]+)/) {
	$url .= "&architecture=$1";
    }
    if ($arg =~ m!/([\w-]*):([\w/-]*)//([\w/-]*)!) {
	$url .= "&archive=$1&suite=$2&component=$3";
    } elsif ($arg =~ m!/([\w/-]*)//([\w/-]*)!) {
	$url .= "&suite=$1&component=$2";
    } elsif ($arg =~ m!/([\w-]*):([\w-]*)/([\w/-]*)!) {
	$url .= "&archive=$1&suite=$2&component=$3";
    } elsif ($arg =~ m!/([\w-]*):([\w-]*)!) {
	$url .= "&archive=$1&suite=$2";
    } elsif ($arg =~ m!/([\w-]*)/([\w/-]*)!) {
	$url .= "&suite=$1&component=$2";
    } elsif ($arg =~ m!/([\w\/-]+)!) {
	$url .= "&suite=$1";
    }
    if ($opt->{'show-suite'}) {
	$url .= "&annotate=yes";
    }
    print "$url\n" if $opt->{debug};
    my $response = $ua->get ($url);
    if ($response->is_success) {
	print $response->content . "\n";
    } else {
	die $response->status_line;
    }
}

# main program

if (@ARGV and $ARGV[0] =~ /^--no-?conf$/) {
    $modified_conf_msg = "  (no configuration files read)";
    shift;
} else {
    my @config_files = ('/etc/devscripts.conf', '~/.devscripts');
    my %config_vars = (
		       'DCONTROL_URL' => 'https://qa.debian.org/cgi-bin/dcontrol',
		       );
    my %config_default = %config_vars;

    my $shell_cmd;
    # Set defaults
    foreach my $var (keys %config_vars) {
	$shell_cmd .= "$var='$config_vars{$var}';\n";
    }
    $shell_cmd .= 'for file in ' . join(" ",@config_files) . "; do\n";
    $shell_cmd .= '[ -f $file ] && . $file; done;' . "\n";
    # Read back values
    foreach my $var (keys %config_vars) { $shell_cmd .= "echo \$$var;\n" }
    my $shell_out = `/bin/bash -c '$shell_cmd'`;
    @config_vars{keys %config_vars} = split /\n/, $shell_out, -1;

    foreach my $var (sort keys %config_vars) {
	if ($config_vars{$var} ne $config_default{$var}) {
	    $modified_conf_msg .= "  $var=$config_vars{$var}\n";
	}
    }
    $modified_conf_msg ||= "  (none)\n";
    chomp $modified_conf_msg;

    $dcontrol_url = $config_vars{'DCONTROL_URL'};
}

# handle options
GetOptions(
    "d|debug"      =>  \$opt->{'debug'},
    "s|show-suite" =>  \$opt->{'show-suite'},
    "h|help"       =>  \$opt->{'help'},
    "V|version"    =>  \$opt->{'version'},
)
    or die "$progname: unrecognised option. Run $progname --help for more details.\n";

if ($opt->{'help'}) { usage(); exit 0; }
if ($opt->{'version'}) { version(); exit 0; }
if ($opt->{'no-conf'}) {
    die "$progname: --no-conf is only acceptable as the first command-line option!\n";
}

if (! @ARGV) {
    usage();
    exit 1;
}

# handle arguments
while (my $arg = shift @ARGV) {
    apt_get ($arg);
}

=head1 NAME

dcontrol -- Query package and source control files for all Debian distributions

=head1 SYNOPSIS

=over

=item B<dcontrol> [I<options>] I<package>[I<modifiers>] ...

=back

=head1 DESCRIPTION

B<dcontrol> queries a remote database of Debian binary and source package
control files. It can be thought of as an B<apt-cache> webservice that also
operates for distributions and architectures different from the local machine.

=head1 MODIFIERS

Like B<apt-cache>, packages can be suffixed by modifiers:

=over 4

=item B<=>I<version>

Exact version match

=item B<@>I<architecture>

Query this only architecture. Use B<@source> for source packages,
B<@binary> excludes source packages.

=item B</>[I<archive>B<:>][I<suite>][B</>I<component>]

Restrict to I<archive> (debian, debian-backports, debian-security,
debian-volatile), I<suite> (always codenames, with the exception of
experimental), and/or I<component> (main, updates/main, ...). Use two slashes
(B<//>) to separate suite and component if the suite name contains slashes.
(Component can be left empty.)

=back

By default, all versions, suites, and architectures are queried. Refer to
B<https://qa.debian.org/cgi-bin/dcontrol> for currently supported values.

=head1 OPTIONS

=over 4

=item B<-s>, B<--show-suites>

Add headers showing which distribution the control file is from.

=item B<-d>, B<--debug>

Print URL queried.

=item B<-h>, B<--help>

Show a help message.

=item B<-V>, B<--version>

Show version information.

=back

=head1 CONFIGURATION VARIABLES

The two configuration files F</etc/devscripts.conf> and
F<~/.devscripts> are sourced by a shell in that order to set
configuration variables.  Command line options can be used to override
configuration file settings.  Environment variable settings are
ignored for this purpose.  The currently recognised variable is:

=over 4

=item DCONTROL_URL

URL to query. Default is B<https://qa.debian.org/cgi-bin/dcontrol>.

=back

=head1 AUTHOR

This program is Copyright (C) 2009 by Christoph Berg <myon@debian.org>.

This program is licensed under the terms of the GPL, either version 2
of the License, or (at your option) any later version.

=head1 SEE ALSO

B<apt-cache>(1)