From 854d8403909e7deb0e945ca4723d63ef34357192 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sat, 16 Jan 2021 04:49:56 -0500 Subject: profile/proteanos: Use archive's Platforms file --- (limited to 'src/profile') diff --git a/src/profile/proteanos.sh b/src/profile/proteanos.sh index 30e20f4..8a2cf91 100644 --- a/src/profile/proteanos.sh +++ b/src/profile/proteanos.sh @@ -1,6 +1,6 @@ # ProteanOS architecture detection and feeds lists. # -# Copyright (C) 2013-2016 Patrick McDermott +# Copyright (C) 2013-2016, 2021 Patrick McDermott # # This file is part of the ProteanOS Development Kit. # @@ -36,7 +36,60 @@ start() rm -f "${SCRIPT}" } ' -_prof_proteanos_manifest='' + +_prof_proteanos_platforms='' +_prof_proteanos_platforms_platform='' +_prof_proteanos_platforms_type='' +_prof_proteanos_platforms_sections='' + +_prof_proteanos_platforms_field() +{ + local name="${1}" + local value="${2}" + shift 2 + + case "${name}" in + 'Platform') + _prof_proteanos_platforms_platform="${value}" + ;; + 'Type') + _prof_proteanos_platforms_type="${value}" + ;; + 'Sections') + _prof_proteanos_platforms_sections="${value}" + ;; + esac +} + +_prof_proteanos_platforms_paragraph() +{ + local platform= + local archplat= + + platform="${_prof_proteanos_platforms_platform}" + archplat="$(printf '%s' "${platform}" | tr -c '[a-z0-9/]' '_')" + archplat="${archplat%/*}__${archplat#*/}" + + _prof_proteanos_platforms="${_prof_proteanos_platforms}${platform} " + eval "_prof_proteanos_archplat_type_${archplat}=$(: \ + )\"\${_prof_proteanos_platforms_type}\"" + eval "_prof_proteanos_archplat_sections_${archplat}=$(: \ + )\"\${_prof_proteanos_platforms_sections}\"" +} + +_prof_proteanos_get_platforms() +{ + local mirror="${1}" + local suite="${2}" + shift 2 + + [ -n "${_prof_proteanos_platforms}" ] && return + + parse_control - _prof_proteanos_platforms_field \ + _prof_proteanos_platforms_paragraph 0<<-EOF + $(${WGET} -q -O - -- "${mirror}/feeds/${suite}/Platforms") + EOF +} prof_proteanos_detect_root() { @@ -118,20 +171,13 @@ prof_proteanos_validate_archplat() shift 4 local archplat= - [ -z "${_prof_proteanos_manifest}" ] && \ - _prof_proteanos_manifest="$(${WGET} -q -O - -- \ - "${mirror}/feeds/${suite}/Manifest")" + _prof_proteanos_get_platforms "${mirror}" "${suite}" - while read -r archplat; do - case "${archplat}" in - all/*/* | */all/*) ;; - "${arch}/${plat}/"*) - return 0 - ;; - esac - done <<-EOF - ${_prof_proteanos_manifest} - EOF + case " ${_prof_proteanos_platforms} " in + *" ${arch}/${plat} "*) + return 0 + ;; + esac return 1 } @@ -155,27 +201,27 @@ prof_proteanos_feeds() local plat="${3}" local suite="${4}" shift 4 + local arch_clean= + local plat_clean= + local archplat= local sects= + local manifest= local a= local p= local s= - [ -z "${_prof_proteanos_manifest}" ] && \ - _prof_proteanos_manifest="$(${WGET} -q -O - -- \ - "${mirror}/feeds/${suite}/Manifest")" + _prof_proteanos_get_platforms "${mirror}" "${suite}" + arch_clean="$(printf '%s' "${arch}" | tr -c '[a-z0-9/]' '_')" + plat_clean="$(printf '%s' "${plat}" | tr -c '[a-z0-9/]' '_')" + archplat="${arch_clean}__${plat_clean}" + eval "sects=\"\${_prof_proteanos_archplat_sections_${archplat}}\"" + + manifest="$(${WGET} -q -O - -- "${mirror}/feeds/${suite}/Manifest")" - case "${plat}" in - 'dev') - sects='base dev lib libdev share util' - ;; - *) - sects='base boot lib share util' - esac - for a in "${arch}" 'all'; do for p in "${plat}" 'all'; do for s in ${sects}; do - case "${LF}${_prof_proteanos_manifest}${LF}" in + case "${LF}${manifest}${LF}" in *"${LF}${a}/${p}/${s}${LF}"*) ;; *) continue;; esac -- cgit v0.9.1