diff options
Diffstat (limited to 'doEverything.go')
| -rw-r--r-- | doEverything.go | 48 |
1 files changed, 18 insertions, 30 deletions
diff --git a/doEverything.go b/doEverything.go index 7418eeb..c17cb68 100644 --- a/doEverything.go +++ b/doEverything.go @@ -10,9 +10,7 @@ import ( "strings" "time" - "go.wit.com/lib/cobol" "go.wit.com/lib/gui/shell" - "go.wit.com/lib/protobuf/zoopb" "go.wit.com/log" ) @@ -47,37 +45,13 @@ func doEverything() (string, error) { log.Info("Processing dir", filepath.Join(me.pb.BaseDir, "pool")) - arch := "amd64" + // arch := "amd64" - newest := zoopb.NewPackages() - for p := range me.pb.IterAll() { - if p.Architecture != arch { - continue - } - found := newest.FindByPackage(p.Package) - if found == nil { - // package is new - log.Printf("%-20.20s %-20.20s %-80.80s\n", "new package", p.Package, p.Filename) - newest.Clone(p) - continue - } - curtime := p.Ctime.AsTime() - newtime := found.Ctime.AsTime() - durs := cobol.Since(p.Ctime) + " vs found " + cobol.Since(found.Ctime) - if time.Since(curtime) > time.Since(newtime) { - log.Printf("%-20.20s %-20.20s %-80.80s %s\n", "found is newer", p.Package, p.Filename, durs) - } else { - log.Printf("%-20.20s %-20.20s %-80.80s %s\n", "found is older", p.Package, p.Filename, durs) - newest.Delete(found) - newest.Clone(p) - } - } - - // sort the packages & write out the Packages file + newest := doGetNewest("amd64") newest.SortPackage() thefile := doMakePackagesFile(newest) fullname := "/home/mirrors/wit/dists/sid/main/binary-amd64/Packages" - if err := os.WriteFile(fullname, []byte(thefile), 0644); err != nil { + if err := os.WriteFile(fullname, []byte(thefile), os.ModePerm); err != nil { return fullname, err } @@ -162,5 +136,19 @@ func doEverything() (string, error) { sum = fmt.Sprintf("%x", sha256.Sum256(fileBytes)) */ - return "doNewest", nil + log.Info("") + log.Info("Finished Everything") + log.Info("") + log.Info("Package file:", fullname) + log.Info("Release file:", releasePath) + log.Info("InRelease file:", filepath.Join(distPath, "InRelease")) + log.Info("Local file:", "/var/lib/apt/lists/mirrors.wit.com_wit_dists_sid_main_binary-amd64_Packages") + cmd := []string{"apt-get", "update"} + cmd = append(cmd, "-o", "Dir::Etc::sourcelist=/etc/apt/sources.list.d/wit.list") + cmd = append(cmd, "-o", "Dir::Etc::sourceparts=/dev/null") + cmd = append(cmd, "-o", "APT::Get::List-Cleanup=0") + log.Info("apt update :", cmd) + log.Info("") + + return "did everything", nil } |
