add a somewhat hackish script for automatic dependency testing
[openwrt/svn-archive/archive.git] / scripts / deptest.sh
1 DIR="$PWD/tmp/deptest"
2 STAMP_DIR="$DIR/stamp"
3 BUILD_DIR="$DIR/build"
4 STAGING_DIR="$DIR/staging"
5 STAGING_DIR_HOST="$DIR/staging_host"
6 STAGING_DIR_HOST_TMPL="$DIR/staging_host_tmpl"
7 LOG_DIR="$DIR/logs"
8
9 mkdir -p "$STAMP_DIR" "$BUILD_DIR" "$LOG_DIR"
10
11 [ -d "$STAGING_DIR_HOST_TMPL" ] || {
12 rm -rf staging_dir/host
13 make tools/install || {
14 echo "make tools/install failed, please check"
15 exit 1
16 }
17 cp -al staging_dir/host "$STAGING_DIR_HOST_TMPL"
18 }
19
20 for pkg in `cat tmp/.packagedeps | grep CONFIG_PACKAGE | grep -v curdir | sed -e 's,.*[/=]\s*,,' | sort -u`; do
21 SELECTED=
22 for conf in `grep CONFIG_PACKAGE tmp/.packagedeps | grep " $pkg\$" | sed -e 's,package-$(\(CONFIG_PACKAGE_.*\)).*,\1,'`; do
23 grep "$conf=" .config > /dev/null && SELECTED=1
24 done
25 [ -f "$STAMP_DIR/$pkg-done" ] && continue
26 [ -n "$SELECTED" ] || {
27 echo "Package $pkg is not selected"
28 continue
29 }
30 echo "Testing package $pkg..."
31 rm -rf "$STAGING_DIR"
32 mkdir -p "$STAGING_DIR"
33 rm -rf "$STAGING_DIR_HOST"
34 cp -al "$STAGING_DIR_HOST_TMPL" "$STAGING_DIR_HOST"
35 make package/$pkg/compile \
36 BUILD_DIR="$BUILD_DIR" \
37 STAGING_DIR="$STAGING_DIR" \
38 STAGING_DIR_HOST="$STAGING_DIR_HOST" \
39 V=99 >"$LOG_DIR/$(basename $pkg).log" 2>&1 \
40 && touch "$STAMP_DIR/$pkg-done" || {
41 echo "Building package $pkg failed!"
42 }
43 done