1
0
mirror of git://projects.qi-hardware.com/kicad-libs.git synced 2024-11-22 13:50:37 +02:00

scripts/missing-in-tree: new option "-x lib" to exclude libraries

This commit is contained in:
Werner Almesberger 2014-01-05 13:49:06 -03:00
parent 2497d96cd3
commit d00f04ffa3

View File

@ -13,15 +13,22 @@
usage() usage()
{ {
echo "usage: $0 [-F] [-L libdir ...] [-l lib ...] hierarchy" 1>&2 echo "usage: $0 [-F] [-x lib ...] [-L libdir ...] [-l lib ...] hierarchy" 1>&2
echo " $0 -Q [-L libdir ...] [-l lib ...] project.pro" 1>&2 echo " $0 -Q [-x lib ...] [-L libdir ...] [-l lib ...] project.pro" 1>&2
exit 1 exit 1
} }
excluded()
{
[ "`eval echo \\\$exclude_\`sanitize \"$1\"\``" ]
}
scan_comp() scan_comp()
{ {
for n in "$@"; do for n in "$@"; do
excluded "$n" && continue
sed '/^DEF ~\?/{s///;s/ .*//;p;};d' <$n >>_tmp2 sed '/^DEF ~\?/{s///;s/ .*//;p;};d' <$n >>_tmp2
done done
} }
@ -30,6 +37,7 @@ scan_comp()
scan_fped() scan_fped()
{ {
for n in "$@"; do for n in "$@"; do
excluded "$n" && continue
fped -k $n - | sed '/^\$MODULE /s///p;d' >>_tmp2 fped -k $n - | sed '/^\$MODULE /s///p;d' >>_tmp2
done done
} }
@ -42,6 +50,13 @@ scan_pro()
done done
} }
sanitize()
{
basename "$1" .$ext | tr -d '\n' | tr -c 'A-Za-z0-9_[-]' _
}
trap "rm -f _tmp1 _tmp2" 0 trap "rm -f _tmp1 _tmp2" 0
if [ "$1" = -Q ]; then if [ "$1" = -Q ]; then
@ -72,6 +87,8 @@ while [ "$1" ]; do
else else
scan_fped "$1" scan_fped "$1"
fi;; fi;;
-x) shift
eval exclude_`sanitize "$1"`=y;;
-*) usage;; -*) usage;;
*) break;; *) break;;
esac esac