From c1dc8c9ccbcdb9b6029a293497ffc12a7aa02e49 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Sat, 17 Sep 2022 00:32:05 +0200 Subject: [PATCH] Ports: Handle generating a ReadMe for an empty patch directory --- Ports/.port_include.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Ports/.port_include.sh b/Ports/.port_include.sh index eca27cb3d2..7b21a89fd6 100755 --- a/Ports/.port_include.sh +++ b/Ports/.port_include.sh @@ -624,6 +624,14 @@ do_generate_patch_readme() { fi fi + # An existing patches directory but no actual patches presumably means that we just deleted all patches, + # so remove the ReadMe file accordingly. + if [ -z "$(find -L "${PORT_META_DIR}/patches" -maxdepth 1 -name '*.patch' -print -quit)" ]; then + >&2 echo "Port $port does not have any patches, deleting ReadMe..." + rm -f "${PORT_META_DIR}/patches/ReadMe.md" + exit 0 + fi + local tempdir="$(pwd)/.patches.tmp" rm -fr "$tempdir" mkdir "$tempdir"