added more db-based lookups

This commit is contained in:
2022-08-13 22:27:56 +02:00
parent b48c75a177
commit c8b31b3275
2 changed files with 6 additions and 2 deletions

View File

@@ -394,7 +394,6 @@ func (b *BuildManager) refreshSRCINFOs(ctx context.Context, path string) error {
}
wg.Wait()
return nil
}

View File

@@ -640,11 +640,16 @@ func (p *ProtoPackage) SVN2GITVersion(h *alpm.Handle) (string, error) {
return "", MultiplePKGBUILDError{fmt.Errorf("%s: multiple PKGBUILD found: %s", p.Pkgbase, fPkgbuilds)}
}
log.Infof("%s: resolving successful: MirrorRepo=%s; PKGBUILD chosen: %s", p.Pkgbase, iPackage.DB().Name(), fPkgbuilds[0])
p.Repo = dbpackage.Repository(iPackage.DB().Name())
} else if len(fPkgbuilds) == 0 {
return "", fmt.Errorf("%s: no matching PKGBUILD found (searched: %s, canidates: %s)", p.Pkgbase, filepath.Join(conf.Basedir.Work, upstreamDir, "**/"+p.Pkgbase+"/repos/*/PKGBUILD"), pkgBuilds)
}
pPkg := PKGBUILD(fPkgbuilds[0])
dbPkg, err := db.DbPackage.Query().Where(dbpackage.RepositoryEQ(dbpackage.Repository(pPkg.Repo())), dbpackage.March(p.March), dbpackage.Pkgbase(p.Pkgbase)).Only(context.Background())
if err == nil {
return dbPkg.Version, nil
}
cmd := exec.Command("makepkg", "--printsrcinfo")
cmd.Dir = filepath.Dir(fPkgbuilds[0])
res, err := cmd.Output()