From 9e783294b662e9258cda2384ac36854a1f6e8cbe Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Jan 17 2023 23:14:09 +0000 Subject: Fix removal of include and dev files The /usr/include directory will not necessarily exist within the buildroot, which will cause a build failure: + echo '=== REMOVE include and dev files ===' === REMOVE include and dev files === + find /home/mcb30/rpmbuild/BUILDROOT/cross-binutils-2.39-1.fc38.x86_64/usr/include -type f -name '*.h' -delete find: '/home/mcb30/rpmbuild/BUILDROOT/cross-binutils-2.39-1.fc38.x86_64/usr/include': No such file or directory error: Bad exit status from /var/tmp/rpm-tmp.374lVg (%install) Fix by checking for the existence of the directory before attempt to find header files therein. Signed-off-by: Michael Brown --- diff --git a/cross-binutils.spec b/cross-binutils.spec index 9180ee1..c46e8e8 100644 --- a/cross-binutils.spec +++ b/cross-binutils.spec @@ -666,7 +666,9 @@ rm -rf %{buildroot}%{auxbin_prefix}/*/lib/ldscripts rmdir %{buildroot}%{auxbin_prefix}/*/lib || : echo "=== REMOVE include and dev files ===" -find %{buildroot}/usr/include -type f -name "*.h" -delete +if [ -d %{buildroot}/usr/include ]; then + find %{buildroot}/usr/include -type f -name "*.h" -delete +fi rm -rf %{buildroot}/etc/gprofng.rc echo "=== BUILD file lists ==="