blob: c2eeaed780ba927a4b4401dde297c6ddf1df09d1 (
plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
#! /usr/bin/env bash
shopt -s nullglob
PLATFORM=`lsb_release -is`
TMPFILE1=`mktemp --tmpdir depA.XXXXXX` || exit 1
TMPFILE2=`mktemp --tmpdir depB.XXXXXX` || exit 2
TMPFILE3=`mktemp --tmpdir depB.XXXXXX` || exit 3
cleanup() {
rm -f $TMPFILE1
rm -f $TMPFILE2
rm -f $TMPFILE3
}
trap cleanup INT EXIT
# find all the .deps directories
DEPDIRS=`find . -name ".deps" -print`
if [ -z "$DEPDIRS" ] ; then
echo "No depdirs found. Ceph must be built before running dependency check"
fi
# find all the headers
echo "Looking for headers ... " >&2
for DIR in $DEPDIRS
do
for file in $DIR/*.Po $DIR/*.Plo
do
#echo "$DIR: $file" >&2
cut -d: -f1 $file | grep "^/" >> $TMPFILE1
done
done
# Add in required libraries
echo "Looking for libraries ... " >&2
LIB_PATHS="/lib64 /usr/lib64 /lib /usr/lib"
FIND=`which find`
autoconf --trace AC_CHECK_LIB | cut -d: -f4 | while read LIB
do
for PATH in $LIB_PATHS
do
$FIND $PATH -name "lib$LIB.so*" -print 2> /dev/null >> $TMPFILE1
done
done
autoconf --trace AC_SEARCH_LIBS | cut -d: -f5 | while read LIBLIST
do
for LIB in $LIBLIST ; do
for PATH in $LIB_PATHS ; do
$FIND $PATH -name "lib$LIB.so*" -print 2> /dev/null >> $TMPFILE1
done
done
done
autoconf --trace PKG_CHECK_MODULES | cut -d: -f5 | cut -d' ' -f1 | while read PKG
do
LIBLIST=`pkg-config --libs $PKG 2> /dev/null`
for LIB in $LIBLIST ; do
LIB=${LIB#-l}
for PATH in $LIB_PATHS
do
$FIND $PATH -name "lib$LIB.so*" -print 2> /dev/null >> $TMPFILE1
done
done
done
# path to package
echo "Looking up packages for hdr and lib paths ... " >&2
sort $TMPFILE1 | uniq > $TMPFILE2
rm $TMPFILE1
cat $TMPFILE2 | while read LINE
do
package=`rpm -q --whatprovides $LINE`
echo $package >> $TMPFILE1
done
# Add in any libraries needed for the devel packages
echo "Adding libraries for devel packages ... " >&2
sort $TMPFILE1 | uniq > $TMPFILE3
cat $TMPFILE3 | grep devel | while read PACKAGE
do
NAME=`rpm -q --qf %{NAME} $PACKAGE`
NAME=${NAME%-devel}
#echo "looking for matching $NAME ... " >&2
LPACKAGE=`rpm -q $NAME 2> /dev/null`
if [ $? -eq 0 ] ; then
#echo "Found $LPACKAGE ... " >&2
echo $LPACKAGE >> $TMPFILE1
else
LPACKAGE=`rpm -q $NAME-libs 2> /dev/null`
if [ $? -eq 0 ] ; then
#echo "Found $LPACKAGE ... " >&2
echo $LPACKAGE >> $TMPFILE1
fi
fi
done
echo "Checking licenses ... " >&2
# Read package list and generate report
sort $TMPFILE1 | uniq > $TMPFILE2
rm $TMPFILE1
echo -e "\nPackage Dependencies:\n"
cat $TMPFILE2 | while read PACKAGE
do
LICENSE=`rpm -q --qf %{LICENSE} $PACKAGE`
NAME=`rpm -q --qf %{NAME} $PACKAGE`
echo "${PACKAGE}.rpm"
echo " Name: $NAME"
echo " License: $LICENSE"
done
echo -e "\nSource Code Dependencies:\n"
echo "src/leveldb"
echo " Name: leveldb"
echo " License: Google Public License"
echo "Done"
#echo "DEPDIRS: $DEPDIRS"
|