]> Cypherpunks.ru repositories - goredo.git/blobdiff - run.go
Fix dependencies relative paths determination
[goredo.git] / run.go
diff --git a/run.go b/run.go
index f08547008d9f76a04e11b164be62e553bfa5a4c5..4724870e8a767218584ccb1ae0239034729f9407 100644 (file)
--- a/run.go
+++ b/run.go
@@ -266,12 +266,14 @@ func runScript(tgtOrig string, errs chan error, traced bool) error {
        }
 
        // Determine basename and DIRPREFIX
+       doFileRelPath := doFile
        ents := strings.Split(cwd, "/")
        ents = ents[len(ents)-upLevels:]
        dirPrefix := path.Join(ents...)
        cwdOrig := cwd
        for i := 0; i < upLevels; i++ {
                cwd = path.Join(cwd, "..")
+               doFileRelPath = path.Join("..", doFileRelPath)
        }
        cwd = path.Clean(cwd)
        doFilePath := path.Join(cwd, doFile)
@@ -279,10 +281,10 @@ func runScript(tgtOrig string, errs chan error, traced bool) error {
        runErr := RunErr{Tgt: tgtOrig}
        if strings.HasPrefix(doFile, "default.") {
                basename = tgt[:len(tgt)-(len(doFile)-len("default.")-len(".do"))-1]
-               runErr.DoFile = doFile
+               runErr.DoFile = doFileRelPath
        }
 
-       if err = writeDep(fdDep, cwd, doFile); err != nil {
+       if err = writeDep(fdDep, cwdOrig, doFileRelPath); err != nil {
                cleanup()
                return TgtErr{tgtOrig, err}
        }
@@ -377,7 +379,10 @@ func runScript(tgtOrig string, errs chan error, traced bool) error {
                }
                fdStderr.Truncate(0)
        }
-       shCtx := fmt.Sprintf("sh: %s: %s %s [%s]", tgtOrig, cmdName, args, cwd)
+       shCtx := fmt.Sprintf(
+               "sh: %s: %s %s cwd:%s dirprefix:%s",
+               tgtOrig, cmdName, args, cwd, dirPrefix,
+       )
        trace(CDebug, "%s", shCtx)
 
        Jobs.Add(1)