commit:     55054c304dbdfbdce6cfa5555fa26bfd0066a1df
Author:     Matt Whitlock <gentoo <AT> mattwhitlock <DOT> name>
AuthorDate: Thu Oct 27 12:53:05 2022 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Sun Nov  6 02:57:51 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=55054c30

sys-libs/ncurses: don't populate /etc/terminfo/ when USE="-split-usr"

The rationale for moving the terminfo files for some common terminals
into /etc/terminfo/ was stated in bug #37026: "ncurses, unlike termcap,
stores its terminfo database in '/usr/share'... which may not be
available until all file systems are mounted." With merged-/usr this is
no longer a concern, and, moreover, moving some terminfo files out into
/etc undermines a core motivation of merged-/usr, which is to situate a
complete system image within /usr.

This commit preserves the existing behavior when USE="split-usr" but
eliminates the move of common terminfo files into /etc/terminfo/ when
USE="-split-usr".

Signed-off-by: Matt Whitlock <gentoo <AT> mattwhitlock.name>
Closes: https://github.com/gentoo/gentoo/pull/27988
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 sys-libs/ncurses/ncurses-6.3_p20220924-r1.ebuild | 47 ++++++++++++++----------
 sys-libs/ncurses/ncurses-6.3_p20220924.ebuild    | 47 ++++++++++++++----------
 2 files changed, 54 insertions(+), 40 deletions(-)

