Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Thu, 08 Aug 2019 19:47:56
Message-Id: 1565293663.59e3009e8893e44ebb52abefe8fb1fbcd2adf57c.whissi@gentoo
1 commit: 59e3009e8893e44ebb52abefe8fb1fbcd2adf57c
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Sat Aug 3 12:43:17 2019 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Thu Aug 8 19:47:43 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59e3009e
7
8 savedconfig.eclass: Only check config file candidate once
9
10 Due to the injection of $CTARGET and $CHOST in file path
11 we could end up with an already checked config file candidate
12 if $CTARGET or $CHOST isn't used.
13
14 This commit will make sure that we don't check the same file twice.
15
16 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
17
18 eclass/savedconfig.eclass | 12 ++++++++----
19 1 file changed, 8 insertions(+), 4 deletions(-)
20
21 diff --git a/eclass/savedconfig.eclass b/eclass/savedconfig.eclass
22 index 1ea464271af..b2be715630a 100644
23 --- a/eclass/savedconfig.eclass
24 +++ b/eclass/savedconfig.eclass
25 @@ -113,20 +113,24 @@ restore_config() {
26
27 use savedconfig || return
28
29 - local found check configfile
30 + local found check checked configfile
31 local base=${PORTAGE_CONFIGROOT%/}/etc/portage/savedconfig
32 for check in {${CATEGORY}/${PF},${CATEGORY}/${P},${CATEGORY}/${PN}}; do
33 - configfile=${base}/${CTARGET}/${check}
34 - [[ -r ${configfile} ]] || configfile=${base}/${CHOST}/${check}
35 + configfile=${base}/${CTARGET:+"${CTARGET}/"}${check}
36 + [[ -r ${configfile} ]] || configfile=${base}/${CHOST:+"${CHOST}/"}${check}
37 [[ -r ${configfile} ]] || configfile=${base}/${check}
38 - einfo "Checking existence of ${configfile} ..."
39 + [[ "${checked}" == *"${configfile} "* ]] && continue
40 + einfo "Checking existence of \"${configfile}\" ..."
41 if [[ -r "${configfile}" ]] ; then
42 einfo "Found \"${configfile}\""
43 found=${configfile}
44 _SAVEDCONFIG_CONFIGURATION_FILE=${configfile#${base}/}
45 break
46 fi
47 +
48 + checked+="${configfile} "
49 done
50 +
51 if [[ -f ${found} ]]; then
52 elog "Building using saved configfile \"${found}\""
53 if [ $# -gt 0 ]; then