forked from ALHP/ALHP.GO
added skip option; skipped patch for linux-zen: already included
This commit is contained in:
@@ -19,6 +19,7 @@ kernel_patches:
|
||||
5.5: "none"
|
||||
5.8: "https://raw.githubusercontent.com/graysky2/kernel_compiler_patch/master/more-uarches-for-kernel-5.8-5.14.patch"
|
||||
5.15: "https://raw.githubusercontent.com/graysky2/kernel_compiler_patch/master/more-uarches-for-kernel-5.15%2B.patch"
|
||||
linux-zen: "skip"
|
||||
|
||||
db:
|
||||
driver: pgx
|
||||
|
20
utils.go
20
utils.go
@@ -250,18 +250,25 @@ func (p *BuildPackage) prepareKernelPatches() error {
|
||||
// choose best suited patch based on kernel version
|
||||
var curVer string
|
||||
for k := range conf.KernelPatches {
|
||||
if k == p.Pkgbase {
|
||||
curVer = k
|
||||
break
|
||||
}
|
||||
if alpm.VerCmp(p.Srcinfo.Pkgver, k) >= 0 && alpm.VerCmp(k, curVer) >= 0 {
|
||||
curVer = k
|
||||
}
|
||||
}
|
||||
|
||||
newPKGBUILD := string(fStr)
|
||||
if conf.KernelPatches[curVer] == "none" {
|
||||
return fmt.Errorf("no patch available")
|
||||
} else if conf.KernelPatches[curVer] == "skip" {
|
||||
log.Debugf("[KP] skipped patching for %s", p.Pkgbase)
|
||||
} else {
|
||||
log.Debugf("[KP] choose patch %s for kernel %s", curVer, p.Srcinfo.Pkgver)
|
||||
|
||||
if curVer == "none" {
|
||||
return fmt.Errorf("no patch available")
|
||||
}
|
||||
|
||||
// add patch to source-array
|
||||
orgSource := rePkgSource.FindStringSubmatch(string(fStr))
|
||||
orgSource := rePkgSource.FindStringSubmatch(newPKGBUILD)
|
||||
if orgSource == nil || len(orgSource) < 1 {
|
||||
return fmt.Errorf("no source=() found")
|
||||
}
|
||||
@@ -269,7 +276,7 @@ func (p *BuildPackage) prepareKernelPatches() error {
|
||||
sources := strings.Split(orgSource[1], "\n")
|
||||
sources = append(sources, fmt.Sprintf("\"%s\"", conf.KernelPatches[curVer]))
|
||||
|
||||
newPKGBUILD := rePkgSource.ReplaceAllLiteralString(string(fStr), fmt.Sprintf("source=(%s)", strings.Join(sources, "\n")))
|
||||
newPKGBUILD = rePkgSource.ReplaceAllLiteralString(newPKGBUILD, fmt.Sprintf("source=(%s)", strings.Join(sources, "\n")))
|
||||
|
||||
// add patch sha256 to sha256sums-array (yes, hardcoded to sha256)
|
||||
// TODO: support all sums that makepkg also supports
|
||||
@@ -296,6 +303,7 @@ func (p *BuildPackage) prepareKernelPatches() error {
|
||||
sums = append(sums, fmt.Sprintf("'%s'", hex.EncodeToString(h.Sum(nil))))
|
||||
|
||||
newPKGBUILD = rePkgSum.ReplaceAllLiteralString(newPKGBUILD, fmt.Sprintf("sha256sums=(\n%s\n)", strings.Join(sums, "\n")))
|
||||
}
|
||||
|
||||
// enable config option
|
||||
switch {
|
||||
|
Reference in New Issue
Block a user