summaryrefslogtreecommitdiff
path: root/tests/pretend-pbuilder
blob: 1d39eb382ce65e56d8e278653dbce385186df359 (plain)
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
#!/usr/bin/perl

use strict;
use warnings;

use Getopt::Long;

my $operation = shift;
die "pbuilder: you should use me only to build, dgit"
  unless ($operation eq "build" || $operation eq "b");

my $debbuildopts = undef;
my $distribution = undef;
GetOptions('debbuildopts=s' => \$debbuildopts,
           'distribution=s' => \$distribution)
    or die;

# ignore user args; last argument has to be the .dsc filename
my $dsc = $ARGV[-1];
die "pbuilder: last argument has wrong file extension"
  unless ($dsc =~ m/^(.*)_.*\.dsc$/);

system "dpkg-source -x $dsc pbuilder";
chdir 'pbuilder';
system <<END
dpkg-buildpackage --changes-option=-DDistribution=$distribution $debbuildopts
END