+sub cmd_sbuild {
+ check_not_dirty();
+ badusage "-p is not allowed with dgit sbuild" if defined $package;
+ my $clogp = parsechangelog();
+ $package = getfield $clogp, 'Source';
+ my $version = getfield $clogp, 'Version';
+ runcmd (@dpkgbuildpackage, qw(-us -uc -S));
+ chdir ".." or die $!;
+ my $sourcechanges = "${package}_${version}_source.changes";
+ my $dscfn = dscfn($version);
+ stat "../$dscfn" or fail "$dscfn (in parent directory): $!";
+ stat "../$sourcechanges" or fail "$sourcechanges (in parent directory): $!";
+ my $pat = "${package}_${version}_*.changes";
+ foreach my $cf (glob $pat) {
+ next if $cf eq $sourcechanges;
+ unlink $cf or fail "remove $cf: $!";
+ }
+ runcmd @sbuild, @ARGV, $sourcechanges;
+ runcmd @mergechanges, glob $pat;
+ my $multichanges = "${package}_${version}_multi.changes";
+ stat $multichanges or fail "$multichanges: $!";
+ print "build successful, results in $multichanges\n" or die $!;
+}
+