commit:     06d123dd5bbe32bcb3c9b1df65344acc870201cb
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Dec  3 09:48:01 2023 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Dec  3 09:48:01 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=06d123dd

subst-install: use hprefixify heuristic like meson

Now @PORTAGE_EPREFIX@ is not used for most places, ensure we still get
replacement done for Prefix.

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

 subst-install.in | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/subst-install.in b/subst-install.in
index 332b77b656..d65db48042 100644
--- a/subst-install.in
+++ b/subst-install.in
@@ -19,7 +19,9 @@ portageuser=${portageuser//\\/\\\\\\\\}
 # there are many ways to do this all dynamic, but we only care for raw
 # speed here, so let configure fill in this list and be done with it
 at='@'
+dirs='/(usr|lib(|[onx]?32|n?64)|etc|bin|sbin|var|opt|run)'
 sedexp=(
+       -r
        -e "s,${at}EXTRA_PATH${at},@EXTRA_PATH@,g"
        -e "s,${at}PORTAGE_BASE${at},@PORTAGE_BASE@,g"
        -e "s,${at}PORTAGE_BASE_PATH${at},@PORTAGE_BASE@,g"
@@ -34,7 +36,8 @@ sedexp=(
        -e "s,${at}rootuid${at},@rootuid@,g"
        -e "s,${at}rootuser${at},${rootuser},g"
        -e "s,${at}sysconfdir${at},@sysconfdir@,g"
-       -e "1s,/usr/bin/env ,@PORTAGE_EPREFIX@/usr/bin/,"
+       -e 's,([^[:alnum:]}\\)\\.])'"${dirs}"',\\1@PORTAGE_EPREFIX@/\\2,g'
+       -e 's,^'"${dirs}"',@PORTAGE_EPREFIX@/\\1,'
 )
 
 sources=( )

Reply via email to