diff --git a/globalBuildOptions.go b/globalBuildOptions.go index bcbdf72..78d708f 100644 --- a/globalBuildOptions.go +++ b/globalBuildOptions.go @@ -10,7 +10,7 @@ import ( "go.wit.com/gui" "go.wit.com/lib/gadgets" "go.wit.com/lib/gui/repolist" - "go.wit.com/lib/gui/repostatus" + "go.wit.com/lib/gui/shell" ) func doesExist(path string) bool { @@ -24,14 +24,6 @@ func doesExist(path string) bool { // only errors on bad errors func quickCmd(fullpath string, cmd []string) bool { - var err error - var b bool - var output string - - // if me.autoWorkingPwd.String() != fullpath { - // me.autoWorkingPwd.SetValue(fullpath) - // } - if me.autoDryRun.Checked() { log.Warn("RUN --dry-run", fullpath, cmd) return false @@ -39,19 +31,19 @@ func quickCmd(fullpath string, cmd []string) bool { log.Warn("RUN:", fullpath, cmd) } - err, b, output = repostatus.RunCmd(fullpath, cmd) - if err != nil { - log.Warn("cmd =", cmd) - log.Warn("err =", err) - log.Warn("b =", b) - log.Warn("output =", string(output)) + result := shell.PathRun(fullpath, cmd) + if result.Error != nil { + log.Warn("quickCmd() cmd =", cmd) + log.Warn("quickCmd() err =", result.Error) + log.Warn("quickCmd() b =", result.Exit) + log.Warn("quickCmd() output =", result.Stdout) return false - } else if !b { - log.Warn("b =", b) - log.Warn("output =", string(output)) + } else if result.Exit != 0 { + log.Warn("quickCmd() b =", result.Exit) + log.Warn("quickCmd() output =", result.Stdout) return true } - log.Warn("output = ", string(output)) + log.Warn("quickCmd() output = ", result.Stdout) return true } @@ -97,78 +89,3 @@ func globalBuildOptions(vbox *gui.Node) { me.autoCreateBranches = grid.NewCheckbox("create if missing").SetChecked(true) grid.NextRow() } - -// this code isn't ready yet -/* - s.gitPullB = grid.NewButton("git pull", func() { - me.Disable() - defer me.Enable() - for _, repo := range repolist.AllRepos() { - // gitcmd := []string{"git", "fetch", "origin"} - gitcmd := []string{"git", "pull"} - err, output := repo.RunCmd(gitcmd) - log.Info("output =", output) - if err == nil { - log.Info("git fetch worked", repo.Name()) - } else { - log.Info("git fetch failed", repo.Name()) - return - } - } - gitPullB.SetText("GOOD") - // update the stats - // s.Update() - }) - - s.gitPushB = grid.NewButton("git push", func() { - me.Disable() - defer me.Enable() - for _, repo := range repolist.AllRepos() { - gitcmd := []string{"git", "push"} - err, output := repo.RunCmd(gitcmd) - log.Info("output =", output) - if err == nil { - log.Info("git push worked", repo.Name()) - } else { - log.Info("git push failed", repo.Name()) - return - } - } - s.gitPushB.SetText("GOOD") - // update the stats - s.Update() - }) - - s.checkB = s.grid.NewButton("Check repos are working", func() { - me.Disable() - defer me.Enable() - for _, repo := range repolist.AllRepos() { - if repo.GitURL() != "" { - log.Info("repo already checked. do they match?") - log.Info("go.wit.com =", repo.GoURL()) - log.Info("localurl =", repo.Path()) - } else { - ok, giturl := gowit.CheckRegistered(repo) - if ok { - log.Info("is url correct?", repo.Path(), "vs", giturl) - repo.giturl = giturl - if giturl != repo.Path() { - log.Info("repo check failed", repo.String()) - s.unknownOL.SetText(repo.String()) - s.unknownOL.Show() - s.unknownSubmitB.Show() - return - } - } else { - log.Info("repo check failed", repo.String()) - repo.giturl = "look in .git/config" - s.unknownOL.SetText(repo.String()) - s.unknownOL.Show() - s.unknownSubmitB.Show() - return - } - } - } - s.checkB.SetText("GOOD") - }) -*/ diff --git a/submitPatches.go b/submitPatches.go index 9092efc..74608b1 100644 --- a/submitPatches.go +++ b/submitPatches.go @@ -150,11 +150,11 @@ func submitPatchesBox(box *gui.Node) *patchSummary { } } s.submitB = s.grid.NewButton("Create Patch Set", func() { - dirname := "submit-patchset.quilt" + dirname := "submit-patchset.quilt" patchdir := filepath.Join(me.userHomePwd.String(), dirname) if shell.Exists(patchdir) { log.Info("patchset dir already exists", patchdir) - shell.RunCmd(me.userHomePwd.String(), []string{"rm", "-rf", dirname}) + shell.PathRun(me.userHomePwd.String(), []string{"rm", "-rf", dirname}) } shell.Mkdir(patchdir) if !shell.Exists(patchdir) {