Root/scripts/missing-in-tree

Source at commit 8f80a595d8d0bc4f7aea60978b1d09384472b0c3 created 7 years 4 months ago.
By Werner Almesberger, scripts/missing-in-tree: fix -L dir; clean up use of extension
1#!/bin/sh -e
2#
3# missing-in-tree - List items present in libraries but not in the tree
4#
5# Copyright 2012 by Werner Almesberger
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12
13
14usage()
15{
16    echo "usage: $0 [-F] [-L libdir ...] [-l lib ...] hierarchy" 1>&2
17    exit 1
18}
19
20
21scan_comp()
22{
23    for n in "$@"; do
24        sed '/^DEF ~\?/{s///;s/ .*//;p;};d' <$n >>_tmp2
25    done
26}
27
28
29scan_fped()
30{
31    for n in "$@"; do
32        fped -k $n - | sed '/^\$MODULE /s///p;d' >>_tmp2
33    done
34}
35
36
37trap "rm -f _tmp1 _tmp2" 0
38
39genkicat -D "$@" >_tmp1 || exit
40
41ext=lib
42
43>_tmp2
44while [ "$1" ]; do
45    case "$1" in
46    -F) ext=fpd;;
47    -L) shift
48        if [ "`echo \"$1\"/*.$ext`" != "$1/*.$ext" ]; then
49            if [ $ext = lib ]; then
50                scan_comp "$1"/*.$ext
51            else
52                scan_fped "$1"/*.$ext
53            fi
54        fi;;
55    -l) shift
56        if [ $ext = lib ]; then
57            scan_comp "$1"
58        else
59            scan_fped "$1"
60        fi;;
61    -*) usage;;
62    *) break;;
63    esac
64    shift
65done
66
67[ "$1" ] || usage
68[ -z "$2" ] || usage
69
70cat _tmp1 _tmp1 _tmp2 | sort | uniq -u
71
72exit 0
73

Archive Download this file

Branches:
master



interactive