summaryrefslogtreecommitdiff
path: root/tests/pretend-pbuilder
blob: 8495a2f74d9b6668919b939e6efcfb27540476a0 (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
#!/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);

# 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