]> Cypherpunks.ru repositories - goredo.git/blobdiff - run.go
Prepare to rename DepInfo->Dep
[goredo.git] / run.go
diff --git a/run.go b/run.go
index 7fa4deae08c35b428111e5773d5744eca32417cd..38bfc13562b72d162791ae683f8db45e50a49703 100644 (file)
--- a/run.go
+++ b/run.go
@@ -132,14 +132,14 @@ func mkdirs(pth string) error {
        return os.MkdirAll(pth, os.FileMode(0777))
 }
 
-func isModified(depInfo *DepInfo, tgt *Tgt) (
+func isModified(dep *Dep, tgt *Tgt) (
        modified bool, ourInode *Inode, hshPrev Hash, err error,
 ) {
-       if depInfo == nil {
+       if dep == nil {
                return
        }
-       for _, dep := range depInfo.ifchanges {
-               if dep.tgt.a != tgt.a {
+       for _, ifchange := range dep.ifchanges {
+               if ifchange.tgt.a != tgt.a {
                        continue
                }
                ourInode, err = inodeFromFileByPath(tgt.a)
@@ -260,7 +260,7 @@ func runScript(tgt *Tgt, errs chan error, forced, traced bool) error {
 
        // It scans the whole .rec file while searching for the single target,
        // but that one is always located at the very end
-       depInfo, err := depRead(tgt)
+       dep, err := depRead(tgt)
        if err != nil {
                if errors.Is(err, fs.ErrNotExist) {
                        err = nil
@@ -271,14 +271,14 @@ func runScript(tgt *Tgt, errs chan error, forced, traced bool) error {
        }
 
        // Check if it was already built in parallel
-       if !forced && depInfo != nil && depInfo.build == BuildUUID {
+       if !forced && dep != nil && dep.build == BuildUUID {
                lockRelease()
                errs <- nil
                return nil
        }
 
        // Check if target is not modified externally
-       modified, inodePrev, hshPrev, err := isModified(depInfo, tgt)
+       modified, inodePrev, hshPrev, err := isModified(dep, tgt)
        if err != nil {
                lockRelease()
                return TgtError{tgt, ErrLine(err)}
@@ -294,7 +294,7 @@ func runScript(tgt *Tgt, errs chan error, forced, traced bool) error {
                }()
                return nil
        }
-       depInfo = nil
+       dep = nil
 
        // Start preparing .rec
        fdDep, err := tempfile(redoDir, tgt.t+DepSuffix)
@@ -558,10 +558,10 @@ func runScript(tgt *Tgt, errs chan error, forced, traced bool) error {
                                                        err = ErrLine(err)
                                                        goto Err
                                                }
-                                               for _, dep := range ifchanges {
+                                               for _, ifchange := range ifchanges {
                                                        fields = append(fields, recfile.Field{
                                                                Name:  "Ifchange",
-                                                               Value: dep,
+                                                               Value: ifchange,
                                                        })
                                                }
                                        }
@@ -798,11 +798,12 @@ func runScript(tgt *Tgt, errs chan error, forced, traced bool) error {
                // Post-commit .rec sanitizing
                if depInfo, err := depRead(tgt); err == nil {
                        ifchangeSeen := make(map[string]struct{}, len(depInfo.ifchanges))
-                       for _, dep := range depInfo.ifchanges {
-                               ifchangeSeen[dep.tgt.a] = struct{}{}
+                       ifchangeSeen := make(map[string]struct{}, len(dep.ifchanges))
+                       for _, ifchange := range dep.ifchanges {
+                               ifchangeSeen[ifchange.tgt.a] = struct{}{}
                        }
-                       for _, dep := range depInfo.ifcreates {
-                               if _, exists := ifchangeSeen[dep.a]; exists {
+                       for _, ifcreate := range dep.ifcreates {
+                               if _, exists := ifchangeSeen[ifcreate.a]; exists {
                                        tracef(CWarn, "simultaneous ifcreate and ifchange records: %s", tgt)
                                }
                        }