summaryrefslogtreecommitdiff
path: root/doInstall.go
diff options
context:
space:
mode:
Diffstat (limited to 'doInstall.go')
-rw-r--r--doInstall.go131
1 files changed, 107 insertions, 24 deletions
diff --git a/doInstall.go b/doInstall.go
index 42adc99..cac93d0 100644
--- a/doInstall.go
+++ b/doInstall.go
@@ -13,6 +13,37 @@ import (
"go.wit.com/log"
)
+func doInstallRepo(check *gitpb.Repo) error {
+ 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)
+ return nil
+ }
+
+ if me.forge.Config.IsReadOnly(check.GetGoPath()) {
+ // ignore read only stuff
+ return nil
+ }
+
+ if argv.Verbose {
+ verbose := []string{"-v", "-x"}
+ if err := me.forge.Install(check, verbose); err != nil {
+ log.Warn("INSTALL FAILED", check.GetGoPath(), err)
+ failed[check] = fmt.Sprintf("%s %s %v", "go install", check.GetGoPath(), err)
+ return err
+ }
+ } else {
+ if err := me.forge.Install(check, nil); err != nil {
+ log.Warn("INSTALL FAILED", check.GetGoPath(), err)
+ failed[check] = fmt.Sprintf("%s %s %v", "go install", check.GetGoPath(), err)
+ return err
+ }
+ }
+ return nil
+}
+
func doInstall() error {
initForge() // make sure forge is init'd here
@@ -147,33 +178,85 @@ func doInstall() error {
return nil
}
-func doInstallRepo(check *gitpb.Repo) error {
- 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)
- return nil
- }
+func doInstallScan() {
+ initForge() // make sure forge is init'd here
- if me.forge.Config.IsReadOnly(check.GetGoPath()) {
- // ignore read only stuff
- return nil
- }
+ all := me.forge.Repos.SortByFullPath()
+ for all.Scan() {
+ check := all.Next()
- if argv.Verbose {
- verbose := []string{"-v", "-x"}
- if err := me.forge.Install(check, verbose); err != nil {
- log.Warn("INSTALL FAILED", check.GetGoPath(), err)
- failed[check] = fmt.Sprintf("%s %s %v", "go install", check.GetGoPath(), err)
- return err
+ 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
}
- } else {
- if err := me.forge.Install(check, nil); err != nil {
- log.Warn("INSTALL FAILED", check.GetGoPath(), err)
- failed[check] = fmt.Sprintf("%s %s %v", "go install", check.GetGoPath(), err)
- return err
+
+ 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.machine.FindInstalledByName(name); installedPackage != nil {
+ realver = installedPackage.Version
+ }
+ if actualp := me.machine.FindByVersion(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.machine.IsInstalled(name) {
+ if actualp := me.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())
}
}
- return nil
}