From 1c90e20a10120a353af9c5069552a113417badb3 Mon Sep 17 00:00:00 2001 From: Giovanni Harting <539@idlegandalf.com> Date: Sun, 26 Jan 2025 20:14:16 +0100 Subject: [PATCH] fix check in housekeeping not checking the actual no-build list --- housekeeping.go | 12 +++--------- proto_package.go | 7 +------ utils.go | 9 +++++---- 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/housekeeping.go b/housekeeping.go index 1e0b9ad..3cc3912 100644 --- a/housekeeping.go +++ b/housekeeping.go @@ -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 { diff --git a/proto_package.go b/proto_package.go index 2c2ae17..7659d6b 100644 --- a/proto_package.go +++ b/proto_package.go @@ -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 diff --git a/utils.go b/utils.go index d6dbf02..dac4c2b 100644 --- a/utils.go +++ b/utils.go @@ -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) {