blob: f944be9e6307818382137c09e929e7445fcea5d0 [file] [log] [blame]
# Strict multilib directory checks
multilib_strict_check() {
if has multilib-strict ${FEATURES} && \
[[ -x /usr/bin/file && -x /usr/bin/find ]] && \
[[ -n ${MULTILIB_STRICT_DIRS} && -n ${MULTILIB_STRICT_DENY} ]]
then
rm -f "${T}/multilib-strict.log"
local abort=no dir file
MULTILIB_STRICT_EXEMPT=$(echo ${MULTILIB_STRICT_EXEMPT} | sed -e 's:\([(|)]\):\\\1:g')
for dir in ${MULTILIB_STRICT_DIRS} ; do
[[ -d ${ED}/${dir} ]] || continue
for file in $(find ${ED}/${dir} -type f | grep -v "^${ED}/${dir}/${MULTILIB_STRICT_EXEMPT}"); do
if file ${file} | egrep -q "${MULTILIB_STRICT_DENY}" ; then
echo "${file#${ED}//}" >> "${T}/multilib-strict.log"
fi
done
done
if [[ -s ${T}/multilib-strict.log ]] ; then
if [[ ${#QA_MULTILIB_PATHS[@]} -eq 1 ]] ; then
local shopts=$-
set -o noglob
QA_MULTILIB_PATHS=(${QA_MULTILIB_PATHS})
set +o noglob
set -${shopts}
fi
if [ "${QA_STRICT_MULTILIB_PATHS-unset}" = unset ] ; then
local x
for x in "${QA_MULTILIB_PATHS[@]}" ; do
sed -e "s#^${x#/}\$##" -i "${T}/multilib-strict.log"
done
sed -e "/^\$/d" -i "${T}/multilib-strict.log"
fi
if [[ -s ${T}/multilib-strict.log ]] ; then
abort=yes
echo "Files matching a file type that is not allowed:"
while read -r ; do
echo " ${REPLY}"
done < "${T}/multilib-strict.log"
fi
fi
[[ ${abort} == yes ]] && die "multilib-strict check failed!"
fi
}
multilib_strict_check
: # guarantee successful exit
# vim:ft=sh