public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Arthur Zamarin" <arthurzam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pkgcore/pkgcore:master commit in: src/pkgcore/ebuild/
Date: Tue,  3 Jan 2023 18:06:31 +0000 (UTC)	[thread overview]
Message-ID: <1672689887.36bed5c684f87e1b14bb9ccfbc44937dbfd5198b.arthurzam@gentoo> (raw)

commit:     36bed5c684f87e1b14bb9ccfbc44937dbfd5198b
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  2 20:04:47 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Mon Jan  2 20:04:47 2023 +0000
URL:        https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=36bed5c6

portage_conf: add support for make.profile as directory

Support /etc/portage/make.profile as a directory, and not as symbolic
link. In this state, /etc/portage/profile takes precedence over, and
this is taken as a "normal" profile. We need to make sure that
`load_profile_base` is turned off, as profiles base is irrelevant now.

Resolves: https://github.com/pkgcore/pkgcore/issues/305
Resolves: https://github.com/pkgcore/pkgcheck/issues/426
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 src/pkgcore/ebuild/portage_conf.py | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/pkgcore/ebuild/portage_conf.py b/src/pkgcore/ebuild/portage_conf.py
index 907a1a2dd..815d563d4 100644
--- a/src/pkgcore/ebuild/portage_conf.py
+++ b/src/pkgcore/ebuild/portage_conf.py
@@ -542,13 +542,11 @@ class PortageConfig(DictMixin):
         except FileNotFoundError:
             pass
 
-    def _find_profile_path(self, profile_override):
+    def _find_profile_path(self, profile_override) -> tuple[str, bool]:
         if profile_override is None:
             make_profile = pjoin(self.dir, "make.profile")
             if not os.path.islink(make_profile):
-                raise config_errors.UserConfigError(
-                    f"invalid symlink: {make_profile!r}"
-                )
+                return make_profile, True
             path = os.path.realpath(make_profile)
         else:
             path = os.path.realpath(profile_override)
@@ -560,15 +558,17 @@ class PortageConfig(DictMixin):
                 raise config_errors.UserConfigError(
                     f"nonexistent profile: {profile_override!r}"
                 )
-        return path
+        return path, False
 
     def _add_profile(self, profile_override=None):
-        profile = self._find_profile_path(profile_override)
-        paths = profiles.OnDiskProfile.split_abspath(profile)
+        profile, was_symlink = self._find_profile_path(profile_override)
+        if was_symlink:
+            paths = profile.rsplit(os.path.sep, 1)
+        else:
+            paths = profiles.OnDiskProfile.split_abspath(profile)
         if paths is None:
             raise config_errors.UserConfigError(
-                "%r expands to %r, but no profile detected"
-                % (pjoin(self.dir, "make.profile"), profile)
+                f"{pjoin(self.dir, 'make.profile')!r} expands to {profile!r}, but no profile detected"
             )
 
         user_profile_path = pjoin(self.dir, "profile")
@@ -579,6 +579,7 @@ class PortageConfig(DictMixin):
                     "parent_path": paths[0],
                     "parent_profile": paths[1],
                     "user_path": user_profile_path,
+                    "load_profile_base": not was_symlink,
                 }
             )
         else:
@@ -587,6 +588,7 @@ class PortageConfig(DictMixin):
                     "class": "pkgcore.ebuild.profiles.OnDiskProfile",
                     "basepath": paths[0],
                     "profile": paths[1],
+                    "load_profile_base": not was_symlink,
                 }
             )
 


             reply	other threads:[~2023-01-03 18:06 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-03 18:06 Arthur Zamarin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-06-13 16:40 [gentoo-commits] proj/pkgcore/pkgcore:master commit in: src/pkgcore/ebuild/ Arthur Zamarin
2023-12-26 17:45 Arthur Zamarin
2023-10-23 17:35 Arthur Zamarin
2023-06-30 20:08 Arthur Zamarin
2023-02-04 19:52 Arthur Zamarin
2023-01-17 20:50 Arthur Zamarin
2022-12-26 17:28 Arthur Zamarin
2022-12-26 17:28 Arthur Zamarin
2022-12-26 17:28 Arthur Zamarin
2022-12-26 17:28 Arthur Zamarin
2022-12-26 17:28 Arthur Zamarin
2022-12-26 17:28 Arthur Zamarin
2022-12-25 17:40 Arthur Zamarin
2022-12-22  7:11 Arthur Zamarin
2022-12-22  7:11 Arthur Zamarin
2022-12-22  7:11 Arthur Zamarin
2022-12-22  7:11 Arthur Zamarin
2022-12-22  7:11 Arthur Zamarin
2022-12-13 19:58 Arthur Zamarin
2022-11-26 11:17 Arthur Zamarin
2022-10-29 11:56 Arthur Zamarin
2022-10-16 16:38 Arthur Zamarin
2022-10-04  8:24 Arthur Zamarin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1672689887.36bed5c684f87e1b14bb9ccfbc44937dbfd5198b.arthurzam@gentoo \
    --to=arthurzam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox