diff options
| author | Jeff Carr <[email protected]> | 2025-10-15 07:52:53 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-15 07:52:53 -0500 |
| commit | a5171316b4335c69ca6ad946a37260b939fd7494 (patch) | |
| tree | 922cb154a016d5e3d5c948f73c415a0db31fe649 | |
| parent | 769ab0c88b51a10124b7328b937fa35dad1c7cb4 (diff) | |
rm old braindamaged code that I wrote long ago
| -rw-r--r-- | Makefile | 4 | ||||
| -rw-r--r-- | argv.go | 2 | ||||
| -rw-r--r-- | control.read.go | 17 | ||||
| -rw-r--r-- | control.write.go | 109 | ||||
| -rw-r--r-- | main.go | 2 |
5 files changed, 4 insertions, 130 deletions
@@ -4,8 +4,8 @@ VERSION = $(shell git describe --tags) BUILDTIME = $(shell date +%s) run: clean goimports vet install - go-deb --buildversion "+b3" - go-deb --keep-files --arch riscv64 --buildversion "+b3" + go-deb --buildversion "4" + go-deb --keep-files --arch riscv64 --buildversion "4" # builds a .deb of go-deb and writes the file here in this directory deb.default: @@ -20,7 +20,7 @@ type args struct { 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"` + BuildVersion int `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"` diff --git a/control.read.go b/control.read.go deleted file mode 100644 index 672b99b..0000000 --- a/control.read.go +++ /dev/null @@ -1,17 +0,0 @@ -package main - -/* -func trimNonNumericPrefix(s string) string { - // Find the index of the first character that IS a digit. - firstDigitIndex := strings.IndexFunc(s, unicode.IsDigit) - - // If no digit is found, IndexFunc returns -1. - // In this case, the result should be an empty string. - if firstDigitIndex == -1 { - return "" - } - - // Return the substring starting from the first digit. - return s[firstDigitIndex:] -} -*/ diff --git a/control.write.go b/control.write.go deleted file mode 100644 index b161430..0000000 --- a/control.write.go +++ /dev/null @@ -1,109 +0,0 @@ -package main - -/* -The default order to write the fields in the control file: - -root@mirrors:/home/mirrors/debian/pool/main/m/moon-buggy# dpkg -I moon-buggy_1.0.51-15_arm64.deb - new Debian package, version 2.0. - size 196540 bytes: control archive=6240 bytes. - 202 bytes, 12 lines * config #!/bin/sh - 601 bytes, 14 lines control - 1020 bytes, 15 lines md5sums - 1757 bytes, 59 lines * postinst #!/bin/sh - 551 bytes, 22 lines * postrm #!/bin/sh - 11703 bytes, 104 lines templates - Package: moon-buggy - Version: 1:1.0.51-15 - Architecture: arm64 - Maintainer: Christian T. Steigies <[email protected]> - Installed-Size: 329 - Depends: debconf (>= 0.5) | debconf-2.0, libc6 (>= 2.34), libncurses6 (>= 6), libtinfo6 (>= 6) - Conflicts: moon-buggy-pause, suidmanager (<< 0.50) - Section: games - Priority: optional - Homepage: http://seehuhn.de/pages/moon-buggy - Description: Drive a car across the moon - Moon-buggy is a simple character graphics game, where you drive some - kind of car across the moon's surface. Unfortunately there are - 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) - if err != nil { - log.Info("open control file failed", err) - return false - } - fmt.Fprintln(cf, "Package:", repo.Control["Package"]) // c.Package.String()) - // never do Source as it has something to do with where aptly puts the files - // fmt.Fprintln(cf, "Source:", repo.Control["Source"]) // c.Source.String()) - fmt.Fprintln(cf, "Version:", repo.Control["Version"]) - if repo.Control["Architecture"] == "" { - repo.Control["Architecture"] = argv.Arch - } - fmt.Fprintln(cf, "Architecture:", repo.Control["Architecture"]) // c.Architecture.String()) - - writeControlVar(cf, repo, "Maintainer") - fmt.Fprintln(cf, "Installed-Size::", "2097152") // fixme. du -s files/ - writeControlVar(cf, repo, "Depends") - writeControlVar(cf, repo, "Build-Depends") - writeControlVar(cf, repo, "Conflicts") - writeControlVar(cf, repo, "Packager") - writeControlVar(cf, repo, "GoPath") - writeControlVar(cf, repo, "URL") - - t := time.Now() - // update to now now despite what the GUI is showing - fmt.Fprintln(cf, "Package-Build-Date:", cobol.Time(t)) - fmt.Fprintln(cf, "Git-Tag-Date:", "go-deb todo: get this from git") - - 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 -} - -func writeControlVar(f *os.File, repo *gitpb.Repo, varname string) { - val, _ := repo.Control[varname] - if val == "" { - return - } - // fix this when this code is rewritten to use the .proto - if varname == "URL" { - varname = "Homepage" - } - fmt.Fprintln(f, varname+":", val) -} - -// try to guess or figure out the config file values -// if there is not a control file -func computeControlValues(repo *gitpb.Repo) bool { - if repo.Control["Package"] == "" { - // get the package name from the repo name - path := repo.Control["pathL"] // c.pathL.String() - parts := strings.Split(path, "/") - name := parts[len(parts)-1] - repo.Control["Package"] = name - } - if repo.Control["Source"] == "" { - repo.Control["Source"] = repo.Control["Package"] - } - if repo.Control["Build-Depends"] == "" { - repo.Control["Build-Depends"] = repo.Control["golang"] - } - if repo.Control["Recommends"] == "" { - repo.Control["Recommends"] = repo.Control["go-gui-toolkits"] - } - if repo.Control["Maintainer"] == "" { - repo.Control["Maintainer"] = "todo: get from ENV" - } - if repo.Control["Description"] == "" { - repo.Control["Description"] = "todo: put URL here" - } - return true -} -*/ @@ -56,7 +56,7 @@ func main() { } else { me.pb.Architecture = argv.Arch } - me.pb.Version = me.repo.DebianCurrentVersion(3) + me.pb.Version = me.repo.DebianCurrentVersion(argv.BuildVersion) me.pb.DebInfo.InstalledSize = "2222" // just to make the control file work me.pb.DebInfo.URL = me.repo.URL me.pb.DebInfo.Homepage = me.repo.URL // deprecate this usage (?) |
