diff options
-rw-r--r-- | 361.zsh.vars | 12 | ||||
-rw-r--r-- | build.subr | 22 | ||||
-rw-r--r-- | build.vars | 2 |
3 files changed, 16 insertions, 20 deletions
diff --git a/361.zsh.vars b/361.zsh.vars deleted file mode 100644 index 0c4dce28..00000000 --- a/361.zsh.vars +++ /dev/null @@ -1,12 +0,0 @@ -# -# . ./build.vars and set -o errexit are assumed. -# - -pkg_zsh_fetch() { - WGET_ARGS="-O ${PKG_FNAME}"; - fetch "${PKG_URL}"; - fetch "$(sed -ne '/class="direct-download">/s/^\s*<a href="\(.\+\)" class="direct-download">$/\1/p' \ - ${PKG_FNAME})" ${PKG_SHA256SUM}; -}; - -# vim:filetype=sh @@ -178,14 +178,22 @@ clear_env_with_except() { # N.B. URLs ($1) may contain `?' or '&' characters. fetch() { [ ${ARG_NO_DOWNLOAD:-0} -eq 1 ] && return; - rm_if_exists $(get_basename ${1}); - wget ${WGET_ARGS} "${1}"; - if [ ${#} -eq 2 ]; then - set -- $(get_basename ${1}) "$(compare_hash $(get_basename ${1}) ${2})" ${2}; - if [ -n "${2}" ]; then - log_msg failexit "Error: hash mismatch for URL \`${1}' (is: ${2}, should be: ${3}.)"; - fi; + _f_url="${1}"; _f_sha256sum_src="${2}"; + _f_url_dst="$(get_basename "${_f_url}")"; + rm_if_exists ${_f_url_dst}; + if match_any "${_f_url}" "/downloads.sourceforge.net/" ; then + _f_url="$(wget ${WGET_ARGS} "${_f_url}" -qO- |\ + sed -n '/class="direct-download"/s,^.*href="\([^"]\+\)".*$,\1,p')"; fi; + wget ${WGET_ARGS} -O ${_f_url_dst} "${_f_url}"; + if [ -n "${_f_sha256sum_src}" ]; then + _f_sha256sum_dst="$(compare_hash ${_f_url_dst} ${_f_sha256sum_src})"; + if [ -n "${_f_sha256sum_dst}" ]; then + set -- "${_f_url}" ${_f_sha256sum_dst} ${_f_sha256sum_src}; + unset _f_url _f_url_dst _f_sha256sum_src _f_sha256sum_dst; + log_msg failexit "Error: hash mismatch for URL \`${1}' (is: ${2}, should be: ${3}.)"; + fi; unset _f_sha256sum_dst; + fi; unset _f_url _f_url_dst _f_sha256sum_src; }; compare_hash() { @@ -48,7 +48,7 @@ fi; export PATH="${PREFIX}/bin${PATH:+:${PATH}}"; : ${TIMESTAMP_FMT:="%Y/%m/%d %H:%M:%S"}; : ${TIMESTAMP_FMT_STATUS_FILES:=%Y-%m-%d-%H-%M-%S}; -: ${WGET_ARGS:="-N --no-check-certificate"}; +: ${WGET_ARGS:="--no-check-certificate"}; : ${WORKDIR:=${PREFIX}/tmp}; : ${PKG_BUILD_NAMES:="apk_tools bash binutils binutils_host bzip2 coreutils curl dalist dash diffutils findutils gawk git glib gmp grep gzip hexcurse irssi less libarchive libelf libfetch libffi libnbcompat libressl libz make mksh mpc mpfr nano ncurses ncursestw ncursesw ntapi ntcon ntctty openssh pacman patch pemagine perl popt psxscl psxstub psxtypes python3 rsync sed slibtool tar tcsh util_linux which xz zsh"}; |