summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-05 11:25:22 -0500
committerJeff Carr <[email protected]>2025-10-05 11:25:22 -0500
commit47bbda6e304cb1cae8ee0a8ce5c840df8a47a5a9 (patch)
tree7e295de2b9847e3ab940ec0495f7bea440e53642
parentc7b9aceb77cfea8f9a3b6d5d9c38b3d496585bcf (diff)
better stuff and rm pre table PB code
-rw-r--r--doUpgrade.go27
-rw-r--r--main.go36
2 files changed, 16 insertions, 47 deletions
diff --git a/doUpgrade.go b/doUpgrade.go
index 18689d0..6fa6bdf 100644
--- a/doUpgrade.go
+++ b/doUpgrade.go
@@ -12,19 +12,19 @@ import (
func doPackageList(all bool) {
installed := zoopb.NewPackages()
- for p := range me.machine.Wit.IterAll() {
- found := me.machine.FindInstalledByName(p.Name)
- if found == nil {
- continue
+ for p := range me.machine.Wit.IterByName() {
+ if all {
+ installed.Append(p)
+ } else {
+ found := me.machine.FindInstalledByName(p.Name)
+ if found == nil {
+ continue
+ }
+ p.Installed = true
+ installed.Append(p)
}
- p.Installed = true
- installed.Append(p)
- }
- if all {
- me.machine.Wit.PrintTable()
- } else {
- installed.PrintTable()
}
+ installed.PrintTable()
log.Info("aptly repo -remove-files -force-replace add wit /home/aptly/incoming/autogenpb_0.5.16_amd64.deb")
log.Info("aptly repo remove wit basicwindow")
log.Info("aptly snapshot create wit-v0.8.3 from repo wit")
@@ -51,6 +51,8 @@ func doUpgrade() error {
var installed []string
+ installable := zoopb.NewPackages()
+
fmt.Println("Installed Packages:")
loop := me.machine.Wit.SortByName()
for loop.Scan() {
@@ -59,6 +61,7 @@ func doUpgrade() error {
log.Infof("odd /var/lib/apt/ list parse error. p.Name was blank (should be the package name) p=%v\n", p)
continue
}
+ installable.Append(p)
if !me.machine.IsInstalled(p.Name) {
continue
}
@@ -81,6 +84,8 @@ func doUpgrade() error {
installed = append(installed, p.Name)
}
+ installable.PrintTable()
+ me.sh.GoodExit("")
if argv.Force {
// force remove the packages. can be used if binaries change but versions didn't
for _, pkgname := range installed {
diff --git a/main.go b/main.go
index 00e0a85..7d5b9f9 100644
--- a/main.go
+++ b/main.go
@@ -77,42 +77,6 @@ func main() {
okExit("do something here")
}
- if argv.ListPkgs != nil {
- doAptList()
- log.DaemonMode(true)
- defer log.DaemonMode(false)
- fmt.Println("Installed Packages:")
- loop := me.machine.Wit.SortByName()
- for loop.Scan() {
- p := loop.Next()
- var end string
- var version string
- if me.forge.Config.IsPrivate(p.Name) {
- end += "(private) "
- }
- if actualp := me.machine.FindByVersion(p.Name, p.Version); actualp != nil {
- // end += "(version match) "
- } else {
- end += "(version mismatch) " + actualp.Version + " " + version + " "
- }
- if actualp := me.machine.FindInstalledByName(p.Name); actualp != nil {
- if p.Version != actualp.Version {
- end += "(installed " + actualp.Version + " vs " + p.Version + ") "
- } else {
- end += "(installed ok) "
- }
- version = actualp.Version
- }
- if me.forge.Config.IsReadOnly(p.Name) {
- // end += " (readonly) "
- } else {
- end += "(writable) "
- }
- log.Printf("%-30s %-8s %s\n", p.Name, p.Version, end) // p.PkgName)
- }
- okExit("")
- }
-
okExit("do what?")
}