3 # Automated OpenWrt package dependency checker
5 # Copyright (C) 2009-2010 OpenWrt.org
7 # This is free software, licensed under the GNU General Public License v2.
8 # See /LICENSE for more information.
11 SCRIPTDIR
="$(dirname "$0")"
12 [ "${SCRIPTDIR:0:1}" = "/" ] || SCRIPTDIR
="$PWD/$SCRIPTDIR"
13 BASEDIR
="$SCRIPTDIR/.."
15 DIR
="$BASEDIR/tmp/deptest"
16 STAMP_DIR_SUCCESS
="$DIR/stamp-success"
17 STAMP_DIR_FAILED
="$DIR/stamp-failed"
18 STAMP_DIR_BLACKLIST
="$DIR/stamp-blacklist"
19 BUILD_DIR
="$DIR/build_dir/target"
20 BUILD_DIR_HOST
="$DIR/build_dir/host"
21 STAGING_DIR
="$DIR/staging_dir"
22 STAGING_DIR_HOST
="$STAGING_DIR/host"
23 STAGING_DIR_HOST_TMPL
="$DIR/staging_dir_host_tmpl"
34 echo "deptest.sh [OPTIONS] [PACKAGES]"
37 echo " --lean Run a lean test. Do not clean the build directory for each"
40 echo "PACKAGES are packages to test. If not specified, all installed packages"
41 echo "will be tested."
44 test_package
() # $1=pkgname
47 [ -n "$pkg" -a -z "$(echo "$pkg" | grep -e '/')" -a "$pkg" != "." -a "$pkg" != ".." ] || \
48 die
"Package name \"$pkg\" contains illegal characters"
50 for conf
in `grep CONFIG_PACKAGE tmp/.packagedeps | grep -E "[ /]$pkg\$" | sed -e 's,package-$(\(CONFIG_PACKAGE_.*\)).*,\1,'`; do
51 grep "$conf=" .config
> /dev
/null
&& SELECTED
=1 && break
53 local STAMP_SUCCESS
="$STAMP_DIR_SUCCESS/$pkg"
54 local STAMP_FAILED
="$STAMP_DIR_FAILED/$pkg"
55 local STAMP_BLACKLIST
="$STAMP_DIR_BLACKLIST/$pkg"
57 [ -f "$STAMP_SUCCESS" ] && return
58 [ -n "$SELECTED" ] ||
{
59 echo "Package $pkg is not selected"
62 [ -f "$STAMP_BLACKLIST" ] && {
63 echo "Package $pkg is blacklisted"
66 echo "Testing package $pkg..."
68 mkdir
-p "$STAGING_DIR"
69 cp -al "$STAGING_DIR_HOST_TMPL" "$STAGING_DIR_HOST"
70 [ $lean_test -eq 0 ] && rm -rf "$BUILD_DIR" "$BUILD_DIR_HOST"
71 mkdir
-p "$BUILD_DIR" "$BUILD_DIR_HOST"
72 make package
/$pkg/compile \
73 BUILD_DIR
="$BUILD_DIR" \
74 BUILD_DIR_HOST
="$BUILD_DIR_HOST" \
75 STAGING_DIR
="$STAGING_DIR" \
76 STAGING_DIR_HOST
="$STAGING_DIR_HOST" \
77 V
=99 >"$LOG_DIR/$(basename $pkg).log" 2>&1
79 touch "$STAMP_SUCCESS"
82 echo "Building package $pkg failed!"
86 # parse commandline options
89 while [ $# -ne 0 ]; do
99 packages
="$packages $1"
105 [ -f "$BASEDIR/include/toplevel.mk" ] || \
106 die
"Error: Could not find buildsystem base directory"
107 [ -f "$BASEDIR/.config" ] || \
108 die
"The buildsystem is not configured. Please run make menuconfig."
109 cd "$BASEDIR" || die
"Failed to enter base directory"
111 mkdir
-p "$STAMP_DIR_SUCCESS" "$STAMP_DIR_FAILED" "$STAMP_DIR_BLACKLIST" "$LOG_DIR"
113 [ -d "$STAGING_DIR_HOST_TMPL" ] ||
{
114 rm -rf staging_dir
/host
115 make tools
/install V
=99 || die
"make tools/install failed, please check"
116 cp -al staging_dir
/host "$STAGING_DIR_HOST_TMPL"
117 make toolchain
/install V
=99 || die
"make toolchain/install failed, please check"
118 make target
/linux
/install V
=99 || die
"make target/linux/install failed, please check"
121 if [ -z "$packages" ]; then
122 # iterate over all packages
123 for pkg
in `cat tmp/.packagedeps | grep CONFIG_PACKAGE | grep -v curdir | sed -e 's,.*[/=]\s*,,' | sort -u`; do
127 # only check the specified packages
128 for pkg
in $packages; do
This page took 0.047463 seconds and 5 git commands to generate.