commit:     375f4874a752bc30d55e8408621a6e772c4ba9b9
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Jan  2 09:52:15 2026 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Jan  2 09:52:15 2026 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=375f4874

build-sys: ensure CONFIG_PROTECT* vars in make.globals aren't hprefixified

CONFIG_PROTECT stuff needs to be unprefixed, because profiles append to
these, and they cannot know the offset (and are shared/generic for
everyone).  Luckily the default values are provided too by the profiles
at some point, so we never noticed these were set wrong.

Ensure via sed exclusion that we do not prefixify CONFIG_PROTECT vars.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 meson.build      | 10 +++++++---
 subst-install.in |  5 +++--
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/meson.build b/meson.build
index 12cf1f520a..b9796a9520 100644
--- a/meson.build
+++ b/meson.build
@@ -47,14 +47,18 @@ if portage_datadir == ''
                                   : datadir / 'share' / 'portage'
 endif
 
-# hprefixify is copied from prefix.eclass.
+# BEGIN PREFIX_LOCAL
+# hprefixify is copied from prefix.eclass, modified for Prefix to
+# exclude CONFIG_PROTEXT lines (from make.globals)
 dirs = '/(usr|lib(|[onx]?32|n?64)|etc|bin|sbin|var|opt|run)'
+exclude = '/^CONFIG_PROTECT/!'
 hprefixify = [
     sed, '-r',
-    '-e', 's,([^[:alnum:]}\\)\\.])' + dirs + ',\\1' + eprefix.replace(',', 
'\\,') + '/\\2,g',
-    '-e', 's,^' + dirs + ',' + eprefix.replace(',', '\\,') + '/\\1,',
+    '-e', exclude + 's,([^[:alnum:]}\\)\\.])' + dirs + ',\\1' + 
eprefix.replace(',', '\\,') + '/\\2,g',
+    '-e', exclude + 's,^' + dirs + ',' + eprefix.replace(',', '\\,') + '/\\1,',
     '@INPUT@'
 ]
+# END PREFIX_LOCAL
 
 # Use Portage's own code to determine the version from git, if possible.
 version = run_command(

diff --git a/subst-install.in b/subst-install.in
index 2c3297a7ec..7af77d522d 100644
--- a/subst-install.in
+++ b/subst-install.in
@@ -22,9 +22,10 @@ sedexp=(
 if [[ $1 == --hprefixify ]] ; then
        shift
        dirs='/(usr|lib(|[onx]?32|n?64)|etc|bin|sbin|var|opt|run)'
+       exclude='/^CONFIG_PROTECT/!'  # make.globals, don't prefix these
        sedexp+=(
-               -e 's,([^[:alnum:]}\)\.])'"${dirs}"',\1@PORTAGE_EPREFIX@/\2,g'
-               -e 's,^'"${dirs}"',@PORTAGE_EPREFIX@/\1,'
+               -e 
"${exclude}"'s,([^[:alnum:]}\)\.])'"${dirs}"',\1@PORTAGE_EPREFIX@/\2,g'
+               -e "${exclude}"'s,^'"${dirs}"',@PORTAGE_EPREFIX@/\1,'
        )
 fi
 

Reply via email to