diff options
| -rw-r--r-- | main.go | 16 | ||||
| -rw-r--r-- | structs.go | 6 | ||||
| -rw-r--r-- | stuff.go | 8 |
3 files changed, 19 insertions, 11 deletions
@@ -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") } @@ -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 } @@ -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 } |
