// 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" ) func isPackageOnMirrors(repo *gitpb.Repo) bool { manufactured := repo.GetCurrentVersion() ver := trimNonNumericFromStart(manufactured) name := me.forge.Config.DebName(repo.Namespace) if actualp := me.machine.FindByVersion(name, ver); actualp != nil { // end += " (version match) " + actualp.Version + " " + ver + " " // repo.State = "on mirrors" return true } return false } func debianFilename(repo *gitpb.Repo) string { manufactured := repo.GetCurrentVersion() ver := trimNonNumericFromStart(manufactured) name := me.forge.Config.DebName(repo.Namespace) if actualp := me.machine.FindByVersion(name, ver); actualp != nil { return actualp.PkgName } return "hmm" } 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 { name := me.forge.Config.DebName(r.GetNamespace()) if me.machine.IsInstalled(name) { return "X" } // debname := me.forge.Config.DebName(r.GetNamespace()) // if actualp := me.machine.FindInstalledByName(debname); actualp != nil { // 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 shouldBuild(r) { return "yes" } return "" }) col.Width = 5 col = tablePB.AddState() col.Width = 32 col = tablePB.AddStringFunc("deb name", func(r *gitpb.Repo) string { return debianFilename(r) }) col.Width = -1 tablePB.PrintTable() }