commit:     9b3f37c3ec2b4a2cdda92bbb554b7fbca8172885
Author:     Allen-Kristjan Päll <akpall <AT> fst <DOT> ee>
AuthorDate: Wed Dec 18 20:02:59 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Dec 18 22:38:03 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9b3f37c3

dev-build/cmake: update 9999

Improved errant files check and moved it to pkg_pretend

Signed-off-by: Allen-Kristjan Päll <akpall <AT> fst.ee>
Closes: https://github.com/gentoo/gentoo/pull/39774
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-build/cmake/cmake-9999.ebuild | 38 +++++++++++++++++++++++++++-----------
 1 file changed, 27 insertions(+), 11 deletions(-)

diff --git a/dev-build/cmake/cmake-9999.ebuild 
b/dev-build/cmake/cmake-9999.ebuild
index 214e75342d3c..5528e7364aa9 100644
--- a/dev-build/cmake/cmake-9999.ebuild
+++ b/dev-build/cmake/cmake-9999.ebuild
@@ -126,6 +126,33 @@ cmake_src_bootstrap() {
                || die "Bootstrap failed"
 }
 
+pkg_pretend() {
+       if [[ -z ${EPREFIX} ]] ; then
+               local file
+               local errant_files=()
+
+               # See bug #599684 and  bug #753581 (at least)
+               for file in /etc/arch-release /etc/redhat-release 
/etc/debian_version ; do
+                       if [[ -e $file ]]; then
+                               errant_files+=("$file")
+                       fi
+               done
+
+               # If errant files exist
+               if [[ ${#errant_files[@]} -gt 0 ]]; then
+                       eerror "Errant files found!"
+                       eerror "The presence of these files is known to confuse 
CMake's"
+                       eerror "library path logic. Please (re)move these 
files:"
+
+                       for file in "${errant_files[@]}"; do
+                               eerror " mv ${file} ${file}.bak"
+                       done
+
+                       die "Stray files found in /etc/, see above message"
+               fi
+       fi
+}
+
 src_unpack() {
        if [[ ${PV} == 9999 ]] ; then
                git-r3_src_unpack
@@ -278,17 +305,6 @@ src_install() {
 }
 
 pkg_postinst() {
-       if [[ -z ${EPREFIX} ]] ; then
-               local file
-               # See bug #599684 and  bug #753581 (at least)
-               for file in /etc/arch-release /etc/redhat-release 
/etc/debian_version ; do
-                       eerror "Errant ${file} found!"
-                       eerror "The presence of these files is known to confuse 
CMake's"
-                       eerror "library path logic. Please (re)move this file:"
-                       eerror " mv ${file} ${file}.bak"
-               done
-       fi
-
        if use gui; then
                xdg_icon_cache_update
                xdg_desktop_database_update

Reply via email to