From 7acc786ea1a6570cd8e1586ba8303ad6c4379348 Mon Sep 17 00:00:00 2001 From: Bertrand Jacquin Date: Thu, 16 Aug 2018 23:01:19 +0100 Subject: eclass/linux-build: Simplify retrieval of previous version --- eclass/linux-build.eclass | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/eclass/linux-build.eclass b/eclass/linux-build.eclass index 69129de7..4442d31d 100644 --- a/eclass/linux-build.eclass +++ b/eclass/linux-build.eclass @@ -66,6 +66,27 @@ _linux-build_configval() { esac } +_linux-build_get-portage-versions() { + local -a _v + local _rv + + if [[ "${PF}" != "${P}" ]] ; then + _v+=( "${PF}" ) + fi + + _v+=( "${P}" ) + + if [[ -n "${REPLACING_VERSIONS}" ]] ; then + for _rv in ${REPLACING_VERSIONS} ; do + _v+=( "${PN}-${_rv}" ) + done + fi + + _v+=( "${PN}" ) + + echo "${_v[@]}" +} + _linux-build_pkg_setup-build-config() { local _v @@ -79,7 +100,7 @@ _linux-build_pkg_setup-build-config() { return 0 fi - for _v in "${PF}" "${P}" "${PN}" ; do + for _v in $(_linux-build_get-portage-versions) ; do einfo "Checking existence of ${PORTAGE_CONFIGROOT%/}/etc/portage/savedconfig/${CATEGORY}/${_v}" if [[ -e "${PORTAGE_CONFIGROOT%/}/etc/portage/savedconfig/${CATEGORY}/${_v}" ]] ; then eend 0 @@ -96,23 +117,13 @@ _linux-build_pkg_setup-build-config() { eend 1 done - for _v in ${REPLACING_VERSIONS} ; do - einfo "Checking existence of ${PORTAGE_CONFIGROOT%/}/etc/portage/savedconfig/${CATEGORY}/${PN}-${_v}" - if [[ -e "${PORTAGE_CONFIGROOT%/}/etc/portage/savedconfig/${CATEGORY}/${PN}-${_v}" ]] ; then - cp "${PORTAGE_CONFIGROOT%/}/etc/portage/savedconfig/${CATEGORY}/${PN}-${_v}" \ - "${T}/config" - eend 0 - return 0 - fi - done - return 1 } _linux-build_pkg_setup-build-x509() { local _v - for _v in "${PF}" "${P}" "${PN}" ; do + for _v in $(_linux-build_get-portage-versions) ; do einfo "Checking existence of ${PORTAGE_CONFIGROOT%/}/etc/ssl/private/${_v}.pem" if [[ -e "${PORTAGE_CONFIGROOT%/}/etc/ssl/private/${_v}.pem" ]] ; then -- cgit v1.2.3