From f602b3a6908ed0fc1faa20d1a77e58eba805cbaf Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Tue, 17 Apr 2012 22:18:55 -0300 Subject: [PATCH] components/scripts/missing-in-tree: script to list components not in hierarchy ... but in libraries. --- scripts/missing-in-tree | 52 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 scripts/missing-in-tree diff --git a/scripts/missing-in-tree b/scripts/missing-in-tree new file mode 100755 index 0000000..d074e4b --- /dev/null +++ b/scripts/missing-in-tree @@ -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