From f7f02647de5f52c23202e5c2c67954bfa5af1007 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 15 Oct 2025 05:34:36 -0500 Subject: add Recommends --- argv.go | 25 +++++++++++++------------ build.go | 9 ++++++--- control | 5 +++-- main.go | 21 +++++++++++++++++++-- structs.go | 6 +++--- 5 files changed, 44 insertions(+), 22 deletions(-) diff --git a/argv.go b/argv.go index 62017fd..4cc8798 100644 --- a/argv.go +++ b/argv.go @@ -13,17 +13,18 @@ import ( */ type args struct { - Show *EmptyCmd `arg:"subcommand:show" help:"show what would be done"` - Gui *EmptyCmd `arg:"subcommand:gui" help:"open the gui"` - Dump *EmptyCmd `arg:"subcommand:dump" help:"dump out the future control file"` - Ldflags []string `arg:"--ldflags" help:"flags to pass to go build"` - OutDir string `arg:"--dir" help:"write .deb file into this directory"` - Namespace string `arg:"--namespace" help:"the namespace of the repo"` - Arch string `arg:"--arch" help:"what arch"` - KeepFiles bool `arg:"--keep-files" help:"keep the build files/"` - Release bool `arg:"--release" help:"build version from the @latest git tag"` - Force bool `arg:"--force" default:"false" help:"force overwrite an existing .deb file"` - Verbose bool `arg:"--verbose" help:"show more things"` + Show *EmptyCmd `arg:"subcommand:show" help:"show what would be done"` + Gui *EmptyCmd `arg:"subcommand:gui" help:"open the gui"` + Dump *EmptyCmd `arg:"subcommand:dump" help:"dump out the future control file"` + Ldflags []string `arg:"--ldflags" help:"flags to pass to go build"` + OutDir string `arg:"--dir" help:"write .deb file into this directory"` + Namespace string `arg:"--namespace" help:"the namespace of the repo"` + Arch string `arg:"--arch" help:"what arch"` + BuildVersion string `arg:"--buildversion" help:"what arch"` + KeepFiles bool `arg:"--keep-files" help:"keep the build files/"` + Release bool `arg:"--release" help:"build version from the @latest git tag"` + Force bool `arg:"--force" default:"false" help:"force overwrite an existing .deb file"` + Verbose bool `arg:"--verbose" help:"show more things"` } func (args) Examples() string { @@ -61,7 +62,7 @@ func (args) Buildtime() (string, string) { func (a args) DoAutoComplete(pb *prep.Auto) { if pb.Cmd == "" { - pb.Autocomplete3([]string{"dump", "gui", "show", "--version", "--keep-files"}) + pb.Autocomplete3([]string{"dump", "gui", "show", "--version", "--keep-files", "--buildversion"}) } else { pb.SubCommand(pb.Goargs...) } diff --git a/build.go b/build.go index 13bafde..45bdc11 100644 --- a/build.go +++ b/build.go @@ -31,9 +31,12 @@ func buildPackage(repo *gitpb.Repo) (bool, error) { if arch == "" { arch = argv.Arch } - const layout = "200601021504" - now := time.Now().UTC() - version := repo.Control["Version"] + "-" + now.Format(layout) + // const layout = "200601021504" + // now := time.Now().UTC() + version := repo.Control["Version"] + if argv.BuildVersion != "" { + version += argv.BuildVersion + } repo.Control["Version"] = version log.Info("version is:", version) // debver := version + "-" + now.Format(layout) diff --git a/control b/control index a232680..cb392f8 100644 --- a/control +++ b/control @@ -1,10 +1,11 @@ -Source: go-deb Build-Depends: golang Package: go-deb Maintainer: Jeff Carr -Packager: Jeff Carr Depends: go-gui-toolkits Namespace: go.wit.com/apps/go-deb Recommends: Description: create .deb packages for anything A person can dream anyway. Examples in the sources. + Hopefully this conforms to the debian versioning scheme. + Submit patches using 'forge'. + go install go.wit.com/apps/forge@latest diff --git a/main.go b/main.go index ce49aa6..d1eb8fc 100644 --- a/main.go +++ b/main.go @@ -6,8 +6,10 @@ import ( "path/filepath" "time" + "go.wit.com/lib/debian" "go.wit.com/lib/gui/prep" "go.wit.com/lib/protobuf/gitpb" + "go.wit.com/lib/protobuf/zoopb" "go.wit.com/log" ) @@ -27,7 +29,7 @@ func main() { wd, err := os.Getwd() if err != nil { - badExit(err) + me.sh.BadExit("your current directory does not exist err=", err) } if argv.Arch == "" { @@ -37,9 +39,24 @@ func main() { me.repo, err = gitpb.NewRepo(wd) if err != nil { - badExit(err) + me.sh.BadExit("is this really a .git directory? err=", err) } + data, err := os.ReadFile("control") + if err != nil { + me.sh.BadExit("you don't have a 'control' file", err) + } + + log.Info("INITIAL PARSE:") + log.Info(string(data)) + dpkgPB := new(zoopb.Package) + debian.ParseDpkgOutputIntoPB(dpkgPB, string(data)) + log.Info("INITIAL PARSE RESULT:") + controlfile := debian.MakeControlFile(dpkgPB) + log.Info(controlfile) + log.Info("INITIAL PARSE END") + me.sh.GoodExit("rewriting this app") + // build() if argv.Show != nil { log.Info("todo: show", me.repo.Namespace) diff --git a/structs.go b/structs.go index f7926da..00d46d9 100644 --- a/structs.go +++ b/structs.go @@ -44,9 +44,9 @@ type controlBox struct { Description *gadgets.OneLiner // repostatus things - pathL *gadgets.OneLiner - lastTag *gadgets.OneLiner - dirtyL *gadgets.OneLiner + pathL *gadgets.OneLiner + lastTag *gadgets.OneLiner + // dirtyL *gadgets.OneLiner currentL *gadgets.OneLiner buildDate *gadgets.OneLiner tagDate *gadgets.BasicEntry -- cgit v1.2.3