chiark / gitweb /
dgit: Implement clean_tree_check for mode -wc
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 13 Oct 2018 10:15:57 +0000 (11:15 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 13 Oct 2018 11:20:45 +0000 (12:20 +0100)
This part of the fix for #910705.  This makes -wc actually work with
build_source.

But per the discussion in #910705 we want to implement some checking
in dpkg-source[-d] mode too.

We need to teach the test suite about this notion of checking
cleanlines rather than cleaning.  For now we wildcard C*.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
dgit
tests/lib-build-modes

diff --git a/dgit b/dgit
index b4943a23d70118c7c177b737798e40b6622f6679..7f58bc517939fbde17cb16d9fee9e292e25137d1 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -6200,7 +6200,15 @@ sub maybe_unapply_patches_again () {
 #----- other building -----
 
 sub clean_tree_check () {
-    # Not yet implemented.  The lack of this is part of #910705.
+    # Not yet fully implemented.
+    if ($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";
+       }
+    }
 }
 
 sub clean_tree () {
@@ -6217,12 +6225,7 @@ sub clean_tree () {
     } 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";
-       }
+       clean_tree_check();
     } elsif ($cleanmode eq 'none') {
     } else {
        die "$cleanmode ?";
index dbceb42e8089eb28e2cb0810f39565d8d27e3c20..5e186b2698ece154ed68a9be7bc0d6cc7e8e5da9 100644 (file)
@@ -127,17 +127,17 @@ bm-compute-expected () {
        *[^\ ]*)
                ;;
        *)
-               # dgit won't bother cleaning the tree
-               # if no build is going to be run
-               eff_cleanmode=none
+               # if no build is going to be run, dgit will only check
+               # cleanliness rather than actually cleaning
+               eff_cleanmode=C$cleanmode
                ;;
        esac
 
        case "$act" in
        sbuild*)
-               # dgit sbuild won't bother cleaning the tree
+               # dgit sbuild will only check cleanliness
                # because it doesn't need to to make a .dsc for sbuild
-               eff_cleanmode=none
+               eff_cleanmode=C$cleanmode
                ;;
        esac
 
@@ -148,12 +148,13 @@ bm-compute-expected () {
        case $eff_cleanmode in
        git)            echo >&4 'BUILD-MODES PROGRAM git clean -xdf' ;;
        git-ff)         echo >&4 'BUILD-MODES PROGRAM git clean -xdff' ;;
-       check)          echo >&4 'BUILD-MODES PROGRAM git clean -xdn' ;;
+       check|Ccheck)   echo >&4 'BUILD-MODES PROGRAM git clean -xdn' ;;
        dpkg-source-d)  echo >&4 "EXAMPLE RULES TARGET clean" ;;
        dpkg-source)    bm-build-deps-ok || tolerate_fail=tolerate
                        echo >&4 "EXAMPLE RULES TARGET clean"
                        ;;
        none)           ;;
+       C*)             echo "TODO bm eff_cleanmode=$eff_cleanmode" ;;
        *)              fail "t-compute-expected-run $cleanmode ??" ;;
        esac