summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doList.go30
-rw-r--r--doWalk.go7
-rw-r--r--main.go11
-rw-r--r--stuff.go2
4 files changed, 39 insertions, 11 deletions
diff --git a/doList.go b/doList.go
new file mode 100644
index 0000000..e46e7db
--- /dev/null
+++ b/doList.go
@@ -0,0 +1,30 @@
+package main
+
+import (
+ "os"
+
+ "go.wit.com/lib/config"
+ "go.wit.com/log"
+)
+
+func doList() (string, error) {
+ os.Chdir(me.mirrorsDir)
+ footer := me.pb.PrintTable()
+ log.Info("found so far:", footer)
+
+ var changed bool
+ for p := range me.pb.IterAll() {
+ if config.Exists(p.Filename) {
+ // everything is fine
+ continue
+ }
+ log.Info("deleting missing file from PB", p.Package, p.Filename)
+ me.pb.Delete(p)
+ changed = true
+ }
+
+ if changed {
+ me.pb.Save()
+ }
+ return footer, nil
+}
diff --git a/doWalk.go b/doWalk.go
index 0e0f3b4..a72fc5a 100644
--- a/doWalk.go
+++ b/doWalk.go
@@ -3,8 +3,8 @@ package main
import (
"os"
- "go.wit.com/lib/config"
"go.wit.com/lib/debian"
+ "go.wit.com/lib/gui/shell"
"go.wit.com/lib/protobuf/zoopb"
"go.wit.com/log"
"google.golang.org/protobuf/encoding/prototext"
@@ -39,7 +39,7 @@ func doWalk() (string, error) {
case "Version":
newdeb.Version = varvalue
case "Git-Tag-Date":
- log.Info("CONVERT THIS TO TIME", varvalue)
+ log.Info("CONVERT THIS TO TIME", varname, varvalue)
case "Depends":
newdeb.Depends = varvalue
case "Build-Depends":
@@ -63,6 +63,7 @@ func doWalk() (string, error) {
}
counter += 1
me.pb.AppendByFilename(newdeb)
+ shell.RunVerbose([]string{"dpkg", "-I", newdeb.Filename})
log.Info(prototext.Format(newdeb))
// arch := deb.ControlData["Architecture"]
}
@@ -70,7 +71,7 @@ func doWalk() (string, error) {
// footer := me.pb.PrintTable()
// log.Info("found so far:", footer)
- config.Save(me.pb)
+ me.pb.Save()
log.Printf("add %d new packages. Total packages.Len()=%d\n", counter, me.pb.Len())
return "/home/mirrors/wit/ has been scanned for ne files", nil
}
diff --git a/main.go b/main.go
index cf777e0..a1a5664 100644
--- a/main.go
+++ b/main.go
@@ -28,7 +28,7 @@ func main() {
// read in protobuf file
me.pb = zoopb.NewPackages()
me.pb.Filename = "/home/mirrors/mirrors.wit.com.pb"
- if err := config.Load(me.pb); err != nil {
+ if err := me.pb.Load(); err != nil {
if argv.Force {
config.Save(me.pb)
} else {
@@ -46,18 +46,15 @@ func main() {
var s string
var err error
if argv.Incoming != nil {
- if s, err = doIncoming(); err != nil {
- }
+ s, err = doIncoming()
}
if argv.Walk != nil {
- if s, err = doWalk(); err != nil {
- }
+ s, err = doWalk()
}
if argv.List != nil {
- footer := me.pb.PrintTable()
- log.Info("found so far:", footer)
+ s, err = doList()
}
if argv.Update != nil {
diff --git a/stuff.go b/stuff.go
index faf4cbb..ca3a618 100644
--- a/stuff.go
+++ b/stuff.go
@@ -39,7 +39,7 @@ func scanDebs(root string, count int) ([]DebInfo, error) {
if counter > count {
return nil
}
- log.Printf(" -> Processing %s", path)
+ log.Printf(" -> Processing %s\n", path)
// Get control info
cmd := exec.Command("dpkg-deb", "-I", path)