diff options
author | Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de> | 2021-08-19 21:04:15 +0200 |
---|---|---|
committer | Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de> | 2021-08-19 21:04:15 +0200 |
commit | 986162fb1883cce2ef3692c19272974e4bb28f1c (patch) | |
tree | c79cf09c10e619ffffd000b23631d8289f4fd7ff /subr | |
parent | bca26dc0cf3771fb4da26b570f66ab1ac46bd25d (diff) | |
download | midipix_build-986162fb1883cce2ef3692c19272974e4bb28f1c.tar.bz2 midipix_build-986162fb1883cce2ef3692c19272974e4bb28f1c.tar.xz |
subr.rtl/rtl_fetch_git.subr:{rtlp_fetch_url_git,rtl_fetch_mirror_urls_git}(): correctly reference ${_subdir} when {fetching,mirroring}.
subr/pkg_fetch_download.subr:pkg_fetch_download_clean_dlcache(): correctly cleanup dlcache wrt. Git repositories.
Diffstat (limited to 'subr')
-rw-r--r-- | subr/pkg_fetch_download.subr | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/subr/pkg_fetch_download.subr b/subr/pkg_fetch_download.subr index 0affb358..d6f300d8 100644 --- a/subr/pkg_fetch_download.subr +++ b/subr/pkg_fetch_download.subr @@ -4,24 +4,25 @@ pkg_fetch_download_clean_dlcache() { local _dlcachedir="${1}" _pkg_name="${2}" _pkg_fname="${3}" _pkg_urls_git="${4}"\ - _fname="" _pkg_urls_git_dname=""; + _fname="" _skipfl=0 _url_spec="" _url_subdir=""; - 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 \ + -maxdepth 1 \ -mindepth 1 \ ${_pkg_fname:+-not -name "${_pkg_fname}"} \ - ${_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}"; + ${_pkg_fname:+-not -name "${_pkg_fname}.fetched"}); do + _fname="${_fname#./}"; _skipfl=0; + for _url_spec in ${_pkg_urls_git}; do + _url_subdir="${_url_spec%%=*}"; _url_subdir="${_url_subdir##*/}"; + if [ "${_fname%.git}" = "${_url_subdir}" ]; then + _skipfl=1; break; + fi; + done; + if [ "${_skipfl}" -eq 0 ]; then + _fname="${_dlcachedir}/${_pkg_name}/${_fname}"; + rtl_log_msg notice "Deleting redundant file \`%s' for package \`%s'." "${_fname}" "${_pkg_name}"; + rtl_fileop rm "${_fname}"; + fi; done; }; |