From 0f84c35582c4498e00839d782fea704cede98cd7 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 9 Oct 2025 06:59:47 -0500 Subject: processed all files to a .pb --- main.go | 16 ++++++++-------- structs.go | 6 ++++-- stuff.go | 8 +++++++- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/main.go b/main.go index e24fb14..5f70a23 100644 --- a/main.go +++ b/main.go @@ -33,11 +33,11 @@ func main() { } os.Chdir("/home/mirrors/wit") - pb := zoopb.NewPackages() - pb.Filename = "/home/mirrors/mirrors.wit.com.pb" - if err := config.Load(pb); err != nil { + me.pb = zoopb.NewPackages() + me.pb.Filename = "/home/mirrors/mirrors.wit.com.pb" + if err := config.Load(me.pb); err != nil { if argv.Force { - config.Save(pb) + config.Save(me.pb) } else { me.sh.BadExit("no config found. use --force to create one", err) } @@ -90,14 +90,14 @@ func main() { // todo: add to protomap } } - pb.AppendByFilename(newdeb) + me.pb.AppendByFilename(newdeb) // arch := deb.ControlData["Architecture"] } - footer := pb.PrintTable() + footer := me.pb.PrintTable() log.Info("found so far:", footer) - config.Save(pb) - log.Info("len", pb.Len()) + config.Save(me.pb) + log.Info("len", me.pb.Len()) me.sh.GoodExit("nothing to do") } diff --git a/structs.go b/structs.go index c0d5cb1..b18e9a6 100644 --- a/structs.go +++ b/structs.go @@ -4,6 +4,7 @@ import ( "sync" "go.wit.com/lib/gui/prep" + "go.wit.com/lib/protobuf/zoopb" ) // --- Configuration --- @@ -32,7 +33,8 @@ var me *mainType // this app's variables type mainType struct { - once sync.Once // one-time initialized data - sh *prep.Auto // more experiments for bash handling + once sync.Once // one-time initialized data + sh *prep.Auto // more experiments for bash handling + pb *zoopb.Packages // the mirrors packages // forge *forgepb.Forge // your customized repo preferences and settings } diff --git a/stuff.go b/stuff.go index 38a68e8..7fdc531 100644 --- a/stuff.go +++ b/stuff.go @@ -9,12 +9,13 @@ import ( "crypto/sha256" "fmt" "io" - "log" "os" "os/exec" "path/filepath" "strings" "time" + + "go.wit.com/log" ) // scanDebs finds all .deb files and extracts their metadata. @@ -26,6 +27,11 @@ func scanDebs(root string, count int) ([]DebInfo, error) { return err } if !info.IsDir() && strings.HasSuffix(info.Name(), ".deb") { + found := me.pb.FindByFilename(path) + if found != nil { + log.Info("already processed", path) + return nil + } if count == -1 { return nil } -- cgit v1.2.3