summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-15 05:34:44 -0500
committerJeff Carr <[email protected]>2025-10-15 05:34:44 -0500
commit291f68c2e5e8b7d10ea62c92b1b67c31d5207ca2 (patch)
treec68f838776411c7b602c44d36b29ff9c44bc29fb
parent4edcd924f3ba12bdcf952c563657d7d4cc8b8165 (diff)
fix Description
-rw-r--r--getKeyFromPackaagePB.go12
-rw-r--r--makePackagesFile.go18
-rw-r--r--parseDpkgOutputIntoPB.go8
3 files changed, 33 insertions, 5 deletions
diff --git a/getKeyFromPackaagePB.go b/getKeyFromPackaagePB.go
index 3fa947c..79c42fe 100644
--- a/getKeyFromPackaagePB.go
+++ b/getKeyFromPackaagePB.go
@@ -55,6 +55,8 @@ func GetKeyFromPackagePB(p *zoopb.Package, varname string) (string, string) {
return "Pre-Depends", p.DebInfo.PreDepends
case "Suggests":
return "Suggests", p.DebInfo.Suggests
+ case "Recommends":
+ return "Recommends", p.DebInfo.Recommends
case "MultiArch":
return "Multi-Arch", p.DebInfo.MultiArch
case "Tag":
@@ -73,6 +75,9 @@ func GetKeyFromPackagePB(p *zoopb.Package, varname string) (string, string) {
}
return "Build-Date", cobol.Time(p.BuildDate)
case "DebCtime":
+ if p.Ctime == nil {
+ return "Deb-File-Date", ""
+ }
return "Deb-File-Date", cobol.Time(p.Ctime)
case "SHA1":
return "SHA1", "" // deprecated
@@ -84,17 +89,18 @@ func GetKeyFromPackagePB(p *zoopb.Package, varname string) (string, string) {
case "SHA512":
return "SHA512", "" // totally rediculously overkill
case "Description":
+ // log.Info("DESC:", p.DebInfo.Description)
var out string
lines := strings.Split(p.DebInfo.Description, "\n")
if len(lines) == 0 {
- return "Description", out
+ return "Description", ""
}
- out = "Description: " + strings.TrimSpace(lines[0])
+ out = strings.TrimSpace(lines[0]) + "\n"
if len(lines) == 1 {
return "Description", out
}
for _, line := range lines[1:] {
- out += " " + strings.TrimSpace(line)
+ out += " " + strings.TrimSpace(line) + "\n"
}
return "Description", out
default:
diff --git a/makePackagesFile.go b/makePackagesFile.go
index 31955bb..b51ecd2 100644
--- a/makePackagesFile.go
+++ b/makePackagesFile.go
@@ -29,3 +29,21 @@ func MakePackagesFile(all *zoopb.Packages) string {
}
return pfile
}
+
+func MakeControlFile(pb *zoopb.Package) string {
+ var controlfile string
+ parts, err := zoopb.GetDebInfoFields(pb)
+ if err != nil {
+ log.Info(err)
+ }
+ for _, varname := range parts {
+ varname, varval := GetKeyFromPackagePB(pb, varname)
+ varval = strings.TrimSpace(varval)
+ if varval == "" {
+ continue
+ }
+ controlfile += log.Sprintf("%s: %s\n", varname, varval)
+ }
+ controlfile += log.Sprintf("\n")
+ return strings.TrimSpace(controlfile)
+}
diff --git a/parseDpkgOutputIntoPB.go b/parseDpkgOutputIntoPB.go
index f1a19a1..eb62a6c 100644
--- a/parseDpkgOutputIntoPB.go
+++ b/parseDpkgOutputIntoPB.go
@@ -154,6 +154,8 @@ func ParseDpkgOutputIntoPB(pb *zoopb.Package, all string) {
pb.DebInfo.Packager = varval
case "Depends":
pb.DebInfo.Depends = varval
+ case "Recommends":
+ pb.DebInfo.Recommends = varval
case "Source":
pb.DebInfo.Source = varval
case "URL":
@@ -209,16 +211,18 @@ func ParseDpkgOutputIntoPB(pb *zoopb.Package, all string) {
log.Info("FIXME: Git-Tag-Date", varval)
}
case "Description":
- description := varval
+ description := varval + "\n"
+ // log.Info("SCANNED DESC=", description)
for scanner.Scan() {
line := scanner.Text()
- if strings.HasPrefix(line, " ") {
+ if strings.HasPrefix(line, " ") {
line = strings.TrimSpace(line)
description += line + "\n"
continue
}
break
}
+ // log.Info("SCANNED DESC=", description)
pb.DebInfo.Description = description
default:
// This forces me(it could be you!) to fix this parser