Gentoo Archives: gentoo-dev

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

Replies