more patches
Some checks failed
nightly-build / build (bacula) (push) Successful in 1m19s
nightly-build / build (fchat-horizon-appimage) (push) Successful in 47s
nightly-build / build (openrgb-git) (push) Failing after 44s
nightly-build / build (paru) (push) Successful in 55s
nightly-build / build (plezy) (push) Successful in 49s
nightly-build / build (qownnotes) (push) Successful in 52s
nightly-build / build (ventoy-bin) (push) Successful in 42s
nightly-build / build (visual-studio-code-bin) (push) Successful in 47s

This commit is contained in:
KenwoodFox
2026-06-30 15:34:09 -04:00
parent 133c4e429a
commit d5eb2f2045
2 changed files with 42 additions and 4 deletions

View File

@@ -131,6 +131,7 @@ def prepare_build_dir(pkg_src: Path, build_dir: Path, cfg: Config) -> None:
dry_run=cfg.dry_run)
patches: List[str] = []
source_patches: List[str] = []
for src in package_files(pkg_src):
if src.suffix in PATCH_SUFFIXES:
patches.append(src.name)
@@ -142,10 +143,32 @@ def prepare_build_dir(pkg_src: Path, build_dir: Path, cfg: Config) -> None:
continue
shutil.copy2(src, build_dir / src.name)
if patches and not cfg.dry_run:
wire_source_patches(build_dir / "PKGBUILD", patches)
elif patches and cfg.dry_run:
print(f"+ wire patches into {build_dir / 'PKGBUILD'}: {', '.join(patches)}")
if cfg.dry_run:
if patches:
print(f"+ apply packaging patches (if any), wire rest into PKGBUILD")
return
for patch in patches:
path = build_dir / patch
if apply_packaging_patch(path, build_dir):
print(f" packaging patch applied: {patch}")
else:
source_patches.append(patch)
if source_patches:
wire_source_patches(build_dir / "PKGBUILD", source_patches)
def apply_packaging_patch(patch: Path, build_dir: Path) -> bool:
"""Apply a patch to the AUR packaging tree (PKGBUILD etc.), if it fits."""
check = subprocess.run(
["git", "apply", "--check", "--whitespace=nowarn", str(patch)],
cwd=str(build_dir), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
)
if check.returncode != 0:
return False
run(["git", "apply", "--whitespace=nowarn", str(patch)], cwd=build_dir)
return True
def wire_source_patches(pkgbuild: Path, patches: List[str]) -> None:

View File

@@ -0,0 +1,15 @@
diff --git a/PKGBUILD b/PKGBUILD
index 1111111..2222222 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -63,7 +63,9 @@ package() {
install -Dm755 "build/linux/${FLUTTER_ARCH}/release/bundle/$pkgname" -t \
"$pkgdir/opt/$pkgname/"
cp -a build/linux/${FLUTTER_ARCH}/release/bundle/{data,lib} "$pkgdir/opt/$pkgname/"
- chmod 0755 "$pkgdir/opt/$pkgname/lib/crashpad_handler"
+ if [[ -f "$pkgdir/opt/$pkgname/lib/crashpad_handler" ]]; then
+ chmod 0755 "$pkgdir/opt/$pkgname/lib/crashpad_handler"
+ fi
install -Dm755 "linux/packaging/$pkgname.sh" "$pkgdir/usr/bin/$pkgname"
install -Dm644 "linux/packaging/com.edde746.$pkgname.desktop" -t \