Gentoo Archives: gentoo-commits

From: David Seifert <soap@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Sat, 25 May 2019 16:11:35
Message-Id: 1558800665.bf698cecb081079d6204637f692e33101abed805.soap@gentoo
1 commit: bf698cecb081079d6204637f692e33101abed805
2 Author: David Seifert <soap <AT> gentoo <DOT> org>
3 AuthorDate: Sat May 25 16:11:05 2019 +0000
4 Commit: David Seifert <soap <AT> gentoo <DOT> org>
5 CommitDate: Sat May 25 16:11:05 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bf698cec
7
8 savedconfig.eclass: Remove old EAPI ED/EROOT workarounds
9
10 * Also limit to EAPIs that are in use at the moment.
11
12 Closes: https://bugs.gentoo.org/685382
13 Signed-off-by: David Seifert <soap <AT> gentoo.org>
14
15 eclass/savedconfig.eclass | 21 ++++++++++-----------
16 1 file changed, 10 insertions(+), 11 deletions(-)
17
18 diff --git a/eclass/savedconfig.eclass b/eclass/savedconfig.eclass
19 index 1e9ac6c80b4..c4a0ccdc8fa 100644
20 --- a/eclass/savedconfig.eclass
21 +++ b/eclass/savedconfig.eclass
22 @@ -1,4 +1,4 @@
23 -# Copyright 1999-2011 Gentoo Foundation
24 +# Copyright 1999-2019 Gentoo Authors
25 # Distributed under the terms of the GNU General Public License v2
26
27 # @ECLASS: savedconfig.eclass
28 @@ -33,6 +33,11 @@ inherit portability
29
30 IUSE="savedconfig"
31
32 +case ${EAPI} in
33 + [4-7]) ;;
34 + *) die "EAPI=${EAPI:-0} is not supported" ;;
35 +esac
36 +
37 # @FUNCTION: save_config
38 # @USAGE: <config files to save>
39 # @DESCRIPTION:
40 @@ -46,19 +51,16 @@ save_config() {
41 fi
42 [[ $# -eq 0 ]] && die "Usage: save_config <files>"
43
44 - # Be lazy in our EAPI compat
45 - : ${ED:=${D}}
46 -
47 local dest="/etc/portage/savedconfig/${CATEGORY}"
48 if [[ $# -eq 1 && -f $1 ]] ; then
49 # Just one file, so have the ${PF} be that config file
50 dodir "${dest}"
51 - cp "$@" "${ED}/${dest}/${PF}" || die "failed to save $*"
52 + cp "$@" "${ED%/}/${dest}/${PF}" || die "failed to save $*"
53 else
54 # A dir, or multiple files, so have the ${PF} be a dir
55 # with all the saved stuff below it
56 dodir "${dest}/${PF}"
57 - treecopy "$@" "${ED}/${dest}/${PF}" || die "failed to save $*"
58 + treecopy "$@" "${ED%/}/${dest}/${PF}" || die "failed to save $*"
59 fi
60
61 elog "Your configuration for ${CATEGORY}/${PF} has been saved in "
62 @@ -99,7 +101,7 @@ restore_config() {
63 use savedconfig || return
64
65 local found check configfile
66 - local base=${PORTAGE_CONFIGROOT}/etc/portage/savedconfig
67 + local base=${PORTAGE_CONFIGROOT%/}/etc/portage/savedconfig
68 for check in {${CATEGORY}/${PF},${CATEGORY}/${P},${CATEGORY}/${PN}}; do
69 configfile=${base}/${CTARGET}/${check}
70 [[ -r ${configfile} ]] || configfile=${base}/${CHOST}/${check}
71 @@ -143,10 +145,7 @@ savedconfig_pkg_postinst() {
72 # are worse :/.
73
74 if use savedconfig ; then
75 - # Be lazy in our EAPI compat
76 - : ${EROOT:=${ROOT}}
77 -
78 - find "${EROOT}/etc/portage/savedconfig/${CATEGORY}/${PF}" \
79 + find "${EROOT%/}/etc/portage/savedconfig/${CATEGORY}/${PF}" \
80 -exec touch {} + 2>/dev/null
81 fi
82 }