#----- other building -----
+sub clean_tree_check () {
+ # Not yet fully implemented.
+ if ($cleanmode =~ m{^check}) {
+ my $leftovers = cmdoutput @git, qw(clean -xdn);
+ if (length $leftovers) {
+ print STDERR $leftovers, "\n" or confess $!;
+ fail __
+ "tree contains uncommitted files and --clean=check specified";
+ }
+ }
+}
+
sub clean_tree () {
# We always clean the tree ourselves, rather than leave it to the
# builder (dpkg-source, or soemthing which calls dpkg-source).
- if ($cleanmode eq 'dpkg-source') {
- maybe_apply_patches_dirtily();
- runcmd_ordryrun_local @dpkgbuildpackage, qw(-T clean);
- } elsif ($cleanmode eq 'dpkg-source-d') {
+ if ($cleanmode =~ m{^dpkg-source}) {
+ my @cmd = @dpkgbuildpackage;
+ push @cmd, qw(-d) if $cleanmode =~ m{^dpkg-source-d};
+ push @cmd, qw(-T clean);
maybe_apply_patches_dirtily();
- runcmd_ordryrun_local @dpkgbuildpackage, qw(-d -T clean);
+ runcmd_ordryrun_local @cmd;
} elsif ($cleanmode eq 'git') {
runcmd_ordryrun_local @git, qw(clean -xdf);
} elsif ($cleanmode eq 'git-ff') {
runcmd_ordryrun_local @git, qw(clean -xdff);
- } elsif ($cleanmode eq 'check') {
- my $leftovers = cmdoutput @git, qw(clean -xdn);
- if (length $leftovers) {
- print STDERR $leftovers, "\n" or confess $!;
- fail __
- "tree contains uncommitted files and --clean=check specified";
- }
+ } elsif ($cleanmode =~ m{^check}) {
+ clean_tree_check();
} elsif ($cleanmode eq 'none') {
} else {
die "$cleanmode ?";
}
}
-sub clean_tree_check () {
- # Not yet implemented. The lack of this is part of #910705.
-}
-
sub cmd_clean () {
badusage __ "clean takes no additional arguments" if @ARGV;
notpushing();