summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-14 09:42:51 -0500
committerJeff Carr <[email protected]>2025-10-14 10:49:00 -0500
commitcd9cca720e44c9f3b690b6441d3e0b01b9963d59 (patch)
tree0977439467f27107af5dcb89db23a47266342b9d
parentaa08cfcbe50a94898728ee53a685abfbd223a7e4 (diff)
more housecleaning
-rw-r--r--argv.go2
-rw-r--r--doMake.go50
-rw-r--r--doNewest.go7
-rw-r--r--doRelease.go3
-rw-r--r--main.go14
5 files changed, 9 insertions, 67 deletions
diff --git a/argv.go b/argv.go
index 966356a..e7078a1 100644
--- a/argv.go
+++ b/argv.go
@@ -20,7 +20,6 @@ type args struct {
Incoming *IncomingCmd `arg:"subcommand:incoming" help:"handle the incoming directory"`
List *EmptyCmd `arg:"subcommand:list" help:"show the packages"`
Verify *EmptyCmd `arg:"subcommand:verify" help:"verify the pb is accurate and doesn't have errors"`
- MakeDists *EmptyCmd `arg:"subcommand:makedists" help:"make debian mirrors/dists files for 'apt update'"`
Newest *EmptyCmd `arg:"subcommand:newest" help:"make a list of the newest .deb packages"`
SignRelease *EmptyCmd `arg:"subcommand:release" help:"make & GPG sign the Release files"`
Everything *EmptyCmd `arg:"subcommand:everything" help:"do the whole thing needed. nothing more. just everything."`
@@ -28,7 +27,6 @@ type args struct {
DryRun bool `arg:"--dry-run" help:"only show what would be packaged"`
Verbose bool `arg:"--verbose" help:"be loud about it"`
Force bool `arg:"--force" help:"rebuild everything"`
- Create bool `arg:"--create" help:"create a new .pb file"`
}
type EmptyCmd struct {
diff --git a/doMake.go b/doMake.go
deleted file mode 100644
index 76ba16e..0000000
--- a/doMake.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package main
-
-import (
- "os"
- "strings"
-
- "go.wit.com/lib/debian"
- "go.wit.com/lib/protobuf/zoopb"
- "go.wit.com/log"
-)
-
-// os.Chdir(me.mirrorsDir)
-// makes the dists/ for 'apt update'
-func doMakeDists() (string, error) {
- var s string
- var err error
- os.Chdir(me.pb.BaseDir)
-
- /*
- for p := range me.pb.IterAll() {
- p.Print()
- return "printed one out", nil
- }
- s, err := me.pb.MakeDists()
- */
- return s, err
-}
-
-// make a list of the newest .deb files
-func doMakePackagesFile(all *zoopb.Packages) string {
- var pfile string
- for p := range all.IterAll() {
- var controlfile string
- parts, err := zoopb.GetDebInfoFields(p)
- if err != nil {
- log.Info(err)
- }
- for _, varname := range parts {
- varname, varval := debian.GetKeyFromPackagePB(p, varname)
- varval = strings.TrimSpace(varval)
- if varval == "" {
- continue
- }
- controlfile += log.Sprintf("%s: %s\n", varname, varval)
- }
- controlfile += log.Sprintf("\n")
- pfile += controlfile
- }
- return pfile
-}
diff --git a/doNewest.go b/doNewest.go
index 1670f0a..1016c21 100644
--- a/doNewest.go
+++ b/doNewest.go
@@ -4,6 +4,7 @@ import (
"time"
"go.wit.com/lib/cobol"
+ "go.wit.com/lib/config"
"go.wit.com/lib/protobuf/zoopb"
"go.wit.com/log"
)
@@ -18,7 +19,7 @@ func doGetNewest(arch string) *zoopb.Packages {
found := newest.FindByPackage(p.Package)
if found == nil {
// package is new
- if argv.Verbose {
+ if config.Verbose() {
log.Printf("%-20.20s %-20.20s %-80.80s\n", "new package", p.Package, p.Filename)
}
newest.Clone(p)
@@ -28,11 +29,11 @@ func doGetNewest(arch string) *zoopb.Packages {
newtime := found.Ctime.AsTime()
durs := cobol.Since(p.Ctime) + " vs found " + cobol.Since(found.Ctime)
if time.Since(curtime) > time.Since(newtime) {
- if argv.Verbose {
+ if config.Verbose() {
log.Printf("%-20.20s %-20.20s %-80.80s %s\n", "found is newer", p.Package, p.Filename, durs)
}
} else {
- if argv.Verbose {
+ if config.Verbose() {
log.Printf("%-20.20s %-20.20s %-80.80s %s\n", "found is older", p.Package, p.Filename, durs)
}
newest.Delete(found)
diff --git a/doRelease.go b/doRelease.go
index dee1baf..f99e9e4 100644
--- a/doRelease.go
+++ b/doRelease.go
@@ -12,6 +12,7 @@ import (
"time"
"go.wit.com/lib/config"
+ "go.wit.com/lib/debian"
"go.wit.com/lib/gui/shell"
"go.wit.com/log"
)
@@ -44,7 +45,7 @@ func doRelease() (string, error) {
newest := doGetNewest("amd64")
newest.SortPackage()
- thefile := doMakePackagesFile(newest)
+ thefile := debian.MakePackagesFile(newest)
fullname := "dists/sid/main/binary-amd64/Packages"
if err := os.WriteFile(fullname, []byte(thefile), os.ModePerm); err != nil {
return fullname, err
diff --git a/main.go b/main.go
index 7f86b60..0995076 100644
--- a/main.go
+++ b/main.go
@@ -31,13 +31,9 @@ func main() {
me.pb = zoopb.NewPackages()
me.pb.Filename = config.GetPanic("mirrors.pb")
if err := me.pb.Load(); err != nil {
- if argv.Create {
- me.pb.BaseDir = config.GetPanic("BaseDir")
- me.pb.Save()
- me.sh.GoodExit("created new pb file: " + me.pb.Filename)
- } else {
- me.sh.BadExit("no config found. use --create to create one", err)
- }
+ me.pb.BaseDir = config.GetPanic("BaseDir")
+ me.pb.Save()
+ me.sh.GoodExit("created new pb file: " + me.pb.Filename + ". rerun mirrors.")
}
// force check the PB variable
@@ -100,10 +96,6 @@ func main() {
s, err = doVerify()
}
- if argv.MakeDists != nil {
- s, err = doMakeDists()
- }
-
if argv.SignRelease != nil {
s, err = doRelease()
}