scripts: gen-dependencies.sh: fix kmod dependency generation

Do not output faulty ".ko" dependency if a scanned .ko file has an empty
"depends=" specification, also replace the `grep | sed | awk` chain with a
single sed program.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 44206
This commit is contained in:
Jo-Philipp Wich 2015-01-29 21:59:10 +00:00
parent 46b1577bfc
commit 2e5411518f

View file

@ -28,8 +28,6 @@ tmp=`mktemp $TMP_DIR/dep.XXXXXXXX`
for kmod in `find $TARGETS -type f -name \*.ko`; do for kmod in `find $TARGETS -type f -name \*.ko`; do
$OBJCOPY -O binary -j .modinfo $kmod $tmp $OBJCOPY -O binary -j .modinfo $kmod $tmp
sed -e 's,\x00,\n,g' $tmp | \ sed -e 's,\x00,\n,g' $tmp | \
egrep -a '^depends=' | \ sed -ne '/^depends=.\+/ { s/^depends=//; s/\(,\|$\)/.ko\n/gp; q }'
sed -e 's,^depends=,,' -e 's/,/\n/g' | \
awk '{ print $1 ".ko" }'
done | sort -u done | sort -u
rm -f $tmp rm -f $tmp