1 |
Avoid assigning these variables in EAPIs where they are already defined. |
2 |
Also make them local variables to avoid polluting the global |
3 |
environment. |
4 |
|
5 |
Closes: https://bugs.gentoo.org/685382 |
6 |
--- |
7 |
eclass/savedconfig.eclass | 18 ++++++++++-------- |
8 |
1 file changed, 10 insertions(+), 8 deletions(-) |
9 |
|
10 |
diff --git a/eclass/savedconfig.eclass b/eclass/savedconfig.eclass |
11 |
index 1e9ac6c80b4d..9bd308685b2d 100644 |
12 |
--- a/eclass/savedconfig.eclass |
13 |
+++ b/eclass/savedconfig.eclass |
14 |
@@ -46,19 +46,20 @@ save_config() { |
15 |
fi |
16 |
[[ $# -eq 0 ]] && die "Usage: save_config <files>" |
17 |
|
18 |
- # Be lazy in our EAPI compat |
19 |
- : ${ED:=${D}} |
20 |
+ case ${EAPI:-0} in |
21 |
+ 0|1|2) local ED=${D} |
22 |
+ esac |
23 |
|
24 |
local dest="/etc/portage/savedconfig/${CATEGORY}" |
25 |
if [[ $# -eq 1 && -f $1 ]] ; then |
26 |
# Just one file, so have the ${PF} be that config file |
27 |
dodir "${dest}" |
28 |
- cp "$@" "${ED}/${dest}/${PF}" || die "failed to save $*" |
29 |
+ cp "$@" "${ED%/}/${dest}/${PF}" || die "failed to save $*" |
30 |
else |
31 |
# A dir, or multiple files, so have the ${PF} be a dir |
32 |
# with all the saved stuff below it |
33 |
dodir "${dest}/${PF}" |
34 |
- treecopy "$@" "${ED}/${dest}/${PF}" || die "failed to save $*" |
35 |
+ treecopy "$@" "${ED%/}/${dest}/${PF}" || die "failed to save $*" |
36 |
fi |
37 |
|
38 |
elog "Your configuration for ${CATEGORY}/${PF} has been saved in " |
39 |
@@ -99,7 +100,7 @@ restore_config() { |
40 |
use savedconfig || return |
41 |
|
42 |
local found check configfile |
43 |
- local base=${PORTAGE_CONFIGROOT}/etc/portage/savedconfig |
44 |
+ local base=${PORTAGE_CONFIGROOT%/}/etc/portage/savedconfig |
45 |
for check in {${CATEGORY}/${PF},${CATEGORY}/${P},${CATEGORY}/${PN}}; do |
46 |
configfile=${base}/${CTARGET}/${check} |
47 |
[[ -r ${configfile} ]] || configfile=${base}/${CHOST}/${check} |
48 |
@@ -143,10 +144,11 @@ savedconfig_pkg_postinst() { |
49 |
# are worse :/. |
50 |
|
51 |
if use savedconfig ; then |
52 |
- # Be lazy in our EAPI compat |
53 |
- : ${EROOT:=${ROOT}} |
54 |
+ case ${EAPI:-0} in |
55 |
+ 0|1|2) local EROOT=${ROOT} |
56 |
+ esac |
57 |
|
58 |
- find "${EROOT}/etc/portage/savedconfig/${CATEGORY}/${PF}" \ |
59 |
+ find "${EROOT%/}/etc/portage/savedconfig/${CATEGORY}/${PF}" \ |
60 |
-exec touch {} + 2>/dev/null |
61 |
fi |
62 |
} |
63 |
-- |
64 |
2.21.0 |