3ce4291b31a7de725e8fdc2eebeb14d240ff1d2d
[openwrt.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 [ -d "$STAGING_DIR_HOST_TMPL" ] || {
16 rm -rf staging_dir/host
17 make tools/install V=99 || {
18 echo "make tools/install failed, please check"
19 exit 1
20 }
21 cp -al staging_dir/host "$STAGING_DIR_HOST_TMPL"
22 }
23
24 for pkg in `cat tmp/.packagedeps | grep CONFIG_PACKAGE | grep -v curdir | sed -e 's,.*[/=]\s*,,' | sort -u`; do
25 SELECTED=
26 for conf in `grep CONFIG_PACKAGE tmp/.packagedeps | grep -E "[ /]$pkg\$" | sed -e 's,package-$(\(CONFIG_PACKAGE_.*\)).*,\1,'`; do
27 grep "$conf=" .config > /dev/null && SELECTED=1
28 done
29 STAMP_SUCCESS="$STAMP_DIR_SUCCESS/$pkg"
30 STAMP_FAILED="$STAMP_DIR_FAILED/$pkg"
31 rm -f "$STAMP_FAILED"
32 [ -f "$STAMP_SUCCESS" ] && continue
33 [ -n "$SELECTED" ] || {
34 echo "Package $pkg is not selected"
35 continue
36 }
37 echo "Testing package $pkg..."
38 rm -rf "$STAGING_DIR"
39 mkdir -p "$STAGING_DIR"
40 rm -rf "$STAGING_DIR_HOST"
41 cp -al "$STAGING_DIR_HOST_TMPL" "$STAGING_DIR_HOST"
42 make package/$pkg/compile \
43 BUILD_DIR="$BUILD_DIR" \
44 BUILD_DIR_HOST="$BUILD_DIR_HOST" \
45 STAGING_DIR="$STAGING_DIR" \
46 STAGING_DIR_HOST="$STAGING_DIR_HOST" \
47 V=99 >"$LOG_DIR/$(basename $pkg).log" 2>&1
48 if [ $? -eq 0 ]; then
49 touch "$STAMP_SUCCESS"
50 else
51 touch "$STAMP_FAILED"
52 echo "Building package $pkg failed!"
53 fi
54 done
This page took 0.047272 seconds and 3 git commands to generate.