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