// 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/debian" "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.Package { found = pkg } } if found == nil { return false } if found.Filename == "" { log.Info("filename was blank. did not find?", found) } return true } func getDebFilename(repo *gitpb.Repo) string { name := me.forge.Config.DebName(repo.Namespace) for pkg := range me.machine.Wit.IterAll() { if name == pkg.Package { return pkg.Filename } } return "" } func printPackagingTable(pb *gitpb.Repos) string { tablePB := makePackagingTable(pb) tablePB.PrintTable() s := log.Sprintf("wit.packagingTable() %d repos", pb.Len()) return s } func makePackagingTable(pb *gitpb.Repos) *gitpb.ReposTable { tablePB := pb.NewTable("deb details") tablePB.NewUuid() var col *gitpb.RepoFunc col = tablePB.AddFullPath() col.Width = 56 col = tablePB.AddStringFunc("RepoType", func(r *gitpb.Repo) string { return me.forge.GetRepoType(r) }) col.Width = 8 col = tablePB.AddStringFunc("new .deb Version", func(r *gitpb.Repo) string { return me.forge.GetPackageVersion(r) }) col.Width = 16 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 r.IsDirty() { return "yes" } ver := r.GetCurrentVersion() debname := getDebFilename(r) if debian.DebFilenameMatchesVersion(debname, ver) { return "yes" } return "" }) col.Width = 4 col = tablePB.AddStringFunc("dirty", func(r *gitpb.Repo) string { if r.IsDirty() { return "yes" } return "" }) col.Width = 5 col = tablePB.AddStringFunc("build", func(r *gitpb.Repo) string { return shouldBuild(r) }) col.Width = 5 col = tablePB.AddState() col.Width = 32 col = tablePB.AddStringFunc("filename for .deb", func(r *gitpb.Repo) string { debname := getDebFilename(r) if debname == "" { return "missing " + debname } return debname }) col.Width = -1 return tablePB }