diff --git a/sys-libs/ncurses/ncurses-6.3_p20220924-r1.ebuild 
b/sys-libs/ncurses/ncurses-6.3_p20220924-r1.ebuild
index f9e5093a7eb1..d7f85fe0f003 100644
--- a/sys-libs/ncurses/ncurses-6.3_p20220924-r1.ebuild
+++ b/sys-libs/ncurses/ncurses-6.3_p20220924-r1.ebuild
@@ -415,8 +415,6 @@ multilib_src_install() {
 }
 
 multilib_src_install_all() {
-       # We need the basic terminfo files in /etc for embedded/recovery, bug 
#37026
-       einfo "Installing basic terminfo files in /etc..."
        local terms=(
                # Dumb/simple values that show up when using the in-kernel VT.
                ansi console dumb linux
@@ -430,25 +428,34 @@ multilib_src_install_all() {
                screen{,-256color}
                screen.xterm-256color
        )
-       local x
-       for x in "${terms[@]}"; do
-               local termfile=$(find "${ED}"/usr/share/terminfo/ -name "${x}" 
2>/dev/null)
-               local basedir=$(basename "$(dirname "${termfile}")")
-
-               if [[ -n ${termfile} ]] ; then
-                       dodir "/etc/terminfo/${basedir}"
-                       mv "${termfile}" "${ED}/etc/terminfo/${basedir}/" || die
-                       dosym "../../../../etc/terminfo/${basedir}/${x}" \
-                               "/usr/share/terminfo/${basedir}/${x}"
-               fi
-       done
-
-       echo "CONFIG_PROTECT_MASK=\"/etc/terminfo\"" | newenvd - 50ncurses
+       if use split-usr ; then
+               local x
+               # We need the basic terminfo files in /etc for 
embedded/recovery, bug #37026
+               einfo "Installing basic terminfo files in /etc..."
+               for x in "${terms[@]}"; do
+                       local termfile=$(find "${ED}"/usr/share/terminfo/ -name 
"${x}" 2>/dev/null)
+                       local basedir=$(basename "$(dirname "${termfile}")")
+
+                       if [[ -n ${termfile} ]] ; then
+                               dodir "/etc/terminfo/${basedir}"
+                               mv "${termfile}" 
"${ED}/etc/terminfo/${basedir}/" || die
+                               dosym 
"../../../../etc/terminfo/${basedir}/${x}" \
+                                       "/usr/share/terminfo/${basedir}/${x}"
+                       fi
+               done
 
-       use minimal && rm -r "${ED}"/usr/share/terminfo*
-       # Because ncurses5-config --terminfo returns the directory we keep it
-       # bug #245374
-       keepdir /usr/share/terminfo
+               echo "CONFIG_PROTECT_MASK=\"/etc/terminfo\"" | newenvd - 
50ncurses
+
+               use minimal && rm -r "${ED}"/usr/share/terminfo*
+               # Because ncurses5-config --terminfo returns the directory we 
keep it
+               # bug #245374
+               keepdir /usr/share/terminfo
+       elif use minimal ; then
+               # Keep only the basic terminfo files
+               find "${ED}"/usr/share/terminfo/ \
+                       -type f ${terms[*]/#/! -name } -delete , \
+                       -type d -empty -delete || die
+       fi
 
        cd "${S}" || die
        dodoc ANNOUNCE MANIFEST NEWS README* TO-DO doc/*.doc

diff --git a/sys-libs/ncurses/ncurses-6.3_p20220924.ebuild 
b/sys-libs/ncurses/ncurses-6.3_p20220924.ebuild
index 9a7f05e0fcb6..9ff5fd9601d3 100644
--- a/sys-libs/ncurses/ncurses-6.3_p20220924.ebuild
+++ b/sys-libs/ncurses/ncurses-6.3_p20220924.ebuild
@@ -413,8 +413,6 @@ multilib_src_install() {
 }
 
 multilib_src_install_all() {
-       # We need the basic terminfo files in /etc for embedded/recovery, bug 
#37026
-       einfo "Installing basic terminfo files in /etc..."
        local terms=(
                # Dumb/simple values that show up when using the in-kernel VT.
                ansi console dumb linux
@@ -428,25 +426,34 @@ multilib_src_install_all() {
                screen{,-256color}
                screen.xterm-256color
        )
-       local x
-       for x in "${terms[@]}"; do
-               local termfile=$(find "${ED}"/usr/share/terminfo/ -name "${x}" 
2>/dev/null)
-               local basedir=$(basename "$(dirname "${termfile}")")
-
-               if [[ -n ${termfile} ]] ; then
-                       dodir "/etc/terminfo/${basedir}"
-                       mv "${termfile}" "${ED}/etc/terminfo/${basedir}/" || die
-                       dosym "../../../../etc/terminfo/${basedir}/${x}" \
-                               "/usr/share/terminfo/${basedir}/${x}"
-               fi
-       done
-
-       echo "CONFIG_PROTECT_MASK=\"/etc/terminfo\"" | newenvd - 50ncurses
+       if use split-usr ; then
+               local x
+               # We need the basic terminfo files in /etc for 
embedded/recovery, bug #37026
+               einfo "Installing basic terminfo files in /etc..."
+               for x in "${terms[@]}"; do
+                       local termfile=$(find "${ED}"/usr/share/terminfo/ -name 
"${x}" 2>/dev/null)
+                       local basedir=$(basename "$(dirname "${termfile}")")
+
+                       if [[ -n ${termfile} ]] ; then
+                               dodir "/etc/terminfo/${basedir}"
+                               mv "${termfile}" 
"${ED}/etc/terminfo/${basedir}/" || die
+                               dosym 
"../../../../etc/terminfo/${basedir}/${x}" \
+                                       "/usr/share/terminfo/${basedir}/${x}"
+                       fi
+               done
 
-       use minimal && rm -r "${ED}"/usr/share/terminfo*
-       # Because ncurses5-config --terminfo returns the directory we keep it
-       # bug #245374
-       keepdir /usr/share/terminfo
+               echo "CONFIG_PROTECT_MASK=\"/etc/terminfo\"" | newenvd - 
50ncurses
+
+               use minimal && rm -r "${ED}"/usr/share/terminfo*
+               # Because ncurses5-config --terminfo returns the directory we 
keep it
+               # bug #245374
+               keepdir /usr/share/terminfo
+       elif use minimal ; then
+               # Keep only the basic terminfo files
+               find "${ED}"/usr/share/terminfo/ \
+                       -type f ${terms[*]/#/! -name } -delete , \
+                       -type d -empty -delete || die
+       fi
 
        cd "${S}" || die
        dodoc ANNOUNCE MANIFEST NEWS README* TO-DO doc/*.doc

Reply via email to