762821a39cb078a278c55f88fd24f95af532683e
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 # No commandline arguments => check dependencies of all installed packages
12 # Package name(s) as arguments => only test the specified packages
15 SCRIPTDIR
="$(dirname "$0")"
16 [ "${SCRIPTDIR:0:1}" = "/" ] || SCRIPTDIR
="$PWD/$SCRIPTDIR"
17 BASEDIR
="$SCRIPTDIR/.."
19 DIR
="$BASEDIR/tmp/deptest"
20 STAMP_DIR_SUCCESS
="$DIR/stamp-success"
21 STAMP_DIR_FAILED
="$DIR/stamp-failed"
22 STAMP_DIR_BLACKLIST
="$DIR/stamp-blacklist"
23 BUILD_DIR
="$DIR/build_dir/target"
24 BUILD_DIR_HOST
="$DIR/build_dir/host"
25 STAGING_DIR
="$DIR/staging_dir"
26 STAGING_DIR_HOST
="$DIR/staging_dir_host"
27 STAGING_DIR_HOST_TMPL
="$DIR/staging_dir_host_tmpl"
36 test_package
() # $1=pkgname
39 [ -z "$(echo "$pkg" | grep -e '/')" -a "$pkg" != "." -a "$pkg" != ".." ] || \
40 die
"Package name \"$pkg\" contains illegal characters"
42 for conf
in `grep CONFIG_PACKAGE tmp/.packagedeps | grep -E "[ /]$pkg\$" | sed -e 's,package-$(\(CONFIG_PACKAGE_.*\)).*,\1,'`; do
43 grep "$conf=" .config
> /dev
/null
&& SELECTED
=1 && break
45 local STAMP_SUCCESS
="$STAMP_DIR_SUCCESS/$pkg"
46 local STAMP_FAILED
="$STAMP_DIR_FAILED/$pkg"
47 local STAMP_BLACKLIST
="$STAMP_DIR_BLACKLIST/$pkg"
49 [ -f "$STAMP_SUCCESS" ] && return
50 [ -n "$SELECTED" ] ||
{
51 echo "Package $pkg is not selected"
54 [ -f "$STAMP_BLACKLIST" ] && {
55 echo "Package $pkg is blacklisted"
58 echo "Testing package $pkg..."
60 mkdir
-p "$STAGING_DIR"
61 rm -rf "$STAGING_DIR_HOST"
62 cp -al "$STAGING_DIR_HOST_TMPL" "$STAGING_DIR_HOST"
63 make package
/$pkg/compile \
64 BUILD_DIR
="$BUILD_DIR" \
65 BUILD_DIR_HOST
="$BUILD_DIR_HOST" \
66 STAGING_DIR
="$STAGING_DIR" \
67 STAGING_DIR_HOST
="$STAGING_DIR_HOST" \
68 V
=99 >"$LOG_DIR/$(basename $pkg).log" 2>&1
70 touch "$STAMP_SUCCESS"
73 echo "Building package $pkg failed!"
77 [ -f "$BASEDIR/include/toplevel.mk" ] || \
78 die
"Error: Could not find buildsystem base directory"
79 [ -f "$BASEDIR/.config" ] || \
80 die
"The buildsystem is not configured. Please run make menuconfig."
81 cd "$BASEDIR" || die
"Failed to enter base directory"
83 mkdir
-p "$STAMP_DIR_SUCCESS" "$STAMP_DIR_FAILED" "$STAMP_DIR_BLACKLIST" \
84 "$BUILD_DIR" "$BUILD_DIR_HOST" "$LOG_DIR"
86 [ -d "$STAGING_DIR_HOST_TMPL" ] ||
{
87 rm -rf staging_dir
/host
88 make tools
/install V
=99 || die
"make tools/install failed, please check"
89 cp -al staging_dir
/host "$STAGING_DIR_HOST_TMPL"
90 make toolchain
/install V
=99 || die
"make toolchain/install failed, please check"
91 make target
/linux
/install V
=99 || die
"make target/linux/install failed, please check"
95 # iterate over all packages
96 for pkg
in `cat tmp/.packagedeps | grep CONFIG_PACKAGE | grep -v curdir | sed -e 's,.*[/=]\s*,,' | sort -u`; do
100 # Only check the specified packages
101 while [ $# -ne 0 ]; do
This page took 0.054836 seconds and 3 git commands to generate.