summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2019-08-03 14:43:17 +0200
committerThomas Deutschmann <whissi@gentoo.org>2019-08-08 21:47:43 +0200
commit59e3009e8893e44ebb52abefe8fb1fbcd2adf57c (patch)
tree99845e3db793808f7b28985ad6b7aff4daced2ba /eclass/savedconfig.eclass
parentsavedconfig.eclass: Always quote filename in output (diff)
downloadgentoo-59e3009e8893e44ebb52abefe8fb1fbcd2adf57c.tar.gz
gentoo-59e3009e8893e44ebb52abefe8fb1fbcd2adf57c.tar.bz2
gentoo-59e3009e8893e44ebb52abefe8fb1fbcd2adf57c.zip
savedconfig.eclass: Only check config file candidate once
Due to the injection of $CTARGET and $CHOST in file path we could end up with an already checked config file candidate if $CTARGET or $CHOST isn't used. This commit will make sure that we don't check the same file twice. Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'eclass/savedconfig.eclass')
-rw-r--r--eclass/savedconfig.eclass12
1 files changed, 8 insertions, 4 deletions
diff --git a/eclass/savedconfig.eclass b/eclass/savedconfig.eclass
index 1ea464271af..b2be715630a 100644
--- a/eclass/savedconfig.eclass
+++ b/eclass/savedconfig.eclass
@@ -113,20 +113,24 @@ restore_config() {
use savedconfig || return
- local found check configfile
+ local found check checked configfile
local base=${PORTAGE_CONFIGROOT%/}/etc/portage/savedconfig
for check in {${CATEGORY}/${PF},${CATEGORY}/${P},${CATEGORY}/${PN}}; do
- configfile=${base}/${CTARGET}/${check}
- [[ -r ${configfile} ]] || configfile=${base}/${CHOST}/${check}
+ configfile=${base}/${CTARGET:+"${CTARGET}/"}${check}
+ [[ -r ${configfile} ]] || configfile=${base}/${CHOST:+"${CHOST}/"}${check}
[[ -r ${configfile} ]] || configfile=${base}/${check}
- einfo "Checking existence of ${configfile} ..."
+ [[ "${checked}" == *"${configfile} "* ]] && continue
+ einfo "Checking existence of \"${configfile}\" ..."
if [[ -r "${configfile}" ]] ; then
einfo "Found \"${configfile}\""
found=${configfile}
_SAVEDCONFIG_CONFIGURATION_FILE=${configfile#${base}/}
break
fi
+
+ checked+="${configfile} "
done
+
if [[ -f ${found} ]]; then
elog "Building using saved configfile \"${found}\""
if [ $# -gt 0 ]; then