migrate code here

This commit is contained in:
Jeff Carr 2024-12-02 07:01:09 -06:00
parent f5d41d782a
commit 86e0a1f988
2 changed files with 47 additions and 1 deletions

View File

@ -22,6 +22,12 @@ func (f *Forge) FinalGoDepsCheck(check *gitpb.Repo) bool {
check.GoDeps = nil
check.ParseGoSum()
if check.GoDepsLen() == 0 {
// this is a primitive
check.GoPrimitive = true
return true
}
log.Printf("current repo %s go dependancy count: %d", check.GetGoPath(), check.GoDepsLen())
deps := check.GoDeps.SortByGoPath()
for deps.Scan() {
@ -32,7 +38,7 @@ func (f *Forge) FinalGoDepsCheck(check *gitpb.Repo) bool {
return false
}
// log.Info("found dep", depRepo.GetGoPath())
if depRepo.GetVersion() != found.GetMasterVersion() {
if depRepo.GetVersion() != found.GetTargetVersion() {
if f.IsReadOnly(depRepo.GetGoPath()) {
log.Printf("%-48s ok error %10s vs %10s (ignoring read-only repo)", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetMasterVersion())
} else {

View File

@ -2,7 +2,10 @@ package forgepb
import (
"fmt"
"time"
"go.wit.com/lib/gui/shell"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
@ -46,3 +49,40 @@ func (f *Forge) ConfigPrintTable() {
log.Info(f.standardHeader(r))
}
}
func (f *Forge) newestAge(repo *gitpb.Repo) time.Duration {
loop := repo.Tags.SortByAge()
for loop.Scan() {
r := loop.Next()
return time.Since(r.GetAuthordate().AsTime())
}
return time.Since(time.Now())
}
// show information while doing golang releases
func (f *Forge) StandardReleaseHeader(repo *gitpb.Repo, state string) string {
lastTag := repo.GetLastTag()
// tag := repo.NewestTag()
// gitAge, _ := tag.GetDate()
dur := f.newestAge(repo)
curname := repo.GetCurrentBranchName()
master := repo.GetMasterVersion()
user := repo.GetUserVersion()
target := repo.GetTargetVersion()
header := fmt.Sprintf("%-35s %5s %-10s %-10s %-10s %-20s %-20s %-15s",
repo.GetGoPath(), shell.FormatDuration(dur), curname,
lastTag, target,
master, user,
state)
return header
}
func ReleaseReportHeader() string {
return fmt.Sprintf("%-35s %5s %-10s %-10s %-10s %-20s %-20s %-15s",
"REPO", "AGE", "CUR BR",
"LAST", "TARGET",
"MASTER", "USER",
"STATE")
}