source: npl/findbuilddeps @ a2d969e

perl-5.22
Last change on this file since a2d969e was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100755
File size: 1.5 KB
Line 
1#!/bin/bash
2
3if ! [ "$1" ]; then
4    echo "$0 packagename of buildscript path"
5    echo "Bepaald recursief alle build dependencies van de meegeven pacakage. Dus alle NEEDs en DEPs"
6    exit 1
7fi
8
9cd `dirname $0` || exit 1
10
11export BUILDDEPS=""
12
13getdeps()
14{
15    if ! [ -f $1 ]; then
16        BUILDSCRIPT=`./findbuild $1`.SlackBuild || exit 1
17    else
18        BUILDSCRIPT=$1
19    fi
20
21    DEPS="`cat "$BUILDSCRIPT"|egrep '^#DEP:'|cut -f2 -d':'`" || exit 1
22    for DEP in $DEPS; do
23        if ! echo "$BUILDDEPS" | grep " $DEP " >/dev/null; then
24            BUILDDEPS="$BUILDDEPS $DEP "
25            #recurse
26            getdeps $DEP || exit 1
27        fi
28    done
29}
30
31
32if ! [ -f $1 ]; then
33    BUILDSCRIPT=`./findbuild $1`.SlackBuild || exit 1
34else
35    BUILDSCRIPT=$1
36fi
37
38#toplevel needs
39BUILDDEPS="$BUILDDEPS `cat "$BUILDSCRIPT"|egrep '^#NEED:'|cut -f2 -d':'| tr '\n' ' '`" || exit 1
40
41#toplevel deps
42BUILDDEPS="$BUILDDEPS `cat "$BUILDSCRIPT"|egrep '^#DEP:'|cut -f2 -d':'| tr '\n' ' '`"  || exit 1
43
44#toplevel deps_dev, if they exists
45DEVS="`cat "$BUILDSCRIPT"|egrep '^#DEP:'|cut -f2 -d':'| sed 's/$/_dev/g'| tr '\n' ' '`" || exit 1
46for DEV in $DEVS; do
47    if ./findbuild $DEV 2>/dev/null >/dev/null ; then
48        BUILDDEPS="$BUILDDEPS $DEV" || exit 1
49    fi
50done
51
52#determine sub-deps recursively, because those usually are runtime dependencies as well
53DEPS="`cat "$BUILDSCRIPT"|egrep '(^#DEP:|^#NEED)'|cut -f2 -d':'`" || exit 1
54for DEP in $DEPS; do
55    getdeps $DEP || exit 1
56done
57
58#output
59for DEP in $BUILDDEPS; do
60    echo $DEP
61done
Note: See TracBrowser for help on using the repository browser.