From 0bb2fe5ce7d0ea9bffc550bf60062673024948c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz=20=28arab=2C=20vx?= =?UTF-8?q?p=29?= Date: Fri, 18 Nov 2016 15:36:39 +0100 Subject: subr/check_updates.subr: preliminary support for apk_tools and bzip2. --- build.sh | 4 +++- subr/check_updates.subr | 32 +++++++++++++++++--------------- vars/check_updates.vars | 29 +++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 16 deletions(-) diff --git a/build.sh b/build.sh index 38a66c15..435f7e63 100755 --- a/build.sh +++ b/build.sh @@ -50,9 +50,11 @@ fi; check_paths; clean_prefix; create_dirs; init_build_log; init_build_progress_file; {(init_build_vars; -log_msg info "Build started by ${BUILD_USER:=${USER}}@${BUILD_HNAME:=$(hostname)} at ${BUILD_DATE_START}."; if [ ${ARG_CHECK_UPDATES:-0} -eq 0 ]; then + log_msg info "Build started by ${BUILD_USER:=${USER}}@${BUILD_HNAME:=$(hostname)} at ${BUILD_DATE_START}."; log_env_vars "build (global)" ${LOG_ENV_VARS}; +else + log_msg info "Version check run started by ${BUILD_USER:=${USER}}@${BUILD_HNAME:=$(hostname)} at ${BUILD_DATE_START}."; fi; for BUILD_TARGET_LC in $(subst_tgts ${BUILD_TARGETS_META}); do BUILD_TARGET=$(echo ${BUILD_TARGET_LC} | tr a-z A-Z); diff --git a/subr/check_updates.subr b/subr/check_updates.subr index fc331211..7af20e96 100644 --- a/subr/check_updates.subr +++ b/subr/check_updates.subr @@ -6,22 +6,24 @@ cpu_get_fnames() { if test_cmd pkg_${cu_name}_check_updates; then pkg_${cu_name}_check_updates get_fnames; - elif [ "${cu_url#*://github.com/*}" != "${cu_url}" ]; then - _cpugf_uname="${cu_url#*/github.com/}"; - _cpugf_uname="${_cpugf_uname%%/*}"; - _cpugf_pname="${cu_url#*/github.com/${_cpugf_uname}/}"; - _cpugf_pname="${_cpugf_pname%%/*}"; - cu_url_index="https://github.com/${_cpugf_uname%%/*}/${_cpugf_pname%%/*}/releases/"; - unset _cpu_uname _cpu_pname; - cu_fnames="$(wget ${WGET_ARGS} -qO- ${cu_url_index} |\ - sed -n '//s/^.*\([a-zA-Z]\+-\|v\|\)\(.\+\)<\/span>.*$/\2/p')"; - cu_fname_base="${cu_name}"; - cu_fname_ext="${cu_fname#v${cu_version}.}"; fi; - if [ -z "${cu_url_index}" ]; then - cu_url_index="${cu_url%/*}/"; - cu_fnames="$(wget ${WGET_ARGS} -qO- "${cu_url_index}" |\ - sed -n '/[hH][rR][eE][fF]="[^"]\+"/s/^.*[hH][rR][eE][fF]="\([^"]\+\)".*$/\1/p')"; + if [ -z "${cu_fnames}" ]; then + if [ "${cu_url#*://github.com/*}" != "${cu_url}" ]; then + _cpugf_uname="${cu_url#*/github.com/}"; + _cpugf_uname="${_cpugf_uname%%/*}"; + _cpugf_pname="${cu_url#*/github.com/${_cpugf_uname}/}"; + _cpugf_pname="${_cpugf_pname%%/*}"; + cu_url_index="https://github.com/${_cpugf_uname%%/*}/${_cpugf_pname%%/*}/releases/"; + unset _cpu_uname _cpu_pname; + cu_fnames="$(wget ${WGET_ARGS} -qO- ${cu_url_index} |\ + sed -n '//s/^.*\([a-zA-Z]\+-\|v\|\)\(.\+\)<\/span>.*$/\2/p')"; + cu_fname_base="${cu_name}"; + cu_fname_ext="${cu_fname#v${cu_version}.}"; + else + cu_url_index="${cu_url%/*}/"; + cu_fnames="$(wget ${WGET_ARGS} -qO- "${cu_url_index}" |\ + sed -n '/[hH][rR][eE][fF]="[^"]\+"/s/^.*[hH][rR][eE][fF]="\([^"]\+\)".*$/\1/p')"; + fi; fi; : ${cu_fname:="${cu_url##*/}"}; : ${cu_fname_base:="${cu_fname%%-*}"}; diff --git a/vars/check_updates.vars b/vars/check_updates.vars index 6342c5c5..d7ad5bea 100644 --- a/vars/check_updates.vars +++ b/vars/check_updates.vars @@ -2,6 +2,35 @@ # . ./build.vars and set -o errexit -o noglob are assumed. # +pkg_apk_tools_check_updates() { + case "${1}" in + get_fnames) + cu_fname="${cu_url##*/}"; + cu_fname_base="apk-tools"; + cu_fname_ext="${cu_fname#${cu_fname_base}-${cu_version}.}"; + cu_url_index="http://git.alpinelinux.org/cgit/apk-tools/"; + cu_fnames="$(wget ${WGET_ARGS} -qO- "${cu_url_index}" |\ + sed -n '//s/^.*The current version is 1.0.6<\/b>/s/^.*

The current version is \(.\+\)<\/b>.*$/bzip2-\1/p')"; + ;; + get_version) + cu_fname_version="${cu_fname#bzip2-}"; + ;; + esac; +}; + pkg_infounzip_check_updates() { case "${1}" in get_fnames) -- cgit v1.2.3