summaryrefslogtreecommitdiffhomepage
path: root/subr/pkg_fetch_download.subr
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2021-04-06 11:26:11 +0100
committerLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2021-04-06 11:26:11 +0100
commit2c5ce2e826a8af69d14429ea4da158bf94d31ca7 (patch)
tree97c90e082a90c8c617960cdae71a6e3dffbdfc97 /subr/pkg_fetch_download.subr
parent360eb692689993886cc8c5e471e73c76dcfaa123 (diff)
downloadmidipix_build-2c5ce2e826a8af69d14429ea4da158bf94d31ca7.tar.bz2
midipix_build-2c5ce2e826a8af69d14429ea4da158bf94d31ca7.tar.xz
pkgtool.sh:pkgtoolp_mirror_fetch(): call pkg_fetch_download_clean_dlcache() post-{archive,Git} mirroring.
pkgtool.sh:pkgtoolp_mirror_fetch(): mirror both archive as well as Git URL(s). subr/pkg_configure_patch.subr:pkg_configure_patch(): apply patches from within ${PKG_BASE_DIR} given both ${PKG_FNAME} and ${PKG_URLS_GIT}. subr.rtl/rtl_fetch.subr:rtl_fetch_mirror_urls_git(): ignore all but last component in ${_subdir}. subr.rtl/rtl_fetch.subr:rtl_fetch_mirror_urls_git(): create prerequisite directories. subr.rtl/rtl_fetch.subr:rtlp_fetch_url_git(): ignore all but last component in ${_subdir} wrt. ${_cache_dlname}. subr.rtl/rtl_fetch.subr:rtlp_fetch_url_git(): create prerequisite directories wrt. ${_tgtdir}. subr/ex_pkg_env.subr:exp_pkg_env_defaults(): reject absence of ${PKG_SUBDIR} given both ${PKG_FNAME} and ${PKG_URLS_GIT}. subr/pkg_fetch_download.subr:pkg_fetch_download_clean_dlcache(): initial implementation. subr/pkg_fetch_download.subr:pkg_fetch_download(): call pkg_fetch_download_clean_dlcache() post-{archive,Git} download.
Diffstat (limited to 'subr/pkg_fetch_download.subr')
-rw-r--r--subr/pkg_fetch_download.subr35
1 files changed, 24 insertions, 11 deletions
diff --git a/subr/pkg_fetch_download.subr b/subr/pkg_fetch_download.subr
index 188c7f7b..2b94d720 100644
--- a/subr/pkg_fetch_download.subr
+++ b/subr/pkg_fetch_download.subr
@@ -2,6 +2,29 @@
# set +o errexit -o noglob -o nounset is assumed.
#
+pkg_fetch_download_clean_dlcache() {
+ local _dlcachedir="${1}" _pkg_name="${2}" _pkg_fname="${3}" _pkg_urls_git="${4}"\
+ _fname="" _pkg_urls_git_dname="";
+
+ if [ -n "${_pkg_urls_git}" ]; then
+ _pkg_urls_git_dname="${_pkg_urls_git%%=*}";
+ _pkg_urls_git_dname="${_pkg_urls_git_dname##*/}";
+ fi;
+ for _fname in $(cd "${_dlcachedir}/${_pkg_name}" && find \
+ -mindepth 1 \
+ -not -name "${_pkg_fname}" \
+ -not -name "${_pkg_fname}.fetched" \
+ ${_pkg_urls_git_dname:+ \
+ -not -path "./${_pkg_urls_git_dname}" \
+ -not -path "./${_pkg_urls_git_dname}/*" \
+ -not -path "./${_pkg_urls_git_dname}.git" \
+ -not -path "./${_pkg_urls_git_dname}.git/*"}); do
+ _fname="${_dlcachedir}/${_pkg_name}/${_fname#./}"
+ rtl_log_msg notice "Deleting redundant file \`%s' for package \`%s'." "${_fname}" "${_pkg_name}";
+ rtl_fileop rm "${_fname}";
+ done;
+};
+
pkg_fetch_download_dlcache_subdir() {
if [ -n "${PKG_INHERIT_FROM:-}" ]\
&& ! [ -e "${BUILD_DLCACHEDIR}/${PKG_NAME}" ]\
@@ -17,8 +40,6 @@ pkg_fetch_download_dlcache_subdir() {
};
pkg_fetch_download() {
- local _fname="";
-
if [ "${ARG_FETCH_FORCE:-}" != "offline" ]; then
if [ -n "${PKG_URL:-}" ]; then
if ! pkg_fetch_download_dlcache_subdir; then
@@ -27,15 +48,6 @@ pkg_fetch_download() {
"${PKG_URL}" "${PKG_SHA256SUM}" "${BUILD_DLCACHEDIR}/${PKG_NAME}"\
"${PKG_FNAME}" "${PKG_NAME}" "${PKG_MIRRORS:-}"; then
return 1;
- else
- for _fname in $(find \
- "${BUILD_DLCACHEDIR}/${PKG_NAME}" \
- -type f \
- -not -name "${PKG_FNAME}" \
- -not -name "${PKG_FNAME}.fetched"); do
- rtl_log_msg notice "Deleting redundant file \`%s' for package \`%s'." "${_fname}" "${PKG_NAME}";
- rtl_fileop rm "${_fname}";
- done;
fi;
fi;
if [ -n "${PKG_URLS_GIT:-}" ]; then
@@ -47,6 +59,7 @@ pkg_fetch_download() {
return 1;
fi;
fi;
+ pkg_fetch_download_clean_dlcache "${BUILD_DLCACHEDIR}" "${PKG_NAME}" "${PKG_FNAME}" "${PKG_URLS_GIT}";
fi;
};