commit:     c726594cfd5326e6282a322098be5d3660cb9d11
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 15 21:40:04 2023 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Tue Aug 15 21:40:04 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c726594c

sys-apps/portage: Don't run _compat_upgrade when ROOT!=/

Even if you point to the right config directory with PORTAGE_CONFIGROOT, these
still load the default config files from /usr/share/portage rather than
${ROOT}/usr/share/portage and therefore do the wrong thing.

portage._compat_upgrade.default_locations also cannot tell what ROOT's
directories will look like later, so we should not take action based on these.

Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 sys-apps/portage/portage-3.0.50.ebuild | 2 +-
 sys-apps/portage/portage-9999.ebuild   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-apps/portage/portage-3.0.50.ebuild 
b/sys-apps/portage/portage-3.0.50.ebuild
index 91d945df8187..08cbf145abb2 100644
--- a/sys-apps/portage/portage-3.0.50.ebuild
+++ b/sys-apps/portage/portage-3.0.50.ebuild
@@ -177,7 +177,7 @@ src_test() {
 }
 
 pkg_preinst() {
-       if ! use build; then
+       if ! use build && [[ -z ${ROOT} ]]; then
                python_setup
                local sitedir=$(python_get_sitedir)
                [[ -d ${D}${sitedir} ]] || die "${D}${sitedir}: No such 
directory"

diff --git a/sys-apps/portage/portage-9999.ebuild 
b/sys-apps/portage/portage-9999.ebuild
index 91d945df8187..08cbf145abb2 100644
--- a/sys-apps/portage/portage-9999.ebuild
+++ b/sys-apps/portage/portage-9999.ebuild
@@ -177,7 +177,7 @@ src_test() {
 }
 
 pkg_preinst() {
-       if ! use build; then
+       if ! use build && [[ -z ${ROOT} ]]; then
                python_setup
                local sitedir=$(python_get_sitedir)
                [[ -d ${D}${sitedir} ]] || die "${D}${sitedir}: No such 
directory"

Reply via email to