commit:     3062f2ce92ef51f40385300dc9d3a3ec176bb9c6
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Nov  3 00:53:29 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Nov  3 00:54:12 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3062f2ce

sys-libs/glibc: only copy crypt.h if it exists

Some folks may have rather strict INSTALL_MASKs and such
and don't need headers, so if they don't have it already,
go with it.

Bug: https://bugs.gentoo.org/802207
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.33-r7.ebuild | 15 +++++++++++++--
 sys-libs/glibc/glibc-2.34.ebuild    | 16 ++++++++++++++--
 sys-libs/glibc/glibc-9999.ebuild    | 15 +++++++++++++--
 3 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.33-r7.ebuild 
b/sys-libs/glibc/glibc-2.33-r7.ebuild
index dbea0d35d4d..146cce876a7 100644
--- a/sys-libs/glibc/glibc-2.33-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r7.ebuild
@@ -1506,7 +1506,12 @@ pkg_preinst() {
        if ! use crypt && has_version "${CATEGORY}/${PN}[crypt]"; then
                PRESERVED_OLD_LIBCRYPT=1
                preserve_old_lib /$(get_libdir)/libcrypt$(get_libname 1)
-               cp "${EROOT}"/usr/include/crypt.h "${T}"/crypt.h || die
+
+               # Only copy if it exists; some people may have tiny embedded
+               # systems without headers: https://bugs.gentoo.org/802207#c16.
+               if [[ -f "${EROOT}"/usr/include/crypt.h ]] ; then
+                       cp "${EROOT}"/usr/include/crypt.h "${T}"/crypt.h || die
+               fi
        else
                PRESERVED_OLD_LIBCRYPT=0
        fi
@@ -1542,7 +1547,13 @@ pkg_postinst() {
 
        if [[ ${PRESERVED_OLD_LIBCRYPT} -eq 1 ]] ; then
                preserve_old_lib_notify /$(get_libdir)/libcrypt$(get_libname 1)
-               cp "${T}"/crypt.h "${EROOT}"/usr/include/crypt.h || eerror 
"Error restoring crypt.h, please file a bug"
+
+               # Only copy if it exists; some people may have tiny embedded
+               # systems without headers: https://bugs.gentoo.org/802207#c16
+               if [[ -f "${T}"/crypt.h ]] ; then
+                       cp "${T}"/crypt.h "${EROOT}"/usr/include/crypt.h || 
eerror "Error restoring crypt.h, please file a bug"
+               fi
+
                elog "Please ignore a possible later error message about a file 
collision involving"
                elog "/usr/include/crypt.h. We need to preserve this file for 
the moment to keep"
                elog "the upgrade working, but it also needs to be overwritten 
when"

diff --git a/sys-libs/glibc/glibc-2.34.ebuild b/sys-libs/glibc/glibc-2.34.ebuild
index 0a5f70fd284..f292dc31fc3 100644
--- a/sys-libs/glibc/glibc-2.34.ebuild
+++ b/sys-libs/glibc/glibc-2.34.ebuild
@@ -1519,7 +1519,13 @@ pkg_preinst() {
        if ! use crypt && has_version "${CATEGORY}/${PN}[crypt]"; then
                PRESERVED_OLD_LIBCRYPT=1
                preserve_old_lib /$(get_libdir)/libcrypt$(get_libname 1)
-               cp "${EROOT}"/usr/include/crypt.h "${T}"/crypt.h || die
+
+               # Only copy if it exists; some people may have tiny embedded
+               # systems without headers: https://bugs.gentoo.org/802207#c16
+               if [[ -f "${EROOT}"/usr/include/crypt.h ]] ; then
+                       cp "${EROOT}"/usr/include/crypt.h "${T}"/crypt.h || die
+               fi
+
        else
                PRESERVED_OLD_LIBCRYPT=0
        fi
@@ -1555,7 +1561,13 @@ pkg_postinst() {
 
        if [[ ${PRESERVED_OLD_LIBCRYPT} -eq 1 ]] ; then
                preserve_old_lib_notify /$(get_libdir)/libcrypt$(get_libname 1)
-               cp "${T}"/crypt.h "${EROOT}"/usr/include/crypt.h || eerror 
"Error restoring crypt.h, please file a bug"
+
+               # Only copy if it exists; some people may have tiny embedded
+               # systems without headers: https://bugs.gentoo.org/802207#c16
+               if [[ -f "${T}"/crypt.h ]] ; then
+                       cp "${T}"/crypt.h "${EROOT}"/usr/include/crypt.h || 
eerror "Error restoring crypt.h, please file a bug"
+               fi
+
                elog "Please ignore a possible later error message about a file 
collision involving"
                elog "/usr/include/crypt.h. We need to preserve this file for 
the moment to keep"
                elog "the upgrade working, but it also needs to be overwritten 
when"

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 7be3669c52a..ce817f25421 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1519,7 +1519,12 @@ pkg_preinst() {
        if ! use crypt && has_version "${CATEGORY}/${PN}[crypt]"; then
                PRESERVED_OLD_LIBCRYPT=1
                preserve_old_lib /$(get_libdir)/libcrypt$(get_libname 1)
-               cp "${EROOT}"/usr/include/crypt.h "${T}"/crypt.h || die
+
+               # Only copy if it exists; some people may have tiny embedded
+               # systems without headers: https://bugs.gentoo.org/802207#c16
+               if [[ -f "${EROOT}"/usr/include/crypt.h ]] ; then
+                       cp "${EROOT}"/usr/include/crypt.h "${T}"/crypt.h || die
+               fi
        else
                PRESERVED_OLD_LIBCRYPT=0
        fi
@@ -1555,7 +1560,13 @@ pkg_postinst() {
 
        if [[ ${PRESERVED_OLD_LIBCRYPT} -eq 1 ]] ; then
                preserve_old_lib_notify /$(get_libdir)/libcrypt$(get_libname 1)
-               cp "${T}"/crypt.h "${EROOT}"/usr/include/crypt.h || eerror 
"Error restoring crypt.h, please file a bug"
+
+               # Only copy if it exists; some people may have tiny embedded
+               # systems without headers: https://bugs.gentoo.org/802207#c16
+               if [[ -f "${T}"/crypt.h ]] ; then
+                       cp "${T}"/crypt.h "${EROOT}"/usr/include/crypt.h || 
eerror "Error restoring crypt.h, please file a bug"
+               fi
+
                elog "Please ignore a possible later error message about a file 
collision involving"
                elog "/usr/include/crypt.h. We need to preserve this file for 
the moment to keep"
                elog "the upgrade working, but it also needs to be overwritten 
when"

Reply via email to