summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--subr.rtl/rtl_fetch_git.subr6
-rw-r--r--subr/pkg_fetch_download.subr29
2 files changed, 18 insertions, 17 deletions
diff --git a/subr.rtl/rtl_fetch_git.subr b/subr.rtl/rtl_fetch_git.subr
index 2d6ce8ab..9350b09c 100644
--- a/subr.rtl/rtl_fetch_git.subr
+++ b/subr.rtl/rtl_fetch_git.subr
@@ -20,7 +20,7 @@ rtlp_fetch_url_git() {
elif [ "${_mirrors}" = "skip" ]; then
return 1;
else for _url_base in ${_mirrors}; do
- if git clone ${_git_args} -b "${_git_branch:-main}" "${_url_base}/${_pkg_name}/${_url##*/}" "${_cache_dname_full}"; then
+ if git clone ${_git_args} -b "${_git_branch:-main}" "${_url_base}/${_pkg_name}/${_subdir}" "${_cache_dname_full}"; then
_clonefl=1; break;
fi;
done;
@@ -57,7 +57,7 @@ rtl_fetch_mirror_urls_git() {
for _url_spec in "${@}"; do
_subdir="${_url_spec%=*}"; _subdir="${_subdir##*/}"; _url="${_url_spec#*=}"; _url="${_url%@*}";
- _repo_dname="${_url##*/}"; [ "${_repo_dname%.git}" = "${_repo_dname}" ] && _repo_dname="${_repo_dname}.git";
+ _repo_dname="${_subdir}"; [ "${_repo_dname%.git}" = "${_repo_dname}" ] && _repo_dname="${_repo_dname}.git";
if [ ! -e "$(rtl_dirname "${_tgtdir}")" ]; then
rtl_fileop mkdir "$(rtl_dirname "${_tgtdir}")";
@@ -67,7 +67,7 @@ rtl_fetch_mirror_urls_git() {
trap "rm -f \"${_tgtdir}/.fetching\"" EXIT;
if [ -e "${_tgtdir}/${_repo_dname}" ]; then
(rtl_fileop cd "${_tgtdir}/${_repo_dname}" && git fetch ${_git_args} --all) || return 1;
- else (rtl_fileop cd "${_tgtdir}" && git clone ${_git_args} --mirror "${_url}") || return 1;
+ else (rtl_fileop cd "${_tgtdir}" && git clone ${_git_args} --mirror "${_url}" "${_repo_dname}") || return 1;
fi) 4<>"${_tgtdir}/.fetching";
if [ "${?}" -ne 0 ]; then
_rc=1;
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;
};