diff options
| author | Jeff Carr <[email protected]> | 2025-10-15 06:08:15 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-15 06:08:15 -0500 |
| commit | 5d0a2d4a095d87fbada8a7c5e1e2bf0f5efa648c (patch) | |
| tree | cc2500733a4f4e8547d6b3b49dcb65b76266b083 | |
| parent | f7f02647de5f52c23202e5c2c67954bfa5af1007 (diff) | |
rewrite this ancient code
| -rw-r--r-- | Makefile | 3 | ||||
| -rw-r--r-- | build.go | 11 | ||||
| -rw-r--r-- | control.write.go | 34 | ||||
| -rw-r--r-- | doGui.go | 12 | ||||
| -rw-r--r-- | main.go | 20 | ||||
| -rw-r--r-- | structs.go | 8 |
6 files changed, 36 insertions, 52 deletions
@@ -4,7 +4,8 @@ VERSION = $(shell git describe --tags) BUILDTIME = $(shell date +%s) run: clean goimports vet install - go-deb --keep-files --arch riscv64 + go-deb --buildversion "+b3" + go-deb --keep-files --arch riscv64 --buildversion "+b3" # builds a .deb of go-deb and writes the file here in this directory deb.default: @@ -7,6 +7,7 @@ import ( "path/filepath" "time" + "go.wit.com/lib/debian" "go.wit.com/lib/gui/shell" "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" @@ -217,9 +218,15 @@ func buildPackage(repo *gitpb.Repo) (bool, error) { } } - if !writeDebianControlFile(repo) { - return false, errors.New("write control file") + controlfile := debian.MakeControlFile(me.pb) + controlfile += "\n" + log.Info(controlfile) + if err := os.WriteFile("files/DEBIAN/control", []byte(controlfile), 0644); err != nil { + me.sh.BadExit("write err files/DEBIAN/control", err) } + // if !writeDebianControlFile(repo) { + // return false, errors.New("write control file") + // } if shell.Exists("postinst") { repo.RunVerbose([]string{"cp", "postinst", "files/DEBIAN/"}) } diff --git a/control.write.go b/control.write.go index 2ee4cad..b161430 100644 --- a/control.write.go +++ b/control.write.go @@ -1,16 +1,5 @@ package main -import ( - "fmt" - "os" - "strings" - "time" - - "go.wit.com/lib/cobol" - "go.wit.com/lib/protobuf/gitpb" - "go.wit.com/log" -) - /* The default order to write the fields in the control file: @@ -39,6 +28,7 @@ root@mirrors:/home/mirrors/debian/pool/main/m/moon-buggy# dpkg -I moon-buggy_1.0 dangerous craters there. Fortunately your car can jump over them! */ +/* func writeDebianControlFile(repo *gitpb.Repo) bool { filename := "files/DEBIAN/control" cf, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644) @@ -116,26 +106,4 @@ func computeControlValues(repo *gitpb.Repo) bool { } return true } - -/* -// stamp := time.Now().UTC().Format("2006/01/02 15:04:05 UTC") - -func getDateStamp(tag string) string { - var r cmd.Status - r = me.repo.Run([]string{"git", "log", "-1", "--format=%at", tag}) - - out := strings.Join(r.Stdout, "\n") - out = strings.TrimSpace(out) - - // Convert the string to an integer - gitTagTimestampInt, err := strconv.ParseInt(out, 10, 64) - if err != nil { - fmt.Println("Error converting timestamp:", err) - return "git tag " + tag + " unknown" - } - - // Parse the Unix timestamp into a time.Time object - gitTagDate := time.Unix(gitTagTimestampInt, 0) - return gitTagDate.UTC().Format("2006-01-02_15:04:05_UTC") // close to RFC3339 -} */ @@ -4,17 +4,18 @@ package main import ( - "os" - - "go.wit.com/gui" - "go.wit.com/lib/gadgets" - "go.wit.com/lib/gui/shell" "go.wit.com/log" ) // An app to submit patches for the 30 GO GUI repos func doGui() { + log.Info("The GUI is disabled for now. This app is under development currently") + me.sh.GoodExit("it works fine from the command line") +} + +/* +func doGuiTODO() { log.Warn("init basicWindow state") win := gadgets.NewGenericWindow("Create .deb files for GO applications", "things") win.Custom = func() { @@ -130,3 +131,4 @@ func newControl(grid *gui.Node) *controlBox { return c } +*/ @@ -26,6 +26,7 @@ var argv args func main() { me = new(mainType) me.sh = prep.Autocomplete(&argv) // adds shell auto complete to go-args + me.pb = new(zoopb.Package) wd, err := os.Getwd() if err != nil { @@ -49,13 +50,20 @@ func main() { log.Info("INITIAL PARSE:") log.Info(string(data)) - dpkgPB := new(zoopb.Package) - debian.ParseDpkgOutputIntoPB(dpkgPB, string(data)) + debian.ParseDpkgOutputIntoPB(me.pb, string(data)) + if argv.Arch == "" { + me.pb.Architecture = "amd64" + } else { + me.pb.Architecture = argv.Arch + } + me.pb.Version = trimNonNumericPrefix(me.repo.GetCurrentVersion()) + me.pb.DebInfo.URL = me.repo.URL + me.pb.DebInfo.Homepage = me.repo.URL // deprecate this usage (?) log.Info("INITIAL PARSE RESULT:") - controlfile := debian.MakeControlFile(dpkgPB) + controlfile := debian.MakeControlFile(me.pb) log.Info(controlfile) log.Info("INITIAL PARSE END") - me.sh.GoodExit("rewriting this app") + // me.sh.GoodExit("rewriting this app") // build() if argv.Show != nil { @@ -77,7 +85,7 @@ func main() { debpath = me.repo.GetFullPath() } _, basename := filepath.Split(debpath) - me.goPath = basename + me.repo.Namespace = basename os.Chdir(debpath) // look for a 'config' file in the repo @@ -86,7 +94,7 @@ func main() { } else { log.Warn("scan failed") } - computeControlValues(me.repo) + // computeControlValues(me.repo) if argv.Dump != nil { for v := range me.repo.Control { @@ -6,6 +6,7 @@ import ( "go.wit.com/lib/gadgets" "go.wit.com/lib/gui/prep" "go.wit.com/lib/protobuf/gitpb" + "go.wit.com/lib/protobuf/zoopb" ) var me *mainType @@ -15,11 +16,8 @@ type mainType struct { sh *prep.Auto // more experiments for bash handling myGui *fhelp.GuiPrep // the gui handle itself origGui *gui.Node // the gui handle itself - - goSrc string // path to ~/go/src or go.work file - goPath string // the goPath to use for the package - hasWork bool // true if using go.work file - repo *gitpb.Repo // this is the repo we are in + pb *zoopb.Package // the .deb package protobuf + repo *gitpb.Repo // this is the repo we are in } type controlBox struct { |
