forked from OpenModelica/OMLibraries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check-uses.sh
executable file
·29 lines (26 loc) · 863 Bytes
/
check-uses.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh
if test $# -ne 2 || ! test -f "$2"; then
echo "Usage: $0 build/dir path/file.uses"
exit 1
fi
# Check that all used libraries exist and create a nice debified depends list
BUILD="$1"
DEPS=`echo $2 | sed s/uses/depends/`
rm -f "$DEPS"
for l in `cat "$2" | sed "s/ /%20/g"`; do
LIB=`echo $l | sed "s/%20/ /g"`
if echo "$LIB" | grep -q "^deb:"; then # Raw package name
echo "$LIB" | sed "s/^deb://" >> $DEPS
elif test -f "$BUILD/$LIB.license"; then
./debian-name.sh `echo "$LIB"` >> $DEPS
elif test -f "$BUILD/$LIB.provided"; then
./debian-name.sh `cat "$BUILD/$LIB.provided"` >> $DEPS
else
echo "Could not find library $LIB, used by $2"
exit 1
fi
done
# Remove self-reference
LIB=`echo $DEPS | grep -o "[^/]*$" | sed s/.depends//`
THIS_NAME=`./debian-name.sh $LIB`
test ! -f "$DEPS" || sed -i "/$THIS_NAME/d" "$DEPS"