Blob Blame History Raw
#
# set +o errexit -o noglob -o nounset is assumed.
#

pkg_fetch_download() {
	local _pfd_group_name="${1}" _pfd_pkg_name="${2}" _pfd_restart_at="${3}";

	if [ "${ARG_FETCH_FORCE:-}" != "offline" ]; then
		if [ "${PKG_URL:+1}" = 1 ]; then
			if ! rtl_fetch_dlcache_subdir				\
					"${BUILD_DLCACHEDIR}" "${PKG_NAME}"	\
					"${PKG_INHERIT_FROM:-}";
			then
				return 1;
			elif ! rtl_fetch_url_wget	\
					"${PKG_URL}" "${PKG_SHA256SUM}" "${BUILD_DLCACHEDIR}/${PKG_NAME}"\
					"${PKG_FNAME}" "${PKG_NAME}" "${PKG_MIRRORS:-}"; then
				return 1;
			fi;
		fi;

		if [ "${PKG_URLS_GIT:+1}" = 1 ]; then
			if ! rtl_fetch_dlcache_subdir				\
					"${BUILD_DLCACHEDIR}" "${PKG_NAME}"	\
					"${PKG_INHERIT_FROM:-}";
			then
				return 1;
			elif ! rtl_fetch_urls_git	\
					"${BUILD_DLCACHEDIR}/${PKG_NAME}" "${DEFAULT_GIT_ARGS}" "${PKG_BASE_DIR}"\
					"${PKG_NAME}" "${PKG_MIRRORS_GIT:-}" ${PKG_URLS_GIT}; then
				return 1;
			fi;
		fi;

		rtl_fetch_clean_dlcache				\
			"${BUILD_DLCACHEDIR}" "${PKG_NAME}"	\
			"${PKG_FNAME:-}" "${PKG_URLS_GIT:-}";
	fi;

	return 0;
};

# vim:filetype=sh textwidth=0