deptest: Also make sure the toolchain is built in the initialization step. This makes...
[openwrt/svn-archive/archive.git] / scripts / deptest.sh
1 #!/bin/bash
2
3 DIR="$PWD/tmp/deptest"
4 STAMP_DIR_SUCCESS="$DIR/stamp-success"
5 STAMP_DIR_FAILED="$DIR/stamp-failed"
6 BUILD_DIR="$DIR/build"
7 BUILD_DIR_HOST="$DIR/build_host"
8 STAGING_DIR="$DIR/staging"
9 STAGING_DIR_HOST="$DIR/staging_host"
10 STAGING_DIR_HOST_TMPL="$DIR/staging_host_tmpl"
11 LOG_DIR="$DIR/logs"
12
13 mkdir -p "$STAMP_DIR_SUCCESS" "$STAMP_DIR_FAILED" "$BUILD_DIR" "$LOG_DIR"
14
15 die()
16 {
17 echo "$@"
18 exit 1
19 }
20
21 [ -d "$STAGING_DIR_HOST_TMPL" ] || {
22 rm -rf staging_dir/host
23 make tools/install V=99 || die "make tools/install failed, please check"
24 cp -al staging_dir/host "$STAGING_DIR_HOST_TMPL"
25 make toolchain/install V=99 || die "make toolchain/install failed, please check"
26 }
27
28 for pkg in `cat tmp/.packagedeps | grep CONFIG_PACKAGE | grep -v curdir | sed -e 's,.*[/=]\s*,,' | sort -u`; do
29 SELECTED=
30 for conf in `grep CONFIG_PACKAGE tmp/.packagedeps | grep -E "[ /]$pkg\$" | sed -e 's,package-$(\(CONFIG_PACKAGE_.*\)).*,\1,'`; do
31 grep "$conf=" .config > /dev/null && SELECTED=1
32 done
33 STAMP_SUCCESS="$STAMP_DIR_SUCCESS/$pkg"
34 STAMP_FAILED="$STAMP_DIR_FAILED/$pkg"
35 rm -f "$STAMP_FAILED"
36 [ -f "$STAMP_SUCCESS" ] && continue
37 [ -n "$SELECTED" ] || {
38 echo "Package $pkg is not selected"
39 continue
40 }
41 echo "Testing package $pkg..."
42 rm -rf "$STAGING_DIR"
43 mkdir -p "$STAGING_DIR"
44 rm -rf "$STAGING_DIR_HOST"
45 cp -al "$STAGING_DIR_HOST_TMPL" "$STAGING_DIR_HOST"
46 make package/$pkg/compile \
47 BUILD_DIR="$BUILD_DIR" \
48 BUILD_DIR_HOST="$BUILD_DIR_HOST" \
49 STAGING_DIR="$STAGING_DIR" \
50 STAGING_DIR_HOST="$STAGING_DIR_HOST" \
51 V=99 >"$LOG_DIR/$(basename $pkg).log" 2>&1
52 if [ $? -eq 0 ]; then
53 touch "$STAMP_SUCCESS"
54 else
55 touch "$STAMP_FAILED"
56 echo "Building package $pkg failed!"
57 fi
58 done