diff options
author | Lucía Andrea Illanes Albornoz <lucia@luciaillanes.de> | 2023-02-17 19:29:28 +0100 |
---|---|---|
committer | Lucía Andrea Illanes Albornoz <lucia@luciaillanes.de> | 2023-02-17 19:29:28 +0100 |
commit | e9fa0774ed2e7e030a68f5b0ae51fe6dd69fe492 (patch) | |
tree | 37e46c2578bd8f4f435073db01abc514976da8a8 /subr.pkg/pkg_fetch_download.subr | |
parent | 56495632fc8bf612766a9c431e37ff27a903e8c6 (diff) | |
download | midipix_build-e9fa0774ed2e7e030a68f5b0ae51fe6dd69fe492.tar.bz2 midipix_build-e9fa0774ed2e7e030a68f5b0ae51fe6dd69fe492.tar.xz |
Make everything a bit faster.
0) Issues several prayers and sacrifices to Enki under threat of a terrible deluge sent down by Ellil
1) Convert fork-write/read exprs to be non-forking
2) Pass mostly everything by reference
3) Don't bother cleaning the variable namespace because Bourne shell is an abomination
4) Removes broken ./pkgtool.sh -s, --restart-at, --update-diff & ./build.sh --dump-{in,on-abort}
5) Cleanup
Diffstat (limited to 'subr.pkg/pkg_fetch_download.subr')
-rw-r--r-- | subr.pkg/pkg_fetch_download.subr | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/subr.pkg/pkg_fetch_download.subr b/subr.pkg/pkg_fetch_download.subr new file mode 100644 index 00000000..fe7fff85 --- /dev/null +++ b/subr.pkg/pkg_fetch_download.subr @@ -0,0 +1,43 @@ +# +# 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 |