]> Cypherpunks.ru repositories - goredo.git/blobdiff - sources.go
Download link for 2.6.2 release
[goredo.git] / sources.go
index acf842b4547904e6ed5812c462e707541acaaf6a..6a925e24dc6c2b4318da1bf73e7f7afa25a87dd6 100644 (file)
@@ -1,19 +1,17 @@
-/*
-goredo -- djb's redo implementation on pure Go
-Copyright (C) 2020-2023 Sergey Matveev <stargrave@stargrave.org>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 3 of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
+// goredo -- djb's redo implementation on pure Go
+// Copyright (C) 2020-2024 Sergey Matveev <stargrave@stargrave.org>
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 3 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 package main
 
@@ -29,27 +27,27 @@ func sourcesWalker(
        srcs map[string]*Tgt,
 ) error {
        for _, tgt := range tgts {
-               if _, ok := seenDeps[tgt.Dep()]; ok {
+               if _, ok := seenDeps[tgt.rel]; ok {
                        continue
                }
-               seenDeps[tgt.Dep()] = struct{}{}
-               depInfo, err := depRead(tgt)
+               seenDeps[tgt.rel] = struct{}{}
+               dep, err := depRead(tgt)
                if err != nil {
                        if errors.Is(err, fs.ErrNotExist) {
                                continue
                        }
                        return ErrLine(err)
                }
-               for _, dep := range depInfo.ifchanges {
-                       if _, ok := seen[dep.tgt.a]; ok {
+               for _, ifchange := range dep.ifchanges {
+                       if _, ok := seen[ifchange.tgt.rel]; ok {
                                continue
                        }
-                       seen[dep.tgt.a] = struct{}{}
-                       if isSrc(dep.tgt) {
-                               srcs[dep.tgt.a] = dep.tgt
-                       } else if dep.tgt.a != tgt.a {
+                       seen[ifchange.tgt.rel] = struct{}{}
+                       if isSrc(ifchange.tgt) {
+                               srcs[ifchange.tgt.rel] = ifchange.tgt
+                       } else if ifchange.tgt.rel != tgt.rel {
                                if err := sourcesWalker(
-                                       []*Tgt{dep.tgt},
+                                       []*Tgt{ifchange.tgt},
                                        seen, seenDeps, srcs,
                                ); err != nil {
                                        return err