]> Cypherpunks.ru repositories - goredo.git/blobdiff - ood.go
Use more shorter Cwd-relative paths
[goredo.git] / ood.go
diff --git a/ood.go b/ood.go
index 9a70be41a54bbc95776a632f90453804154a27cb..59bf76c18661202467c830526c8c6ee2abfe80b2 100644 (file)
--- a/ood.go
+++ b/ood.go
@@ -100,12 +100,12 @@ func isOODByBuildUUID(tgt *Tgt) bool {
 func isOOD(tgt *Tgt, level int, seen map[string]*Tgt) (bool, error) {
        indent := strings.Repeat(". ", level)
        tracef(CDebug, "ood: %s%s checking", indent, tgt)
-       ood, cached := OODCache[tgt.a]
+       ood, cached := OODCache[tgt.rel]
        if cached {
                tracef(CDebug, "ood: %s%s -> cached: %v", indent, tgt, ood)
                return ood, nil
        }
-       depInfo := DepInfoCache[tgt.Dep()]
+       depInfo := DepInfoCache[tgt.rel]
        var err error
        if depInfo == nil {
                depInfo, err = depRead(tgt)
@@ -118,24 +118,26 @@ func isOOD(tgt *Tgt, level int, seen map[string]*Tgt) (bool, error) {
                                        ood = true
                                        tracef(CDebug, "ood: %s%s -> no dep: %s", indent, tgt, tgt.Dep())
                                }
-                               OODCache[tgt.a] = ood
+                               OODCache[tgt.rel] = ood
                                return ood, nil
                        }
                        if err != nil {
                                return true, TgtError{tgt, ErrLine(err)}
                        }
                }
-               DepInfoCache[tgt.Dep()] = depInfo
+               if DepInfoCache != nil {
+                       DepInfoCache[tgt.rel] = depInfo
+               }
        }
 
        if depInfo.build == BuildUUID {
                tracef(CDebug, "ood: %s%s -> already built", indent, tgt)
-               OODCache[tgt.a] = false
+               OODCache[tgt.rel] = false
                return false, nil
        }
        if !FileExists(tgt.a) {
                tracef(CDebug, "ood: %s%s -> non-existent", indent, tgt)
-               OODCache[tgt.a] = true
+               OODCache[tgt.rel] = true
                return true, nil
        }
 
@@ -149,7 +151,7 @@ func isOOD(tgt *Tgt, level int, seen map[string]*Tgt) (bool, error) {
 
        for _, dep := range depInfo.ifchanges {
                tracef(CDebug, "ood: %s%s -> %s: checking", indent, tgt, dep.tgt)
-               ood, cached = OODCache[dep.tgt.a]
+               ood, cached = OODCache[dep.tgt.rel]
                if cached {
                        tracef(CDebug, "ood: %s%s -> %s: cached: %v", indent, tgt, dep.tgt, ood)
                        if ood {
@@ -163,7 +165,7 @@ func isOOD(tgt *Tgt, level int, seen map[string]*Tgt) (bool, error) {
                        if errors.Is(err, fs.ErrNotExist) {
                                tracef(CDebug, "ood: %s%s -> %s: not exists", indent, tgt, dep.tgt)
                                ood = true
-                               OODCache[dep.tgt.a] = ood
+                               OODCache[dep.tgt.rel] = ood
                                goto Done
                        }
                        return ood, TgtError{tgt, ErrLine(err)}
@@ -172,7 +174,7 @@ func isOOD(tgt *Tgt, level int, seen map[string]*Tgt) (bool, error) {
                if inode.Size != dep.inode.Size {
                        tracef(CDebug, "ood: %s%s -> %s: size differs", indent, tgt, dep.tgt)
                        ood = true
-                       OODCache[dep.tgt.a] = ood
+                       OODCache[dep.tgt.rel] = ood
                        goto Done
                }
                if InodeTrust != InodeTrustNone && inode.Equals(dep.inode) {
@@ -191,25 +193,25 @@ func isOOD(tgt *Tgt, level int, seen map[string]*Tgt) (bool, error) {
                        if dep.hash != hsh {
                                tracef(CDebug, "ood: %s%s -> %s: hash differs", indent, tgt, dep.tgt)
                                ood = true
-                               OODCache[dep.tgt.a] = ood
+                               OODCache[dep.tgt.rel] = ood
                                goto Done
                        }
                        tracef(CDebug, "ood: %s%s -> %s: same hash", indent, tgt, dep.tgt)
                }
 
-               if dep.tgt.a == tgt.a {
+               if dep.tgt.rel == tgt.rel {
                        tracef(CDebug, "ood: %s%s -> %s: same target", indent, tgt, dep.tgt)
                        continue
                }
                if isSrc(dep.tgt) {
                        tracef(CDebug, "ood: %s%s -> %s: is source", indent, tgt, dep.tgt)
-                       OODCache[dep.tgt.a] = false
+                       OODCache[dep.tgt.rel] = false
                        continue
                }
 
-               if _, ok := seen[dep.tgt.a]; ok {
+               if _, ok := seen[dep.tgt.rel]; ok {
                        tracef(CDebug, "ood: %s%s -> %s: was always built", indent, tgt, dep.tgt)
-                       OODCache[dep.tgt.a] = false
+                       OODCache[dep.tgt.rel] = false
                        continue
                }
 
@@ -227,7 +229,7 @@ func isOOD(tgt *Tgt, level int, seen map[string]*Tgt) (bool, error) {
 
 Done:
        tracef(CDebug, "ood: %s%s: %v", indent, tgt, ood)
-       OODCache[tgt.a] = ood
+       OODCache[tgt.rel] = ood
        return ood, nil
 }