diff options
| author | Jeff Carr <[email protected]> | 2025-10-10 11:52:51 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-10 16:22:18 -0500 |
| commit | e66e515eb9a65aaa1743ddbac4b77ffba996af7f (patch) | |
| tree | d626e4d88231b49cff32fe1dd2f5afb989868551 /doWalk.go | |
| parent | 5cc996fb000749369a339b850c1f2f2218892537 (diff) | |
walking works better. pb debInfo working
Diffstat (limited to 'doWalk.go')
| -rw-r--r-- | doWalk.go | 42 |
1 files changed, 32 insertions, 10 deletions
@@ -2,12 +2,15 @@ package main import ( "os" + "strings" + "time" "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" + "google.golang.org/protobuf/types/known/timestamppb" ) func doWalk() (string, error) { @@ -15,7 +18,7 @@ func doWalk() (string, error) { // 2. Scan pool directory for .deb files and gather info log.Printf("Scanning for .deb files in %s\n", poolDir) - debInfos, err := scanDebs(poolDir, 35) + debInfos, err := scanDebs(poolDir, 200) if err != nil { log.Printf("Failed to scan .deb files: %v\n", err) me.sh.BadExit("scan pool scan dir", err) @@ -25,6 +28,7 @@ func doWalk() (string, error) { for _, deb := range debInfos { newdeb := new(zoopb.Package) newdeb.DebInfo = new(zoopb.DebInfo) + newdeb.Filename = deb.Filename newdeb.DebInfo.Filename = deb.Filename newdeb.DebInfo.MD5SUM = deb.MD5Sum newdeb.DebInfo.SHA1 = deb.SHA1Sum @@ -42,7 +46,9 @@ func doWalk() (string, error) { case "Architecture": newdeb.Architecture = varvalue case "Git-Tag-Date": - log.Info("CONVERT THIS TO TIME", varname, varvalue) + if argv.Verbose { + log.Info("CONVERT THIS TO TIME", varname, varvalue) + } case "Depends": newdeb.DebInfo.Depends = varvalue case "Build-Depends": @@ -50,23 +56,39 @@ func doWalk() (string, error) { case "Packager": newdeb.DebInfo.Packager = varvalue case "Package-Build-Date": - varvalue = "PackageBuildDate" - log.Info("CONVERT THIS TO TIME", varname, varvalue) + varname = "PackageBuildDate" + const layout = "2006/01/02 15:04:05 MST" + parsedTime, err := time.Parse(layout, varvalue) + if err != nil { + log.Info("CONVERT TO TIME failed", varname, varvalue, err) + } + newdeb.BuildDate = timestamppb.New(parsedTime) case "URL": newdeb.DebInfo.Homepage = varvalue default: - if ok, err := debian.SetString(newdeb, varname, varvalue); ok { - continue - } else if err != nil { - log.Printf("%v VAR='%s' VAL='%s'\n", err, varname, varvalue) + if err := debian.SetDebInfoString(newdeb, varname, varvalue); err == nil { + if argv.Verbose { + log.Printf("Searching for Sugarman WORKED: VAR='%-30s' VAL='%s'\n", varname, varvalue) + } + } else { + log.Printf("Searching for Sugarman FAILED: VAR='%-30s' VAL='%s' err=%v\n", varname, varvalue, err) } // todo: add to protomap } } counter += 1 me.pb.AppendByFilename(newdeb) - shell.RunVerbose([]string{"dpkg", "-I", newdeb.Filename}) - log.Info(prototext.Format(newdeb)) + if newdeb.Filename == "" { + log.Info(deb) + log.Info("file=", deb.Filename) + panic("newdeb.Filename = ''") + } + if argv.Verbose { + shell.RunVerbose([]string{"dpkg", "-I", newdeb.Filename}) + log.Info("\nNEW PB START") + log.Info(strings.TrimSpace(prototext.Format(newdeb))) + log.Info("NEW PB END\n") + } // arch := deb.ControlData["Architecture"] } |
