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.
This commit is contained in:
2023-03-17 10:56:54 -05:00
parent ee408805e2
commit 6abf1de348

View File

@@ -19,13 +19,23 @@ location = ${PWD}/repos/x-portage
auto-sync = no auto-sync = no
EOF 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 for patch in patches/ebuilds/*/*/*.patch; do
[ -f "${patch}" ] || continue [ -f "${patch}" ] || continue
cp=${patch#patches/ebuilds/} cp=${patch#patches/ebuilds/}
cp=${cp%/*.patch} cp=${cp%/*.patch}
printf 'Applying patch %s for %s ...\n' "${patch##*/}" "${cp}" printf 'Applying patch %s for %s ...\n' "${patch##*/}" "${cp}"
mkdir -p repos/x-portage/${cp} if [ ! -d repos/x-portage/${cp} ]; then
cp -r /var/db/repos/gentoo/${cp}/. repos/x-portage/${cp} 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 for f in repos/x-portage/${cp}/*.ebuild; do
patch "${f}" "${patch}" patch "${f}" "${patch}"
ebuild "${f}" digest ebuild "${f}" digest