diff options
Diffstat (limited to 'doListRepos.go')
| -rw-r--r-- | doListRepos.go | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/doListRepos.go b/doListRepos.go new file mode 100644 index 0000000..e5f34c6 --- /dev/null +++ b/doListRepos.go @@ -0,0 +1,93 @@ +// Copyright 2017-2025 WIT.COM Inc. All rights reserved. +// Use of this source code is governed by the GPL 3.0 + +package main + +import ( + "fmt" + "os" + "path/filepath" + + "go.wit.com/log" +) + +func doListRepos() { + all := me.forge.Repos.SortByFullPath() + for all.Scan() { + check := all.Next() + + repotype := check.GetRepoType() + if repotype == "binary" || repotype == "plugin" { + // we only want to process things that can be compiled with 'go build' + } else { + // log.Info("skipping repo", check.GetGoPath(), repotype) + continue + } + + if me.forge.Config.IsReadOnly(check.GetGoPath()) { + // ignore read only stuff + continue + } + + // var cmd []string + var start string + var end string + + // add te repotype + end += check.GetRepoType() + + manufactured := check.GetCurrentVersion() + ver := trimNonNumericFromStart(manufactured) + name := me.forge.Config.DebName(check.GetGoPath()) + var realver string + if installedPackage := me.forge.Machine.FindInstalledByName(name); installedPackage != nil { + realver = installedPackage.Version + } + if actualp := me.forge.Machine.FindVersion(name, ver); actualp != nil { + end += " (version match) " + actualp.Version + " " + ver + " " + state[check] = "on mirrors" + } else { + if realver != "" { + end += fmt.Sprintf(" (version miss) %s vs %s ", realver, ver) + } + // end += "" + ver + " " + } + if me.forge.Machine.IsInstalled(name) { + if actualp := me.forge.Machine.FindInstalledByName(name); actualp != nil { + if ver != actualp.Version { + end += "(installed " + actualp.Version + ") " + } else { + end += "(installed ok) " + } + } else { + end += "(installed) " + } + } + + debname := name + "_" + ver + "_amd64.deb" + debnames[check] = debname + outdir := getOutdir(check) + _, err := os.Stat(filepath.Join(outdir, debname)) + if err == nil { + // log.Info("exists", filepath.Join(outdir, debname)) + state[check] = "in incoming" + } else { + // log.Info(debname, "does not exist") + } + + if state[check] == "" { + state[check] = "need to build" + } + start = fmt.Sprintf("%-15s %-20s %-50s", state[check], ver, debname) + + if state[check] == "need to build" { + end += " (will build) " + } + + log.Info(start, end) + if name == "" { + // err := fmt.Sprintf("name is blank error %+v", repo) + log.Warn("name is blank error", check.GetGoPath()) + } + } +} |
