|
Lucio Andrés Illanes Albornoz (arab, vxp) |
570129 |
#
|
|
Lucio Andrés Illanes Albornoz |
e1d469 |
# set +o errexit -o noglob -o nounset is assumed.
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
570129 |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
570129 |
|
|
Lucio Andrés Illanes Albornoz |
2c5ce2 |
pkg_fetch_download_clean_dlcache() {
|
|
Lucio Andrés Illanes Albornoz |
2c5ce2 |
local _dlcachedir="${1}" _pkg_name="${2}" _pkg_fname="${3}" _pkg_urls_git="${4}"\
|
|
Lucio Andrés Illanes Albornoz |
2c5ce2 |
_fname="" _pkg_urls_git_dname="";
|
|
Lucio Andrés Illanes Albornoz |
2c5ce2 |
|
|
Lucio Andrés Illanes Albornoz |
2c5ce2 |
if [ -n "${_pkg_urls_git}" ]; then
|
|
Lucio Andrés Illanes Albornoz |
2c5ce2 |
_pkg_urls_git_dname="${_pkg_urls_git%%=*}";
|
|
Lucio Andrés Illanes Albornoz |
2c5ce2 |
_pkg_urls_git_dname="${_pkg_urls_git_dname##*/}";
|
|
Lucio Andrés Illanes Albornoz |
2c5ce2 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
84398b |
for _fname in $(cd "${_dlcachedir}/${_pkg_name}" && find \
|
|
Lucio Andrés Illanes Albornoz |
84398b |
-mindepth 1 \
|
|
Lucio Andrés Illanes Albornoz |
84398b |
${_pkg_fname:+-not -name "${_pkg_fname}"} \
|
|
Lucio Andrés Illanes Albornoz |
84398b |
${_pkg_fname:+-not -name "${_pkg_fname}.fetched"} \
|
|
Lucio Andrés Illanes Albornoz |
84398b |
${_pkg_urls_git_dname:+ \
|
|
Lucio Andrés Illanes Albornoz |
84398b |
-not -path "./${_pkg_urls_git_dname}" \
|
|
Lucio Andrés Illanes Albornoz |
84398b |
-not -path "./${_pkg_urls_git_dname}/*" \
|
|
Lucio Andrés Illanes Albornoz |
84398b |
-not -path "./${_pkg_urls_git_dname}.git" \
|
|
Lucio Andrés Illanes Albornoz |
2c5ce2 |
-not -path "./${_pkg_urls_git_dname}.git/*"}); do
|
|
Lucio Andrés Illanes Albornoz |
2c5ce2 |
_fname="${_dlcachedir}/${_pkg_name}/${_fname#./}"
|
|
Lucio Andrés Illanes Albornoz |
2c5ce2 |
rtl_log_msg notice "Deleting redundant file \`%s' for package \`%s'." "${_fname}" "${_pkg_name}";
|
|
Lucio Andrés Illanes Albornoz |
2c5ce2 |
rtl_fileop rm "${_fname}";
|
|
Lucio Andrés Illanes Albornoz |
2c5ce2 |
done;
|
|
Lucio Andrés Illanes Albornoz |
2c5ce2 |
};
|
|
Lucio Andrés Illanes Albornoz |
2c5ce2 |
|
|
Lucio Andrés Illanes Albornoz |
10ff54 |
pkg_fetch_download_dlcache_subdir() {
|
|
Lucio Andrés Illanes Albornoz |
10ff54 |
if [ -n "${PKG_INHERIT_FROM:-}" ]\
|
|
Lucio Andrés Illanes Albornoz |
10ff54 |
&& ! [ -e "${BUILD_DLCACHEDIR}/${PKG_NAME}" ]\
|
|
Lucio Andrés Illanes Albornoz |
10ff54 |
&& ! rtl_fileop ln_symbolic "${PKG_INHERIT_FROM}" "${BUILD_DLCACHEDIR}/${PKG_NAME}"; then
|
|
Lucio Andrés Illanes Albornoz |
10ff54 |
return 1;
|
|
Lucio Andrés Illanes Albornoz |
10ff54 |
elif [ -z "${PKG_INHERIT_FROM:-}" ]\
|
|
Lucio Andrés Illanes Albornoz |
10ff54 |
&& ! [ -e "${BUILD_DLCACHEDIR}/${PKG_NAME}" ]\
|
|
Lucio Andrés Illanes Albornoz |
10ff54 |
&& ! rtl_fileop mkdir "${BUILD_DLCACHEDIR}/${PKG_NAME}"; then
|
|
Lucio Andrés Illanes Albornoz |
10ff54 |
return 1;
|
|
Lucio Andrés Illanes Albornoz |
10ff54 |
else
|
|
Lucio Andrés Illanes Albornoz |
10ff54 |
return 0;
|
|
Lucio Andrés Illanes Albornoz |
10ff54 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
10ff54 |
};
|
|
Lucio Andrés Illanes Albornoz |
10ff54 |
|
|
Lucio Andrés Illanes Albornoz |
d279a9 |
pkg_fetch_download() {
|
|
Lucio Andrés Illanes Albornoz |
b63b9b |
if [ "${ARG_FETCH_FORCE:-}" != "offline" ]; then
|
|
Lucio Andrés Illanes Albornoz |
b63b9b |
if [ -n "${PKG_URL:-}" ]; then
|
|
Lucio Andrés Illanes Albornoz |
10ff54 |
if ! pkg_fetch_download_dlcache_subdir; then
|
|
Lucio Andrés Illanes Albornoz |
10ff54 |
return 1;
|
|
Lucio Andrés Illanes Albornoz |
10ff54 |
elif ! rtl_fetch_url_wget \
|
|
Lucio Andrés Illanes Albornoz |
10ff54 |
"${PKG_URL}" "${PKG_SHA256SUM}" "${BUILD_DLCACHEDIR}/${PKG_NAME}"\
|
|
Lucio Andrés Illanes Albornoz |
368962 |
"${PKG_FNAME}" "${PKG_NAME}" "${PKG_MIRRORS:-}"; then
|
|
Lucio Andrés Illanes Albornoz |
b63b9b |
return 1;
|
|
Lucio Andrés Illanes Albornoz |
b63b9b |
fi;
|
|
Lucio Andrés Illanes Albornoz |
bf9edf |
fi;
|
|
Lucio Andrés Illanes Albornoz |
b63b9b |
if [ -n "${PKG_URLS_GIT:-}" ]; then
|
|
Lucio Andrés Illanes Albornoz |
10ff54 |
if ! pkg_fetch_download_dlcache_subdir; then
|
|
Lucio Andrés Illanes Albornoz |
10ff54 |
return 1;
|
|
Lucio Andrés Illanes Albornoz |
10ff54 |
elif ! rtl_fetch_urls_git \
|
|
Lucio Andrés Illanes Albornoz |
10ff54 |
"${BUILD_DLCACHEDIR}/${PKG_NAME}" "${DEFAULT_GIT_ARGS}" "${PKG_BASE_DIR}"\
|
|
Lucio Andrés Illanes Albornoz |
368962 |
"${PKG_NAME}" "${PKG_MIRRORS_GIT:-}" ${PKG_URLS_GIT}; then
|
|
Lucio Andrés Illanes Albornoz |
b63b9b |
return 1;
|
|
Lucio Andrés Illanes Albornoz |
b63b9b |
fi;
|
|
Lucio Andrés Illanes Albornoz |
bf9edf |
fi;
|
|
Lucio Andrés Illanes Albornoz |
84398b |
pkg_fetch_download_clean_dlcache "${BUILD_DLCACHEDIR}" "${PKG_NAME}" "${PKG_FNAME:-}" "${PKG_URLS_GIT:-}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
570129 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
570129 |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
570129 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
570129 |
# vim:filetype=sh
|