forked from ALHP/ALHP.GO
use .SRCINFO if available
This commit is contained in:
@@ -438,6 +438,12 @@ func (b *BuildManager) genQueue() ([]*ProtoPackage, error) {
|
|||||||
continue
|
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()) {
|
if !pkg.isEligible(context.Background()) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@@ -68,6 +68,15 @@ func (p *ProtoPackage) isEligible(ctx context.Context) bool {
|
|||||||
case p.isPkgFailed():
|
case p.isPkgFailed():
|
||||||
log.Debugf("skipped %s: failed build", p.Pkgbase)
|
log.Debugf("skipped %s: failed build", p.Pkgbase)
|
||||||
skipping = true
|
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 {
|
if skipping {
|
||||||
|
24
utils.go
24
utils.go
@@ -12,6 +12,7 @@ import (
|
|||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
"io"
|
"io"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -699,3 +700,26 @@ func Copy(srcPath, dstPath string) (err error) {
|
|||||||
_, err = io.Copy(w, r)
|
_, err = io.Copy(w, r)
|
||||||
return err
|
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
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user