public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: /, lib/portage/, lib/portage/package/ebuild/_config/
@ 2022-11-23 23:02 Sam James
  0 siblings, 0 replies; only message in thread
From: Sam James @ 2022-11-23 23:02 UTC (permalink / raw
  To: gentoo-commits

commit:     4c96d13271c40bed28742207699934159aab9a8b
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 21 21:35:22 2018 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Nov 23 23:01:57 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4c96d132

Add support for a distinct SYSROOT location

This location cannot be prefix-aware as we don't currently have any
variable to represent that. Given that this is intended to be used
with crossdev toolchains under /usr/${CHOST}, that should not
matter. Even if that location is nested within a prefixed system, it
does not need to be aware of that as it is not intended for execution.

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

 NEWS                                                  |  4 ++++
 lib/portage/__init__.py                               | 19 +++++++++++++++----
 .../package/ebuild/_config/LocationsManager.py        |  6 +++---
 3 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/NEWS b/NEWS
index 286f96bb2..a0463aa4c 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,10 @@ Features:
 
 * cleanups: Drop long-obsolete Jython compatibility code.
 
+* Add support for a distinct SYSROOT location that is not equal to / or ROOT.
+  This is only expected to be used for cross-bootstrapping a new system from
+  scratch using a crossdev environment under /usr/${CHOST}.
+
 Bug fixes:
 * sync: Clobber repositories using sync-type=git to match rsync behavior. This
   helps with issues where git-synced repositories can become confused

diff --git a/lib/portage/__init__.py b/lib/portage/__init__.py
index a4a2c8865..eb42ec13b 100644
--- a/lib/portage/__init__.py
+++ b/lib/portage/__init__.py
@@ -688,12 +688,23 @@ def create_trees(
 
         if depcachedir is not None:
             clean_env["PORTAGE_DEPCACHEDIR"] = depcachedir
-        settings = config(
+        mysettings = config(
             config_root=None, target_root="/", env=clean_env, sysroot="/", eprefix=None
         )
-        settings.lock()
-        trees._running_eroot = settings["EROOT"]
-        myroots.append((settings["EROOT"], settings))
+        mysettings.lock()
+        trees._running_eroot = mysettings["EROOT"]
+        myroots.append((mysettings["EROOT"], mysettings))
+
+        if settings["SYSROOT"] != "/" and settings["SYSROOT"] != settings["ROOT"]:
+            mysettings = config(
+                config_root=settings["SYSROOT"],
+                target_root=settings["SYSROOT"],
+                env=clean_env,
+                sysroot=settings["SYSROOT"],
+                eprefix="",
+            )
+            mysettings.lock()
+            myroots.append((mysettings["EROOT"], mysettings))
 
     for myroot, mysettings in myroots:
         trees[myroot] = portage.util.LazyItemsDict(trees.get(myroot, {}))

diff --git a/lib/portage/package/ebuild/_config/LocationsManager.py b/lib/portage/package/ebuild/_config/LocationsManager.py
index d65aac609..5c3592f5d 100644
--- a/lib/portage/package/ebuild/_config/LocationsManager.py
+++ b/lib/portage/package/ebuild/_config/LocationsManager.py
@@ -389,13 +389,13 @@ class LocationsManager:
             + os.path.sep
         )
 
-        if self.sysroot != "/" and self.sysroot != self.target_root:
+        if self.sysroot != "/" and self.target_root == "/":
             writemsg(
                 _(
                     "!!! Error: SYSROOT (currently %s) must "
-                    "equal / or ROOT (currently %s).\n"
+                    "be set to / when ROOT is /.\n"
                 )
-                % (self.sysroot, self.target_root),
+                % self.sysroot,
                 noiselevel=-1,
             )
             raise InvalidLocation(self.sysroot)


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-23 23:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-23 23:02 [gentoo-commits] proj/portage:master commit in: /, lib/portage/, lib/portage/package/ebuild/_config/ Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox