diff options
| -rw-r--r-- | Makefile | 1 | ||||
| -rw-r--r-- | addRepo.go | 12 | ||||
| -rw-r--r-- | build.go (renamed from buildPackage.go) | 16 | ||||
| -rw-r--r-- | controlBox.go | 102 | ||||
| -rw-r--r-- | doGui.go | 34 | ||||
| -rw-r--r-- | main.go | 2 | ||||
| -rw-r--r-- | stateWindow.go | 75 | ||||
| -rw-r--r-- | structs.go | 32 |
8 files changed, 134 insertions, 140 deletions
@@ -4,6 +4,7 @@ VERSION = $(shell git describe --tags) DATE = $(shell date +%Y.%m.%d) run: clean goimports vet install + go-deb --gui andlabs gui junk: #go-deb --release go.wit.com/apps/go-mod-clean --dir /tmp/ @@ -1,13 +1,6 @@ package main -import ( - "strings" - "time" - - "go.wit.com/lib/gadgets" - "go.wit.com/log" -) - +/* func RemoveFirstElement(slice []string) (string, []string) { if len(slice) == 0 { return "", slice // Return the original slice if it's empty @@ -17,7 +10,7 @@ func RemoveFirstElement(slice []string) (string, []string) { // homeDir, _ := os.UserHomeDir() -func (c *controlBox) addRepo() { +func (c *controlBox) addRepoOld() { path := strings.Trim(me.goPath, "/") // trim any extranous '/' chars put in the config file by the user if path == "" { log.Warn("addRepo() got empty path", path) @@ -99,3 +92,4 @@ func (c *controlBox) addRepo() { c.tagDate.SetText(tagDate) return } +*/ diff --git a/buildPackage.go b/build.go index 5f2f2a7..80ee9dc 100644 --- a/buildPackage.go +++ b/build.go @@ -231,7 +231,8 @@ func buildPackage(repo *gitpb.Repo) (bool, error) { } func writeDebianControlFile(repo *gitpb.Repo) bool { - cf, err := os.OpenFile("files/DEBIAN/control", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644) + filename := "files/DEBIAN/control" + cf, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644) if err != nil { log.Info("open control file failed", err) return false @@ -243,23 +244,22 @@ func writeDebianControlFile(repo *gitpb.Repo) bool { writeControlVar(cf, repo, "Depends") writeControlVar(cf, repo, "Build-Depends") - - stamp := time.Now().UTC().Format("2006/01/02 15:04:05 UTC") - // update to now now despite what the GUI is showing - fmt.Fprintln(cf, "Package-Build-Date:", stamp) - - fmt.Fprintln(cf, "Git-Tag-Date:", "todo: get from repo") - writeControlVar(cf, repo, "Maintainer") writeControlVar(cf, repo, "Packager") writeControlVar(cf, repo, "GoPath") writeControlVar(cf, repo, "URL") writeControlVar(cf, repo, "Conflicts") + stamp := time.Now().UTC().Format("2006/01/02 15:04:05 UTC") + // update to now now despite what the GUI is showing + fmt.Fprintln(cf, "Package-Build-Date:", stamp) + fmt.Fprintln(cf, "Git-Tag-Date:", "todo: get from repo") + desc, _ := repo.Control["Description"] // c.Description.String() parts := strings.Split(desc, "\n") fmt.Fprintln(cf, "Description:", strings.Join(parts, "\n ")) + log.Info("file written as:", filename) return true } diff --git a/controlBox.go b/controlBox.go deleted file mode 100644 index 3edacb7..0000000 --- a/controlBox.go +++ /dev/null @@ -1,102 +0,0 @@ -package main - -import ( - "go.wit.com/gui" - "go.wit.com/lib/gadgets" -) - -type controlBox struct { - group *gui.Node // the group - grid *gui.Node // the grid - - Package *gadgets.OneLiner - Source *gadgets.OneLiner - Version *gadgets.OneLiner - Maintainer *gadgets.OneLiner - Packager *gadgets.BasicEntry - GoPath *gadgets.BasicEntry - URL *gadgets.BasicEntry - Architecture *gadgets.BasicDropdown - InstallPath *gadgets.BasicCombobox - Depends *gadgets.OneLiner - BuildDepends *gadgets.OneLiner - Recommends *gadgets.OneLiner - Conflicts *gadgets.BasicEntry - Test gui.Widget - Description *gadgets.OneLiner - - // repostatus things - pathL *gadgets.OneLiner - lastTag *gadgets.OneLiner - dirtyL *gadgets.OneLiner - currentL *gadgets.OneLiner - buildDate *gadgets.OneLiner - tagDate *gadgets.BasicEntry - // status *repostatus.RepoStatus -} - -// This initializes the control box -func newControl(parent *gui.Node) *controlBox { - var c *controlBox - c = new(controlBox) - c.group = parent.NewGroup("choices") - c.grid = c.group.NewGrid("gridiron", 8, 1) - - c.Package = gadgets.NewOneLiner(c.grid, "Package") - c.grid.NextRow() - - c.Source = gadgets.NewOneLiner(c.grid, "Source") - c.grid.NextRow() - - c.Version = gadgets.NewOneLiner(c.grid, "Version") - c.grid.NextRow() - - c.Architecture = gadgets.NewBasicDropdown(c.grid, "Architecture") - c.Architecture.AddText("all") - c.Architecture.AddText("riscv64") - c.Architecture.AddText("amd64") - c.Architecture.AddText("arm64") - c.Architecture.AddText("ppc64") - c.Architecture.AddText("i386") - c.Architecture.AddText("sparc64") - c.Architecture.AddText("alpha") - c.Architecture.SetText("riscv64") - c.grid.NextRow() - - c.InstallPath = gadgets.NewBasicCombobox(c.grid, "Install Path") - c.InstallPath.AddText("/usr/bin") - c.InstallPath.AddText("/usr/local/bin") - c.InstallPath.AddText("/bin") - c.InstallPath.AddText("/opt/<pkg>/bin") - c.InstallPath.SetText("/usr/bin") - c.grid.NextRow() - - c.Maintainer = gadgets.NewOneLiner(c.grid, "Maintainer") - c.grid.NextRow() - - c.Packager = gadgets.NewBasicEntry(c.grid, "Packager") - c.grid.NextRow() - - c.GoPath = gadgets.NewBasicEntry(c.grid, "GoPath") - c.grid.NextRow() - - c.URL = gadgets.NewBasicEntry(c.grid, "URL") - c.grid.NextRow() - - c.Depends = gadgets.NewOneLiner(c.grid, "Depends") - c.grid.NextRow() - - c.BuildDepends = gadgets.NewOneLiner(c.grid, "Build-Depends") - c.grid.NextRow() - - c.Recommends = gadgets.NewOneLiner(c.grid, "Recommends") - c.grid.NextRow() - - c.Conflicts = gadgets.NewBasicEntry(c.grid, "Conflicts") - c.grid.NextRow() - - c.Description = gadgets.NewOneLiner(c.grid, "Description") - c.grid.NextRow() - - return c -} @@ -5,27 +5,23 @@ package main // An app to submit patches for the 30 GO GUI repos -import ( - "os" - - "go.wit.com/gui" - "go.wit.com/lib/gadgets" - "go.wit.com/log" -) - func doGui() { - win := gadgets.NewGenericWindow("testing", "Current Conversations") - win.Custom = func() { - log.Warn("MAIN WINDOW CLOSE") - gui.StandardExit() - os.Exit(0) - } + win := makebasicWindow() + win.Show() + /* + win := gadgets.NewGenericWindow("testing", "Current Conversations") + win.Custom = func() { + log.Warn("MAIN WINDOW CLOSE") + gui.StandardExit() + os.Exit(0) + } - grid := win.Group.RawGrid() + grid := win.Group.RawGrid() - grid.NewLabel("label worked") - grid.NextRow() + grid.NewLabel("label worked") + grid.NextRow() - grid.NewButton("more", func() { - }) + grid.NewButton("more", func() { + }) + */ } @@ -70,8 +70,6 @@ func main() { // only load teh toolkit if you get this far me.myGui.Start() // loads the GUI toolkit doGui() - win := makebasicWindow() - win.Show() debug() } diff --git a/stateWindow.go b/stateWindow.go index a47c2ec..c5637a2 100644 --- a/stateWindow.go +++ b/stateWindow.go @@ -3,6 +3,7 @@ package main import ( "os" + "go.wit.com/gui" "go.wit.com/lib/gadgets" "go.wit.com/lib/gui/shell" "go.wit.com/log" @@ -34,6 +35,10 @@ func makebasicWindow() *gadgets.BasicWindow { readControlFile(me.repo) }) + group1.NewButton("write control file", func() { + writeDebianControlFile(me.repo) + }) + group1.NewButton("Make .deb", func() { win.Disable() if ok, err := buildPackage(me.repo); ok { @@ -47,3 +52,73 @@ func makebasicWindow() *gadgets.BasicWindow { return win } + +// This initializes the control box +func newControl(parent *gui.Node) *controlBox { + var c *controlBox + c = new(controlBox) + c.group = parent.NewGroup("choices") + c.grid = c.group.NewGrid("gridiron", 8, 1) + + c.Package = gadgets.NewOneLiner(c.grid, "Package") + c.grid.NextRow() + + c.Source = gadgets.NewOneLiner(c.grid, "Source") + c.grid.NextRow() + + c.Version = gadgets.NewOneLiner(c.grid, "Version") + c.grid.NextRow() + + c.Architecture = gadgets.NewBasicDropdown(c.grid, "Architecture") + c.Architecture.AddText("all") + c.Architecture.AddText("riscv64") + c.Architecture.AddText("amd64") + c.Architecture.AddText("arm64") + c.Architecture.AddText("ppc64") + c.Architecture.AddText("i386") + c.Architecture.AddText("sparc64") + c.Architecture.AddText("alpha") + c.Architecture.SetText("riscv64") + c.grid.NextRow() + + c.InstallPath = gadgets.NewBasicCombobox(c.grid, "Install Path") + c.InstallPath.AddText("/usr/bin") + c.InstallPath.AddText("/usr/local/bin") + c.InstallPath.AddText("/bin") + c.InstallPath.AddText("/opt/<pkg>/bin") + c.InstallPath.SetText("/usr/bin") + c.grid.NextRow() + + c.Maintainer = gadgets.NewOneLiner(c.grid, "Maintainer") + c.grid.NextRow() + + c.Packager = gadgets.NewBasicEntry(c.grid, "Packager") + c.grid.NextRow() + + c.GoPath = gadgets.NewBasicEntry(c.grid, "GoPath") + c.grid.NextRow() + + c.URL = gadgets.NewBasicEntry(c.grid, "URL") + c.grid.NextRow() + + c.Depends = gadgets.NewOneLiner(c.grid, "Depends") + c.grid.NextRow() + + c.BuildDepends = gadgets.NewOneLiner(c.grid, "Build-Depends") + c.grid.NextRow() + + c.Recommends = gadgets.NewOneLiner(c.grid, "Recommends") + c.grid.NextRow() + + c.Conflicts = gadgets.NewBasicEntry(c.grid, "Conflicts") + c.grid.NextRow() + + c.Description = gadgets.NewOneLiner(c.grid, "Description") + c.grid.NextRow() + + return c +} + +func updateControl(c *controlBox) { + c.URL.SetText(me.repo.URL) +} @@ -2,6 +2,8 @@ package main import ( "go.wit.com/dev/alexflint/arg" + "go.wit.com/gui" + "go.wit.com/lib/gadgets" "go.wit.com/lib/gui/prep" "go.wit.com/lib/protobuf/gitpb" ) @@ -17,3 +19,33 @@ type mainType struct { repo *gitpb.Repo // this is the repo we are in myGui *prep.GuiPrep // the gui toolkit handle } + +type controlBox struct { + group *gui.Node // the group + grid *gui.Node // the grid + + Package *gadgets.OneLiner + Source *gadgets.OneLiner + Version *gadgets.OneLiner + Maintainer *gadgets.OneLiner + Packager *gadgets.BasicEntry + GoPath *gadgets.BasicEntry + URL *gadgets.BasicEntry + Architecture *gadgets.BasicDropdown + InstallPath *gadgets.BasicCombobox + Depends *gadgets.OneLiner + BuildDepends *gadgets.OneLiner + Recommends *gadgets.OneLiner + Conflicts *gadgets.BasicEntry + Test gui.Widget + Description *gadgets.OneLiner + + // repostatus things + pathL *gadgets.OneLiner + lastTag *gadgets.OneLiner + dirtyL *gadgets.OneLiner + currentL *gadgets.OneLiner + buildDate *gadgets.OneLiner + tagDate *gadgets.BasicEntry + // status *repostatus.RepoStatus +} |
