From 5e55a796df5a85f163b46ef8b9d8b8540304a841 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sat, 24 Jan 2026 11:32:27 +0900 Subject: [PATCH] internal/rosa: gnu patch artifact This is more robust than the busybox implementation. Signed-off-by: Ophestra --- internal/rosa/gnu.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/internal/rosa/gnu.go b/internal/rosa/gnu.go index 5d0b917..d62f15f 100644 --- a/internal/rosa/gnu.go +++ b/internal/rosa/gnu.go @@ -140,6 +140,35 @@ make DESTDIR=/work install ))) } +// NewPatch returns a [pkg.Artifact] containing an installation of GNU patch. +func (t Toolchain) NewPatch() pkg.Artifact { + const ( + version = "2.8" + checksum = "MA0BQc662i8QYBD-DdGgyyfTwaeALZ1K0yusV9rAmNiIsQdX-69YC4t9JEGXZkeR" + ) + return t.New("patch-"+version, []pkg.Artifact{ + t.NewMake(), + }, nil, nil, ` +cd /usr/src/patch +test_disable() { chmod +w "$2" && echo "$1" > "$2"; } + +test_disable '#!/bin/sh' tests/ed-style +test_disable '#!/bin/sh' tests/need-filename + +cd "$(mktemp -d)" +/usr/src/patch/configure \ + --prefix=/system \ + --build="${ROSA_TRIPLE}" +make "-j$(nproc)" check +make DESTDIR=/work install +`, pkg.Path(AbsUsrSrc.Append("patch"), true, pkg.NewHTTPGetTar( + nil, + "https://ftp.gnu.org/gnu/patch/patch-"+version+".tar.gz", + mustDecode(checksum), + pkg.TarGzip, + ))) +} + // NewBash returns a [pkg.Artifact] containing an installation of GNU Bash. func (t Toolchain) NewBash() pkg.Artifact { const (