diff options
| author | Jeff Carr <[email protected]> | 2024-11-28 18:27:38 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-11-28 18:27:38 -0600 |
| commit | be0378f5486184b69b5da59461786477d753b8a3 (patch) | |
| tree | d11001460150ee998feb66a3052d2034f71815d4 /testGui/main.go | |
| parent | 8bf3997c81db88d8401db28c86f701be014442c2 (diff) | |
add a test example
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'testGui/main.go')
| -rw-r--r-- | testGui/main.go | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/testGui/main.go b/testGui/main.go new file mode 100644 index 0000000..f372bc1 --- /dev/null +++ b/testGui/main.go @@ -0,0 +1,102 @@ +package main + +import ( + "fmt" + "os" + + "go.wit.com/log" + + "go.wit.com/gui" + "go.wit.com/lib/gui/repolist" +) + +// sent via -ldflags +var VERSION string +var BUILDTIME string + +func main() { + me = new(autoType) + + // load the ~/.config/forge/ config + me.forge.Init() + me.forge.ConfigPrintTable() + + // setup the GUI + me.myGui = gui.New() + me.myGui.Default() + + // todo: this code sucks. fix it soon + me.mainWindow = me.myGui.NewWindow("builds and uploads all the packages") + me.mainbox = me.mainWindow.NewBox("bw hbox", true) + + // make a window with a table of all the repos + me.repoList = repolist.AutotypistView(me.mainbox) + me.repoList.Init(me.forge) + + me.Enable() + + failed := make(map[*repolist.RepoRow]string) + versions := make(map[*repolist.RepoRow]string) + + rloop := me.repoList.ReposSortByName() + for rloop.Scan() { + repo := rloop.Repo() + // var cmd []string + var start string + var end string + var alreadyBuilt bool + ver := repo.Status.DebianReleaseVersion() + name := me.forge.DebName(repo.GoPath()) + if me.machine.IsInstalled(name) { + end += "(installed) " + } + if actualp := me.machine.FindVersion(name, ver); actualp != nil { + end += " (version match) " + actualp.Version + " " + ver + " " + alreadyBuilt = true + } else { + end += " (need to build) " + ver + " " + } + + if alreadyBuilt { + start = fmt.Sprintf("already built %-30s %-8s %-50s", name, ver, repo.GoPath()) + } else { + start = fmt.Sprintf("need to build %-30s %-8s %-50s", name, ver, repo.GoPath()) + } + log.Info(start, "("+versions[repo]+")", end) + if name == "" { + // err := fmt.Sprintf("name is blank error %+v", repo) + log.Warn("name is blank error", repo.GoPath()) + } + + if argv.DryRun { + continue + } + + // skip if already built. (unless --force) + if alreadyBuilt { + // don't rebuild things + if argv.Force { + // well, okay, force me to rebuild them then + } else { + continue + } + } + + if repo.Status.IsPrivate() { + // cmd = []string{"go-deb", "--auto", "--repo", repo.GoPath()} + } else { + + } + } + log.Info("") + log.Info("something failed on:") + var fail bool = true + for repo, cmd := range failed { + log.Info("failed cmd :", cmd, repo.Status.Path()) + fail = false + } + if fail { + os.Exit(0) + } + os.Exit(-1) +} |
