root/build-tools/find_klm
Dean Troyer cfe45dadae StarlingX open source release updates
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2018-06-01 07:45:23 -07:00

60 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
for r in $(find $MY_WORKSPACE/*/rpmbuild/RPMS -name '*.rpm'); do
f=$(basename $r)
find $MY_WORKSPACE/export/dist/isolinux/Packages | grep $f >> /dev/null
if [ $? -ne 0 ]; then
continue
fi
n=$(rpm -q --qf='%{NAME}\n' -p $r)
d=$(dirname $r)
# echo "f=$f"
for f in $(rpm -q -p -l $r | grep '[.]ko$' | head -n 1); do
FOUND=0
s=$(rpm -q --info -p $r | grep 'Source RPM :' | awk -F: '{print $2}' | tr -d '[[:space:]]')
NAME=$(rpm -q --qf='%{NAME}\n' -p $d/$s)
# echo "NAME=$NAME"
for s2 in $(find $MY_WORKSPACE/*/rpmbuild/SRPMS -name "$NAME-[0-9]*.src.rpm"); do
NAME2=$(rpm -q --qf='%{NAME}\n' -p $s2)
# echo "NAME2=$NAME2"
if [ "${NAME}" == "${NAME2}" ]; then
echo $NAME | grep '[-]rt' >> /dev/null
if [ $? -ne 0 ]; then
echo $NAME
FOUND=1
break
fi
# SIMPLE_NAME=$(echo $NAME | sed 's#-kmod##' | sed 's#-kernel##' | sed 's#^kernel$#linux#' | sed 's#^kernel-rt$#linux-rt#')
SIMPLE_NAME=$(echo $NAME | sed 's#^kernel$#linux#' | sed 's#^kernel-rt$#linux-rt#')
# echo "SIMPLE_NAME=$SIMPLE_NAME"
grep "[/]$SIMPLE_NAME$" $(for g in $(find $MY_REPO -type d -name .git); do d=$(dirname $g); find $d -name 'centos_pkg_dirs*'; done) >> /dev/null
if [ $? -eq 0 ]; then
echo $NAME
FOUND=1
break
fi
SIMPLE_NAME=$(echo $NAME | sed 's#-rt$##' )
# echo "SIMPLE_NAME=$SIMPLE_NAME"
grep "[/]$SIMPLE_NAME$" $(for g in $(find $MY_REPO -type d -name .git); do d=$(dirname $g); find $d -name 'centos_pkg_dirs*'; done) >> /dev/null
if [ $? -eq 0 ]; then
echo $SIMPLE_NAME
FOUND=1
break
fi
SIMPLE_NAME2=$(echo $SIMPLE_NAME | sed 's#-kmod##' )
# echo "SIMPLE_NAME2=$SIMPLE_NAME2"
grep "[/-]$SIMPLE_NAME2$" $(for g in $(find $MY_REPO -type d -name .git); do d=$(dirname $g); find $d -name 'centos_pkg_dirs*'; done) >> /dev/null
if [ $? -eq 0 ]; then
echo $SIMPLE_NAME
FOUND=1
break
fi
fi
done
if [ $FOUND -eq 1 ]; then
break
fi
done
# done
done | sort --unique