diff --git a/buildmanager.go b/buildmanager.go index 54b18a0..ea94325 100644 --- a/buildmanager.go +++ b/buildmanager.go @@ -438,6 +438,12 @@ func (b *BuildManager) genQueue() ([]*ProtoPackage, error) { continue } + // try download srcinfo from repo + srcInfo, err := downloadSRCINFO(pkg.DBPackage.Pkgbase, state.TagRev) + if err == nil { + pkg.Srcinfo = srcInfo + } + if !pkg.isEligible(context.Background()) { continue } diff --git a/proto_package.go b/proto_package.go index cd62a8f..db8cccb 100644 --- a/proto_package.go +++ b/proto_package.go @@ -68,6 +68,15 @@ func (p *ProtoPackage) isEligible(ctx context.Context) bool { case p.isPkgFailed(): log.Debugf("skipped %s: failed build", p.Pkgbase) skipping = true + case p.Srcinfo != nil: + // skip haskell packages, since they cannot be optimized currently (no -O3 & march has no effect as far as I know) + if Contains(p.Srcinfo.MakeDepends, "ghc") || Contains(p.Srcinfo.MakeDepends, "haskell-ghc") || + Contains(p.Srcinfo.Depends, "ghc") || Contains(p.Srcinfo.Depends, "haskell-ghc") { + log.Debugf("skipped %s: haskell", p.Pkgbase) + p.DBPackage.SkipReason = "haskell" + p.DBPackage.Status = dbpackage.StatusSkipped + skipping = true + } } if skipping { diff --git a/utils.go b/utils.go index 21ac5d8..d5554c9 100644 --- a/utils.go +++ b/utils.go @@ -12,6 +12,7 @@ import ( "gopkg.in/yaml.v2" "io" "io/fs" + "net/http" "os" "os/exec" "path/filepath" @@ -699,3 +700,26 @@ func Copy(srcPath, dstPath string) (err error) { _, err = io.Copy(w, r) return err } + +func downloadSRCINFO(pkg string, tag string) (*srcinfo.Srcinfo, error) { + resp, err := http.Get(fmt.Sprintf("https://gitlab.archlinux.org/archlinux/packaging/packages/%s/-/raw/%s/.SRCINFO", pkg, tag)) + if err != nil { + return nil, err + } + + if resp.StatusCode != http.StatusOK { + return nil, errors.New(resp.Status) + } + + bResp, err := io.ReadAll(resp.Body) + defer resp.Body.Close() + if err != nil { + return nil, err + } + + nSrcInfo, err := srcinfo.Parse(string(bResp)) + if err != nil { + return nil, err + } + return nSrcInfo, nil +}