]> Cypherpunks.ru repositories - goredo.git/commitdiff
BuildUUID check regression for known OOD targets v1.18.0
authorSergey Matveev <stargrave@stargrave.org>
Wed, 27 Oct 2021 07:19:29 +0000 (10:19 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Wed, 27 Oct 2021 07:26:50 +0000 (10:26 +0300)
doc/news.texi
ood.go
t/goredo-build-uuid-for-fdood.t [new file with mode: 0755]
usage.go

index a28696e2d042743efa124e42b5a9e6dce5577721..f83bbc1925bb6ce7c413339466e3b1f0bad0332e 100644 (file)
@@ -1,6 +1,14 @@
 @node News
 @unnumbered News
 
+@anchor{Release 1_18_0}
+@section Release 1.18.0
+@itemize
+@item
+    Fix regression of known OODs passing since 1.3.0, that leads to
+    rebuilding of already built targets.
+@end itemize
+
 @anchor{Release 1_17_0}
 @section Release 1.17.0
 @itemize
diff --git a/ood.go b/ood.go
index 9dfed348a1637c88b76419b80dda1a552a9c4546..c455a3b01e22c3221f0b9a5eccc72db6b83996d0 100644 (file)
--- a/ood.go
+++ b/ood.go
@@ -90,6 +90,21 @@ func isSrc(cwd, tgt string) bool {
        return true
 }
 
+func isOODByBuildUUID(cwd, tgtOrig string) bool {
+       cwd, tgt := cwdAndTgt(path.Join(cwd, tgtOrig))
+       depPath := path.Join(cwd, RedoDir, tgt+DepSuffix)
+       fdDep, err := os.Open(depPath)
+       if err != nil {
+               return true
+       }
+       depInfo, err := depRead(fdDep)
+       fdDep.Close()
+       if err != nil || depInfo.build != BuildUUID {
+               return true
+       }
+       return false
+}
+
 func isOOD(cwd, tgtOrig string, level int, seen map[string]struct{}) (bool, error) {
        indent := strings.Repeat(". ", level)
        trace(CDebug, "ood: %s%s checking", indent, tgtOrig)
@@ -215,6 +230,14 @@ func isOODWithTrace(
        }
        _, ood := OODTgts[p]
        if ood {
+               if !isOODByBuildUUID(cwd, tgtOrig) {
+                       trace(
+                               CDebug,
+                               "ood: %s%s -> already built",
+                               strings.Repeat(". ", level), tgtOrig,
+                       )
+                       return false, nil
+               }
                trace(
                        CDebug,
                        "ood: %s%s true, external decision",
diff --git a/t/goredo-build-uuid-for-fdood.t b/t/goredo-build-uuid-for-fdood.t
new file mode 100755 (executable)
index 0000000..db952a5
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+testname=`basename "$0"`
+test_description="Passed known OOD targets must not skip BuildUUID check"
+. $SHARNESS_TEST_SRCDIR/sharness.sh
+export REDO_TOP_DIR="`pwd`" REDO_NO_PROGRESS=1
+
+echo redo-ifchange l3 l2 > l1.do
+echo redo-ifchange l3 > l2.do
+cat > l3.do <<EOF
+sleep 1
+touch \$(date +%s).touch
+EOF
+
+redo -j 1 l1
+touches="$(ls *.touch | wc -l)"
+
+test_expect_success "only single .touch exists" '[ $touches = 1 ]'
+
+test_done
index 2cfee2d2e7f372c80ebc5b8959d0abf9bbc09826..bf27c1b8fc211fd5161ae7380d1143a31987e6e7 100644 (file)
--- a/usage.go
+++ b/usage.go
@@ -24,7 +24,7 @@ import (
 )
 
 const (
-       Version  = "1.17.0"
+       Version  = "1.18.0"
        Warranty = `Copyright (C) 2020-2021 Sergey Matveev
 
 This program is free software: you can redistribute it and/or modify