fix check in housekeeping not checking the actual no-build list

This commit is contained in:
Giovanni Harting 2025-01-26 20:14:16 +01:00
parent 2e080c8268
commit 1c90e20a10
3 changed files with 9 additions and 19 deletions

View File

@ -50,12 +50,6 @@ func housekeeping(repo, march string, wg *sync.WaitGroup) error {
Arch: *mPackage.Arch(),
}
matchNoBuild, err := MatchGlobList(pkg.Pkgbase, conf.Blacklist.Packages)
if err != nil {
log.Errorf("[HK] %s->%s error parsing no-build glob: %v", pkg.FullRepo, mPackage.Name(), err)
continue
}
// check if package is still part of repo
dbs, err := alpmHandle.SyncDBs()
if err != nil {
@ -69,7 +63,7 @@ func housekeeping(repo, march string, wg *sync.WaitGroup) error {
pkgResolved.DB().Name() != pkg.Repo.String() ||
pkgResolved.Architecture() != pkg.Arch ||
pkgResolved.Name() != mPackage.Name() ||
matchNoBuild {
MatchGlobList(pkg.Pkgbase, conf.Blacklist.Packages) {
switch {
case err != nil:
log.Infof("[HK] %s->%s not included in repo (resolve error: %v)", pkg.FullRepo, mPackage.Name(), err)
@ -85,7 +79,7 @@ func housekeeping(repo, march string, wg *sync.WaitGroup) error {
case pkgResolved.Name() != mPackage.Name():
log.Infof("[HK] %s->%s not included in repo (name mismatch: repo:%s != pkg:%s)", pkg.FullRepo,
mPackage.Name(), pkgResolved.Name(), mPackage.Name())
case matchNoBuild:
case MatchGlobList(pkg.Pkgbase, conf.Blacklist.Packages):
log.Infof("[HK] %s->%s not included in repo (blacklisted pkgbase %s)", pkg.FullRepo, mPackage.Name(), pkg.Pkgbase)
}
@ -249,7 +243,7 @@ func housekeeping(repo, march string, wg *sync.WaitGroup) error {
DBPackage: dbPkg,
}
buildManager.repoPurge[fullRepo] <- []*ProtoPackage{pkg}
case dbPkg.Status == dbpackage.StatusSkipped && dbPkg.RepoVersion == "" && dbPkg.SkipReason == "blacklisted":
case dbPkg.Status == dbpackage.StatusSkipped && dbPkg.SkipReason == "blacklisted" && !MatchGlobList(pkg.Pkgbase, conf.Blacklist.Packages):
log.Infof("[HK] requeue previously blacklisted package %s->%s", fullRepo, dbPkg.Pkgbase)
err = dbPkg.Update().SetStatus(dbpackage.StatusQueued).ClearSkipReason().ClearTagRev().Exec(context.Background())
if err != nil {

View File

@ -43,11 +43,6 @@ var (
)
func (p *ProtoPackage) isEligible(ctx context.Context) bool {
globMatch, err := MatchGlobList(p.Pkgbase, conf.Blacklist.Packages)
if err != nil {
log.Errorf("error parsing glob from no-build list: %v", err)
}
skipping := false
switch {
case p.Arch == "any":
@ -55,7 +50,7 @@ func (p *ProtoPackage) isEligible(ctx context.Context) bool {
p.DBPackage.SkipReason = "arch = any"
p.DBPackage.Status = dbpackage.StatusSkipped
skipping = true
case globMatch:
case MatchGlobList(p.Pkgbase, conf.Blacklist.Packages):
log.Debugf("skipped %s: package on no-build list", p.Pkgbase)
p.DBPackage.SkipReason = "blacklisted"
p.DBPackage.Status = dbpackage.StatusSkipped

View File

@ -699,17 +699,18 @@ func (globs Globs) Expand() ([]string, error) {
return matches, nil
}
func MatchGlobList(target string, globs []string) (bool, error) {
func MatchGlobList(target string, globs []string) bool {
for _, lGlob := range globs {
tGlob, err := glob.Compile(lGlob)
if err != nil {
return false, fmt.Errorf("failed to compile glob %s: %w", lGlob, err)
log.Warningf("failed to compile glob %s: %v", lGlob, err)
return false
}
if tGlob.Match(target) {
return true, nil
return true
}
}
return false, nil
return false
}
func Copy(srcPath, dstPath string) (err error) {