better control file value handling

This commit is contained in:
Jeff Carr 2024-11-19 05:30:56 -06:00
parent 1c2246e709
commit 4bf2379357
6 changed files with 39 additions and 16 deletions

View File

@ -52,7 +52,7 @@ func (c *controlBox) addRepo(path string) {
stamp := time.Now().UTC().Format("2006/01/02 15:04:05 UTC")
c.buildDate.SetText(stamp)
c.tagDate = gadgets.NewOneLiner(c.grid, "git tag Date")
c.tagDate = gadgets.NewBasicEntry(c.grid, "git tag Date")
c.grid.NextRow()
err, repo := repostatus.NewRepoStatusWindow(path)

View File

@ -220,15 +220,29 @@ func (c *controlBox) writeDebianControlFile() bool {
fmt.Fprintln(cf, "Source:", c.Source.String())
fmt.Fprintln(cf, "Version:", c.Version.String())
fmt.Fprintln(cf, "Architecture:", c.Architecture.String())
fmt.Fprintln(cf, "Depends:", c.Depends.String())
fmt.Fprintln(cf, "Build-Depends:", c.BuildDepends.String())
if c.Depends.String() != "" {
fmt.Fprintln(cf, "Depends:", c.Depends.String())
}
if c.BuildDepends.String() != "" {
fmt.Fprintln(cf, "Build-Depends:", c.BuildDepends.String())
}
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:", c.tagDate.String())
if c.tagDate.String() == "" {
// todo: allow this to be set somehow
} else {
fmt.Fprintln(cf, "Git-Tag-Date:", c.tagDate.String())
}
fmt.Fprintln(cf, "Maintainer:", c.Maintainer.String())
fmt.Fprintln(cf, "Conflicts:", c.Conflicts.String())
fmt.Fprintln(cf, "Packager:", c.Packager.String())
if c.URL.String() != "" {
fmt.Fprintln(cf, "URL:", c.URL.String())
}
if c.Conflicts.String() != "" {
fmt.Fprintln(cf, "Conflicts:", c.Conflicts.String())
}
desc := c.Description.String()
parts := strings.Split(desc, "\n")
@ -258,7 +272,7 @@ func (c *controlBox) computeControlValues() bool {
}
// TODO: get this from the git log
if c.Maintainer.String() == "" {
c.Maintainer.SetText("Jeff Carr <jcarr@wit.com>")
c.Maintainer.SetText("made by go-deb")
}
// TODO: get this from gitea (or gitlab or github, etc)
// or from the README.md ?

View File

@ -14,6 +14,8 @@ type controlBox struct {
Source *gadgets.OneLiner
Version *gadgets.OneLiner
Maintainer *gadgets.OneLiner
Packager *gadgets.BasicEntry
URL *gadgets.BasicEntry
Architecture *gadgets.BasicDropdown
InstallPath *gadgets.BasicCombobox
Depends *gadgets.OneLiner
@ -29,7 +31,7 @@ type controlBox struct {
dirtyL *gadgets.OneLiner
currentL *gadgets.OneLiner
buildDate *gadgets.OneLiner
tagDate *gadgets.OneLiner
tagDate *gadgets.BasicEntry
status *repostatus.RepoStatus
}
@ -72,6 +74,12 @@ func newControl(parent *gui.Node) *controlBox {
c.Maintainer = gadgets.NewOneLiner(c.grid, "Maintainer")
c.grid.NextRow()
c.Packager = gadgets.NewBasicEntry(c.grid, "Packager")
c.grid.NextRow()
c.URL = gadgets.NewBasicEntry(c.grid, "URL")
c.grid.NextRow()
c.Depends = gadgets.NewOneLiner(c.grid, "Depends")
c.grid.NextRow()

View File

@ -1,11 +1,10 @@
Source:
Package: pkgsite
Build-Depends:
Maintainer: golang <?@golang.org>
Maintainer: https://golang.org/x/pkgsite
Packager: Jeff Carr <jcarr@wit.com>
Architecture: amd64
Depends:
URL: golang.org/x/pkgsite
Source: go-clone golang.org/x/pkgsite
URL: https://golang.org/x/pkgsite
Version: 0.0.1
Description: pkgsite
This was packaged with go-deb from go.wit.com

View File

@ -1,14 +1,12 @@
Source: google.golang.org.protobuf
Source: go-clone google.golang.org/protobuf
Build-Depends: golang
Package: protoc-gen-go-wit
Maintainer: Jeff Carr <jcarr@wit.com>
Maintainer: https://google.golang.org/protobuf/
Packager: Jeff Carr <jcarr@wit.com>
Architecture: amd64
Depends: protobuf-compiler
Conflicts: protoc-gen-go, protoc-gen-go-1-3, protoc-gen-go-1-5
URL: https://go.wit.com/
Recommends:
Version: 1.35.1-devel
Description: protoc-gen-go from google.golang.org/protobuf
You need this one until the debian sid packages are updated
I didn't change anything, it's a straight build from the sources.

View File

@ -58,13 +58,17 @@ func (c *controlBox) readControlFile() error {
for key, value := range pairs {
switch key {
case "Source":
// log.Info("FOUND Source!", value) c.Source.SetText(value)
c.Source.SetText(value)
case "Build-Depends":
c.BuildDepends.SetText(value)
case "Description":
c.Description.SetText(value)
case "Maintainer":
c.Maintainer.SetText(value)
case "Packager":
c.Packager.SetText(value)
case "URL":
c.URL.SetText(value)
case "Depends":
c.Depends.SetText(value)
case "Recommends":