diff options
| -rw-r--r-- | doDebian.go | 22 | ||||
| -rw-r--r-- | doInstall.go | 32 | ||||
| -rw-r--r-- | doUpgrade.go | 26 |
3 files changed, 71 insertions, 9 deletions
diff --git a/doDebian.go b/doDebian.go index 10321aa..e14e555 100644 --- a/doDebian.go +++ b/doDebian.go @@ -9,15 +9,6 @@ import ( ) func doDebian() { - if argv.Force || argv.Debian.Force || argv.Debian.SkipInstall { - log.Info("doDebian() skipping go install test") - } else { - if err := doInstall(); err != nil { - log.Info("doInstall() failed", err) - badExit(err) - } - } - initForge() found := gitpb.NewRepos() @@ -41,6 +32,19 @@ func doDebian() { okExit("") } + if argv.Debian.SkipInstall { + log.Info("doDebian() skipping go install test") + } else { + me.forge.ConfigRill(16, 16) + stats := me.forge.RunOnRepos(found, doInstallRepo) + for s, stat := range stats { + log.Info(s, stat.Err) + if stat.Err != nil { + badExit(stat.Err) + } + } + } + me.forge.ConfigRill(16, 16) stats := me.forge.RunOnRepos(found, buildDeb) for s, stat := range stats { diff --git a/doInstall.go b/doInstall.go index 5b593f0..42adc99 100644 --- a/doInstall.go +++ b/doInstall.go @@ -9,6 +9,7 @@ import ( "os" "path/filepath" + "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" ) @@ -145,3 +146,34 @@ 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 + } + + 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 +} diff --git a/doUpgrade.go b/doUpgrade.go index 83f69ef..3d8d0c1 100644 --- a/doUpgrade.go +++ b/doUpgrade.go @@ -4,7 +4,11 @@ package main import ( + "fmt" + + "go.wit.com/lib/gui/shell" "go.wit.com/lib/protobuf/zoopb" + "go.wit.com/log" ) func doUpgrade() error { @@ -20,5 +24,27 @@ func doUpgrade() error { me.machine, _ = zoopb.InitMachine() doAptUpgrade() + + fmt.Println("Installed Packages:") + loop := me.machine.Wit.SortByName() + for loop.Scan() { + p := loop.Next() + // log.Info("apt install", p.Name) + if p.Name == "" { + log.Info("odd /var/lib/apt/ list parse error. p.Name was blank (should be the package name)", p) + continue + } + if !me.machine.IsInstalled(p.Name) { + continue + } + if argv.DryRun { + log.Info("should install package", p.Name) + } + + cmd := []string{"apt", "install", p.Name} + log.Info("Running:", cmd) + shell.RunVerbose(cmd) + } + okExit("installed") return nil } |
