On Thu, 2019-05-23 at 11:15 -0400, Mike Gilbert wrote: > Avoid assigning these variables in EAPIs where they are already > defined. > Also make them local variables to avoid polluting the global > environment. > > Closes: https://bugs.gentoo.org/685382 > --- > eclass/savedconfig.eclass | 18 ++++++++++-------- > 1 file changed, 10 insertions(+), 8 deletions(-) > > diff --git a/eclass/savedconfig.eclass b/eclass/savedconfig.eclass > index 1e9ac6c80b4d..9bd308685b2d 100644 > --- a/eclass/savedconfig.eclass > +++ b/eclass/savedconfig.eclass > @@ -46,19 +46,20 @@ save_config() { > fi > [[ $# -eq 0 ]] && die "Usage: save_config <files>" > > - # Be lazy in our EAPI compat > - : ${ED:=${D}} > + case ${EAPI:-0} in > + 0|1|2) local ED=${D} > + esac > > local dest="/etc/portage/savedconfig/${CATEGORY}" > if [[ $# -eq 1 && -f $1 ]] ; then > # Just one file, so have the ${PF} be that config file > dodir "${dest}" > - cp "$@" "${ED}/${dest}/${PF}" || die "failed to save > $*" > + cp "$@" "${ED%/}/${dest}/${PF}" || die "failed to save > $*" > else > # A dir, or multiple files, so have the ${PF} be a dir > # with all the saved stuff below it > dodir "${dest}/${PF}" > - treecopy "$@" "${ED}/${dest}/${PF}" || die "failed to > save $*" > + treecopy "$@" "${ED%/}/${dest}/${PF}" || die "failed to > save $*" > fi > > elog "Your configuration for ${CATEGORY}/${PF} has been saved > in " > @@ -99,7 +100,7 @@ restore_config() { > use savedconfig || return > > local found check configfile > - local base=${PORTAGE_CONFIGROOT}/etc/portage/savedconfig > + 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} > @@ -143,10 +144,11 @@ savedconfig_pkg_postinst() { > # are worse :/. > > if use savedconfig ; then > - # Be lazy in our EAPI compat > - : ${EROOT:=${ROOT}} > + case ${EAPI:-0} in > + 0|1|2) local EROOT=${ROOT} > + esac > > - find > "${EROOT}/etc/portage/savedconfig/${CATEGORY}/${PF}" \ > + find > "${EROOT%/}/etc/portage/savedconfig/${CATEGORY}/${PF}" \ > -exec touch {} + 2>/dev/null > fi > }
Given that there are no ebuilds in the tree using this eclass and being in EAPI 0, 1 or 2 ( https://qa-reports.gentoo.org/output/eapi-per-eclass/savedconfig.eclass/ ), wouldn't it make more sense to just whitelist EAPI >= 4 and clean up this backwards compatibility cruft instead?
