From 6abf1de348d7f0d37be374b90013a3faf39c66e6 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Fri, 17 Mar 2023 10:56:54 -0500 Subject: [PATCH] setup-local-repo: Fix multiple patches per ebuild If multiple patches are provided for the same package, we need to ensure that they all applied. Previously, only the last patch was applied, because the ebuilds were copied from the main repository each time, undoing all previous patches. --- setup-local-repo.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/setup-local-repo.sh b/setup-local-repo.sh index 6f3cd4e..f465c63 100755 --- a/setup-local-repo.sh +++ b/setup-local-repo.sh @@ -19,13 +19,23 @@ location = ${PWD}/repos/x-portage auto-sync = no EOF +find repos/x-portage \ + -mindepth 1 \ + -maxdepth 1 \ + -type d \ + -not -name metadata \ + -not -name profiles \ + | xargs rm -rfv + for patch in patches/ebuilds/*/*/*.patch; do [ -f "${patch}" ] || continue cp=${patch#patches/ebuilds/} cp=${cp%/*.patch} printf 'Applying patch %s for %s ...\n' "${patch##*/}" "${cp}" - mkdir -p repos/x-portage/${cp} - cp -r /var/db/repos/gentoo/${cp}/. repos/x-portage/${cp} + if [ ! -d repos/x-portage/${cp} ]; then + mkdir -p repos/x-portage/${cp} + cp -r /var/db/repos/gentoo/${cp}/. repos/x-portage/${cp} + fi for f in repos/x-portage/${cp}/*.ebuild; do patch "${f}" "${patch}" ebuild "${f}" digest