summaryrefslogtreecommitdiff
path: root/tableDefault.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-13 01:37:15 -0500
committerJeff Carr <[email protected]>2025-10-13 03:43:13 -0500
commit28a3ff4d9e42fc4f713ebbb65ba9e7ba74ca4874 (patch)
tree3b24eea4f550f15cd7b92a8fc58bfbf76359c63e /tableDefault.go
parent2d32b070833a748bca0383e9d3e6c0238261bbfb (diff)
better name
Diffstat (limited to 'tableDefault.go')
-rw-r--r--tableDefault.go116
1 files changed, 0 insertions, 116 deletions
diff --git a/tableDefault.go b/tableDefault.go
deleted file mode 100644
index b7ecc57..0000000
--- a/tableDefault.go
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2025 WIT.COM Inc Licensed GPL 3.0
-
-package zoopb
-
-import (
- "go.wit.com/log"
-)
-
-// this is the smart table layout for packages
-
-func (m *Machine) PrintTable(pb *Packages) {
- tablePB := m.makeSmartTable(pb)
- tablePB.PrintTable()
- var i int
- for p := range pb.IterAll() {
- if m.IsInstalled(p.Package) {
- i += 1
- }
- }
-
- log.Printf("pb.SmartTable: packages: total=%d installed=%d\n", pb.Len(), i)
-}
-
-func (m *Machine) PrintInstalledTable() {
- installed := NewPackages()
- for p := range m.Wit.IterAll() {
- if m.IsInstalled(p.Package) {
- installed.Append(p)
- }
- }
- tablePB := m.makeSmartTable(installed)
- if tablePB == nil {
- panic("WTF")
- }
- tablePB.PrintTable()
- log.Printf("pb.SmartTable: %d installed packages\n", installed.Len())
-}
-
-func (m *Machine) makeSmartTable(pb *Packages) *PackagesTable {
- t := pb.NewTable("apt packages")
- t.NewUuid()
-
- var col *PackageFunc
-
- col = t.AddStringFunc(" I", func(p *Package) string {
- if m.IsInstalled(p.Package) {
- return " X"
- }
- return ""
- })
- col.Width = 3
-
- col = t.AddStringFunc("U", func(p *Package) string {
- if m.WillUpgrade(p) {
- return "X"
- }
- return ""
- })
- col.Width = 1
-
- col = t.AddPackage()
- col.Width = 16
-
- col = t.AddVersion()
- col.Width = 20
-
- col = t.AddStringFunc("md5sum", func(p *Package) string {
- if p.DebInfo == nil {
- return ""
- }
- return p.DebInfo.MD5SUM
- })
- col.Width = 3
-
- col = t.AddFilename()
- col.Width = -1
- col.Header.Name = "apt package path"
-
- return t
-}
-
-// true if the package 'p' is newer than the installed package
-func (m *Machine) WillUpgrade(p *Package) bool {
- check := m.FindInstalledByName(p.Package)
- if check == nil {
- // not installed. can not upgrade
- return false
- }
- if check.Version != p.Version {
- return true
- }
- return false
-}
-
-/*
-// this means somehow this machine has a newer version than the mirrors have
-// true if the package 'p' is newer than the installed package
-func (m *Machine) MirrorsOutOfDate(p *Package) bool {
- check := m.FindInstalledByName(p.Package)
- if check == nil {
- // not installed
- return false
- }
- v1, _ := fhelp.NewDebVersion(check.Version)
- v2, _ := fhelp.NewDebVersion(p.Version)
- if v1.Equal(v2) {
- // log.Info("do nothing", v1, v2)
- return false
- }
- if v2.LessThan(v1) {
- log.Info("wow. you have a newer version on this box than the mirrors", v1, "to", v2)
- return true
- }
- return false
-}
-*/