File 01-check-file-architectures-of-rpms of Package cross-aaa_base

#!/bin/bash
#
# search for binaries with the host architecure instead of target
#
host=`su $BUILD_USER -c "rpm -E %{_build}"`
target=`su $BUILD_USER -c "rpm -E %{_host}"`

host=${host%%-*}
target=${target%%-*}

[ "$host" = "$target" ] && exit 0

host="${host/_/-}"

echo "... checking rpms for host architecture binaries"
TOPDIR=/usr/src/packages
test -d $BUILD_ROOT/.build.packages && TOPDIR=/.build.packages
RPM_FILE_LIST=(`find $BUILD_ROOT$TOPDIR/RPMS -type f -name "*.rpm" | grep -v -- -debuginfo | grep -v -- -debugsource`)
chroot $BUILD_ROOT rpm -qp --fileclass ${RPM_FILE_LIST[*]#$BUILD_ROOT} | grep ", $host," && {
    echo 'Package contains binaries of host architecture'
    test -n "$BUILD_ROOT" && touch $BUILD_ROOT/not-ready
    exit 1
}

exit 0

openSUSE Build Service is sponsored by