From 557772a2409d436bc6ddab104a254b9bfb92e519 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 7 Oct 2025 11:38:23 -0500 Subject: rename --- tablePackaging.go | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tableRepos.go | 107 ------------------------------------------------------ 2 files changed, 107 insertions(+), 107 deletions(-) create mode 100644 tablePackaging.go delete mode 100644 tableRepos.go diff --git a/tablePackaging.go b/tablePackaging.go new file mode 100644 index 0000000..7c1c897 --- /dev/null +++ b/tablePackaging.go @@ -0,0 +1,107 @@ +// Copyright 2017-2025 WIT.COM Inc. All rights reserved. +// Use of this source code is governed by the GPL 3.0 + +package main + +import ( + "go.wit.com/lib/protobuf/gitpb" + "go.wit.com/lib/protobuf/zoopb" + "go.wit.com/log" +) + +func isPackageOnMirrors(repo *gitpb.Repo) bool { + var found *zoopb.Package + name := me.forge.Config.DebName(repo.Namespace) + for pkg := range me.machine.Wit.IterAll() { + // log.Info(pkg) + if name == pkg.Name { + found = pkg + } + } + if found == nil { + return false + } + if found.PkgName == "" { + log.Info("found", found) + } + return true +} + +func printPackagingTable(pb *gitpb.Repos) { + tablePB := pb.NewTable("deb details") + tablePB.NewUuid() + + var col *gitpb.RepoFunc + + col = tablePB.AddNamespace() + col.Width = 32 + + col = tablePB.AddStringFunc("RepoType", func(r *gitpb.Repo) string { + return me.forge.GetRepoType(r) + }) + col.Width = 8 + + col = tablePB.AddStringFunc("Build Version", func(r *gitpb.Repo) string { + return me.forge.GetPackageVersion(r) + }) + col.Width = 12 + + /* + col = tablePB.AddStringFunc("is old", func(r *gitpb.Repo) string { + manufactured := r.GetCurrentVersion() + ver := trimNonNumericFromStart(manufactured) + name := me.forge.Config.DebName(r.Namespace) + if actualp := me.machine.FindByVersion(name, ver); actualp != nil { + // end += " (version match) " + actualp.Version + " " + ver + " " + return "" + } + if installedPackage := me.machine.FindInstalledByName(name); installedPackage != nil { + return installedPackage.Version + } + return "" + }) + col.Width = 10 + */ + + col = tablePB.AddStringFunc("I", func(r *gitpb.Repo) string { + debname := me.forge.Config.DebName(r.GetNamespace()) + if me.machine.IsInstalled(debname) { + return "X" + } + return "" + }) + col.Width = 1 + + col = tablePB.AddStringFunc("done", func(r *gitpb.Repo) string { + if isPackageOnMirrors(r) { + return "yes" + } + return "" + }) + col.Width = 4 + + col = tablePB.AddStringFunc("build", func(r *gitpb.Repo) string { + if isPackageOnMirrors(r) { + return "yes" + } + return "" + }) + col.Width = 5 + + col = tablePB.AddState() + col.Width = 32 + + col = tablePB.AddStringFunc("filename for .deb", func(r *gitpb.Repo) string { + name := me.forge.Config.DebName(r.Namespace) + for pkg := range me.machine.Wit.IterAll() { + if name == pkg.Name { + return pkg.PkgName + } + } + return "missing " + name + }) + col.Width = -1 + + tablePB.PrintTable() + log.Printf("wit.packagingTable() %d repos\n", pb.Len()) +} diff --git a/tableRepos.go b/tableRepos.go deleted file mode 100644 index 7c1c897..0000000 --- a/tableRepos.go +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2017-2025 WIT.COM Inc. All rights reserved. -// Use of this source code is governed by the GPL 3.0 - -package main - -import ( - "go.wit.com/lib/protobuf/gitpb" - "go.wit.com/lib/protobuf/zoopb" - "go.wit.com/log" -) - -func isPackageOnMirrors(repo *gitpb.Repo) bool { - var found *zoopb.Package - name := me.forge.Config.DebName(repo.Namespace) - for pkg := range me.machine.Wit.IterAll() { - // log.Info(pkg) - if name == pkg.Name { - found = pkg - } - } - if found == nil { - return false - } - if found.PkgName == "" { - log.Info("found", found) - } - return true -} - -func printPackagingTable(pb *gitpb.Repos) { - tablePB := pb.NewTable("deb details") - tablePB.NewUuid() - - var col *gitpb.RepoFunc - - col = tablePB.AddNamespace() - col.Width = 32 - - col = tablePB.AddStringFunc("RepoType", func(r *gitpb.Repo) string { - return me.forge.GetRepoType(r) - }) - col.Width = 8 - - col = tablePB.AddStringFunc("Build Version", func(r *gitpb.Repo) string { - return me.forge.GetPackageVersion(r) - }) - col.Width = 12 - - /* - col = tablePB.AddStringFunc("is old", func(r *gitpb.Repo) string { - manufactured := r.GetCurrentVersion() - ver := trimNonNumericFromStart(manufactured) - name := me.forge.Config.DebName(r.Namespace) - if actualp := me.machine.FindByVersion(name, ver); actualp != nil { - // end += " (version match) " + actualp.Version + " " + ver + " " - return "" - } - if installedPackage := me.machine.FindInstalledByName(name); installedPackage != nil { - return installedPackage.Version - } - return "" - }) - col.Width = 10 - */ - - col = tablePB.AddStringFunc("I", func(r *gitpb.Repo) string { - debname := me.forge.Config.DebName(r.GetNamespace()) - if me.machine.IsInstalled(debname) { - return "X" - } - return "" - }) - col.Width = 1 - - col = tablePB.AddStringFunc("done", func(r *gitpb.Repo) string { - if isPackageOnMirrors(r) { - return "yes" - } - return "" - }) - col.Width = 4 - - col = tablePB.AddStringFunc("build", func(r *gitpb.Repo) string { - if isPackageOnMirrors(r) { - return "yes" - } - return "" - }) - col.Width = 5 - - col = tablePB.AddState() - col.Width = 32 - - col = tablePB.AddStringFunc("filename for .deb", func(r *gitpb.Repo) string { - name := me.forge.Config.DebName(r.Namespace) - for pkg := range me.machine.Wit.IterAll() { - if name == pkg.Name { - return pkg.PkgName - } - } - return "missing " + name - }) - col.Width = -1 - - tablePB.PrintTable() - log.Printf("wit.packagingTable() %d repos\n", pb.Len()) -} -- cgit v1.2.3