do more checks pre-build to avoid cloning the package repo
This commit is contained in:
parent
6e8e7ca90e
commit
0001c2093d
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/Jguer/go-alpm/v2"
|
||||
"github.com/c2h5oh/datasize"
|
||||
"github.com/sethvargo/go-retry"
|
||||
log "github.com/sirupsen/logrus"
|
||||
@ -561,7 +562,7 @@ func (b *BuildManager) genQueue() ([]*ProtoPackage, error) {
|
||||
continue
|
||||
}
|
||||
|
||||
if !Contains(conf.Repos, repo) || (subRepo != nil && Contains(conf.Blacklist.Repo, *subRepo) || arch == "any") {
|
||||
if !Contains(conf.Repos, repo) || (subRepo != nil && Contains(conf.Blacklist.Repo, *subRepo)) {
|
||||
continue
|
||||
}
|
||||
|
||||
@ -594,7 +595,50 @@ func (b *BuildManager) genQueue() ([]*ProtoPackage, error) {
|
||||
continue
|
||||
}
|
||||
|
||||
pkg.DBPackage = pkg.DBPackage.Update().SetStatus(dbpackage.StatusQueued).SaveX(context.Background())
|
||||
if !pkg.isAvailable(alpmHandle) {
|
||||
log.Debugf("[%s/%s] not available on mirror, skipping build", pkg.FullRepo, pkg.Pkgbase)
|
||||
continue
|
||||
}
|
||||
|
||||
skipping := false
|
||||
switch {
|
||||
case arch == "any":
|
||||
log.Debugf("skipped %s: any-package", pkg.Pkgbase)
|
||||
pkg.DBPackage.SkipReason = "arch = any"
|
||||
pkg.DBPackage.Status = dbpackage.StatusSkipped
|
||||
skipping = true
|
||||
case Contains(conf.Blacklist.Packages, pkg.Pkgbase):
|
||||
log.Debugf("skipped %s: blacklisted package", pkg.Pkgbase)
|
||||
pkg.DBPackage.SkipReason = "blacklisted"
|
||||
pkg.DBPackage.Status = dbpackage.StatusSkipped
|
||||
skipping = true
|
||||
case pkg.DBPackage.MaxRss != nil && datasize.ByteSize(*pkg.DBPackage.MaxRss)*datasize.KB > conf.Build.MemoryLimit:
|
||||
log.Debugf("skipped %s: memory limit exceeded (%s)", pkg.Pkgbase, datasize.ByteSize(*pkg.DBPackage.MaxRss)*datasize.KB)
|
||||
pkg.DBPackage.SkipReason = "memory limit exceeded"
|
||||
pkg.DBPackage.Status = dbpackage.StatusSkipped
|
||||
skipping = true
|
||||
case pkg.isPkgFailed():
|
||||
log.Debugf("skipped %s: failed build", pkg.Pkgbase)
|
||||
skipping = true
|
||||
}
|
||||
|
||||
if skipping {
|
||||
pkg.DBPackage = pkg.DBPackage.Update().SetUpdated(time.Now()).SetVersion(pkg.Version).SetStatus(pkg.DBPackage.Status).
|
||||
SetSkipReason(pkg.DBPackage.SkipReason).SetTagRev(pkg.State.TagRev).SaveX(context.Background())
|
||||
continue
|
||||
} else {
|
||||
pkg.DBPackage = pkg.DBPackage.Update().SetUpdated(time.Now()).SetVersion(pkg.Version).SaveX(context.Background())
|
||||
}
|
||||
|
||||
repoVer, err := pkg.repoVersion()
|
||||
if err != nil {
|
||||
pkg.DBPackage = pkg.DBPackage.Update().ClearRepoVersion().SaveX(context.Background())
|
||||
} else if err == nil && alpm.VerCmp(repoVer, pkg.Version) > 0 {
|
||||
log.Debugf("skipped %s: version in repo higher than in PKGBUILD (%s < %s)", pkg.Pkgbase, pkg.Version, repoVer)
|
||||
pkg.DBPackage = pkg.DBPackage.Update().SetStatus(dbpackage.StatusLatest).ClearSkipReason().SetTagRev(pkg.State.TagRev).SaveX(context.Background())
|
||||
continue
|
||||
}
|
||||
|
||||
pkgbuilds = append(pkgbuilds, pkg)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user