chiark / gitweb /
changelog: start 9.14
[dgit.git] / tests / pretend-pbuilder
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Getopt::Long;
7
8 my $operation = shift;
9 die "pbuilder: you should use me only to build, dgit"
10   unless ($operation eq "build" || $operation eq "b");
11
12 my $debbuildopts = undef;
13 my $distribution = undef;
14 GetOptions('debbuildopts=s' => \$debbuildopts,
15            'distribution=s' => \$distribution)
16     or die;
17
18 # ignore user args; last argument has to be the .dsc filename
19 my $dsc = $ARGV[-1];
20 die "pbuilder: last argument has wrong file extension"
21   unless ($dsc =~ m/^(.*)_.*\.dsc$/);
22
23 system "dpkg-source -x $dsc pbuilder";
24 chdir 'pbuilder';
25 system <<END
26 dpkg-buildpackage --changes-option=-DDistribution=$distribution $debbuildopts
27 END