use .SRCINFO if available

This commit is contained in:
Giovanni Harting 2024-08-09 02:11:35 +02:00
parent 453c6d8a3a
commit 8dccbbee84
3 changed files with 39 additions and 0 deletions

View File

@ -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
}

View File

@ -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 {

View File

@ -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
}