1
0
mirror of git://projects.qi-hardware.com/kicad-libs.git synced 2024-06-23 22:56:22 +03:00

components/scripts/missing-in-tree: script to list components not in hierarchy

... but in libraries.
This commit is contained in:
Werner Almesberger 2012-04-17 22:18:55 -03:00
parent 03ca12f429
commit f602b3a690

52
scripts/missing-in-tree Executable file
View File

@ -0,0 +1,52 @@
#!/bin/sh -e
#
# missing-in-tree - List components present in libraries but not in the tree
#
# Copyright 2012 by Werner Almesberger
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
usage()
{
echo "usage: $0 [-L libdir ...] [-l lib ...] hierarchy" 1>&2
exit 1
}
scan_lib()
{
for n in "$@"; do
sed '/^DEF ~\?/{s///;s/ .*//;p;};d' <$n >>_tmp2
done
}
trap "rm -f _tmp1 _tmp2" 0
genex -D "$@" >_tmp1 || exit
>_tmp2
while [ "$1" ]; do
case "$1" in
-L) shift
[ "`echo \"$1\"/*.lib`" = "$1/*.lib" ] ||
scan_lib "$1"/*.lib;;
-l) shift
scan_lib "$1";;
-*) usage;;
*) break;;
esac
shift
done
[ "$1" ] || usage
[ -z "$2" ] || usage
cat _tmp1 _tmp1 _tmp2 | sort | uniq -u
exit 0