From 31c3a2bc65b02f56f201691ceb33422fa8293ad8 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Mon, 1 Sep 2025 11:35:59 +0200 Subject: [PATCH] build/distfiles: clean up subdiretories on manual arguments passed This eases maintenance when trying to refetch smaller portions of distfiles without losing the others. --- build/common.sh | 10 ++++++++++ build/distfiles.sh | 10 +++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/build/common.sh b/build/common.sh index 637076d..065c5e8 100644 --- a/build/common.sh +++ b/build/common.sh @@ -641,6 +641,16 @@ setup_distfiles() mkdir -p ${1}${PORTSDIR} rm -rf ${1}${PORTSDIR}/distfiles tar -C ${1}${PORTSDIR} -xpf ${DISTFILESET} + + # clear all additional sub-directories passed + for DIR in ${@}; do + rm -rf ${1}${PORTSDIR}/distfiles/${DIR} + done + fi + + if [ -n "${@}" ]; then + # in cleanup mode signal that we are done + return 1 fi } diff --git a/build/distfiles.sh b/build/distfiles.sh index b06397d..9ebcf6f 100644 --- a/build/distfiles.sh +++ b/build/distfiles.sh @@ -42,7 +42,15 @@ setup_base ${STAGEDIR} setup_clone ${STAGEDIR} ${PORTSDIR} setup_clone ${STAGEDIR} ${SRCDIR} setup_chroot ${STAGEDIR} -setup_distfiles ${STAGEDIR} + +if ! setup_distfiles ${STAGEDIR} ${@}; then + echo -n ">>> Recreating distfiles set... " + tar -C ${STAGEDIR}${PORTSDIR} -cf \ + ${SETSDIR}/distfiles-${PRODUCT_VERSION}.tar distfiles + echo "done" + + exit 0 +fi extract_packages ${STAGEDIR} || true