internal/rosa: patch ignore whitespace

This makes it work better with patches emitted by git.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-01-26 21:56:09 +09:00
parent 4356f978aa
commit 76c657177d
3 changed files with 10 additions and 5 deletions

View File

@@ -23,7 +23,7 @@ export LLVM=1
export HOSTLDFLAGS="${LDFLAGS}" export HOSTLDFLAGS="${LDFLAGS}"
cd /usr/src/linux cd /usr/src/linux
`+script, pkg.Path(AbsUsrSrc.Append("linux"), true, t.NewPatchedSource( `+script, pkg.Path(AbsUsrSrc.Append("linux"), true, t.NewPatchedSource(
"kernel", pkg.NewHTTPGetTar( "kernel", version, pkg.NewHTTPGetTar(
nil, nil,
"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/"+ "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/"+
"snapshot/linux-"+version+".tar.gz", "snapshot/linux-"+version+".tar.gz",

View File

@@ -171,7 +171,7 @@ cp -r /system/include /usr/include && rm -rf /system/include
} }
return t.NewViaCMake("llvm", version, variant, t.NewPatchedSource( return t.NewViaCMake("llvm", version, variant, t.NewPatchedSource(
"llvmorg", pkg.NewHTTPGetTar( "llvmorg", version, pkg.NewHTTPGetTar(
nil, "https://github.com/llvm/llvm-project/archive/refs/tags/"+ nil, "https://github.com/llvm/llvm-project/archive/refs/tags/"+
"llvmorg-"+version+".tar.gz", "llvmorg-"+version+".tar.gz",
mustDecode(checksum), mustDecode(checksum),

View File

@@ -275,7 +275,7 @@ ln -vs ../usr/bin /work/bin
// NewPatchedSource returns [pkg.Artifact] of source with patches applied. If // NewPatchedSource returns [pkg.Artifact] of source with patches applied. If
// passthrough is true, source is returned as is for zero length patches. // passthrough is true, source is returned as is for zero length patches.
func (t Toolchain) NewPatchedSource( func (t Toolchain) NewPatchedSource(
name string, name, version string,
source pkg.Artifact, source pkg.Artifact,
passthrough bool, passthrough bool,
patches ...[2]string, patches ...[2]string,
@@ -293,13 +293,18 @@ func (t Toolchain) NewPatchedSource(
} }
paths[0] = pkg.Path(AbsUsrSrc.Append(name), false, source) paths[0] = pkg.Path(AbsUsrSrc.Append(name), false, source)
aname := name + "-src" aname := name + "-" + version + "-src"
script := ` script := `
cp -r /usr/src/` + name + `/. /work/. cp -r /usr/src/` + name + `/. /work/.
chmod -R +w /work && cd /work chmod -R +w /work && cd /work
` `
if len(paths) > 1 { if len(paths) > 1 {
script += `cat /usr/src/` + name + `-patches/* | patch -p 1` script += `
cat /usr/src/` + name + `-patches/* | \
patch \
-p 1 \
--ignore-whitespace
`
aname += "-patched" aname += "-patched"
} }
return t.New(aname, stage3Concat(t, []pkg.Artifact{}, return t.New(aname, stage3Concat(t, []pkg.Artifact{},