Changeset 23818


Ignore:
Timestamp:
2010-11-03T13:41:28+01:00 (5 years ago)
Author:
mb
Message:

deptest: Support specifying certain packages to test on the commandline.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/scripts/deptest.sh

    r23811 r23818  
    11#!/bin/bash 
     2# 
     3# Automated OpenWrt package dependency checker 
     4# 
     5# Copyright (C) 2009-2010 OpenWrt.org 
     6# 
     7# This is free software, licensed under the GNU General Public License v2. 
     8# See /LICENSE for more information. 
     9# 
     10# Usage: 
     11#   No commandline arguments => check dependencies of all installed packages 
     12#   Package name(s) as arguments => only test the specified packages 
     13# 
    214 
    315SCRIPTDIR="$(dirname "$0")" 
     
    2234} 
    2335 
    24 [ -f "$BASEDIR/include/toplevel.mk" ] || \ 
    25         die "Error: Could not find buildsystem base directory" 
    26 [ -f "$BASEDIR/.config" ] || \ 
    27         die "The buildsystem is not configured. Please run make menuconfig." 
    28 cd "$BASEDIR" || die "Failed to enter base directory" 
    29  
    30 mkdir -p "$STAMP_DIR_SUCCESS" "$STAMP_DIR_FAILED" "$STAMP_DIR_BLACKLIST" \ 
    31         "$BUILD_DIR" "$BUILD_DIR_HOST" "$LOG_DIR" 
    32  
    33 [ -d "$STAGING_DIR_HOST_TMPL" ] || { 
    34         rm -rf staging_dir/host 
    35         make tools/install V=99 || die "make tools/install failed, please check" 
    36         cp -al staging_dir/host "$STAGING_DIR_HOST_TMPL" 
    37         make toolchain/install V=99 || die "make toolchain/install failed, please check" 
    38         make target/linux/install V=99 || die "make target/linux/install failed, please check" 
    39 } 
    40  
    41 for pkg in `cat tmp/.packagedeps  | grep CONFIG_PACKAGE | grep -v curdir | sed -e 's,.*[/=]\s*,,' | sort -u`; do 
    42         SELECTED= 
     36test_package() # $1=pkgname 
     37{ 
     38        local pkg="$1" 
     39        local SELECTED= 
    4340        for conf in `grep CONFIG_PACKAGE tmp/.packagedeps | grep -E "[ /]$pkg\$" | sed -e 's,package-$(\(CONFIG_PACKAGE_.*\)).*,\1,'`; do 
    44                 grep "$conf=" .config > /dev/null && SELECTED=1 
     41                grep "$conf=" .config > /dev/null && SELECTED=1 && break 
    4542        done 
    46         STAMP_SUCCESS="$STAMP_DIR_SUCCESS/$pkg" 
    47         STAMP_FAILED="$STAMP_DIR_FAILED/$pkg" 
    48         STAMP_BLACKLIST="$STAMP_DIR_BLACKLIST/$pkg" 
     43        local STAMP_SUCCESS="$STAMP_DIR_SUCCESS/$pkg" 
     44        local STAMP_FAILED="$STAMP_DIR_FAILED/$pkg" 
     45        local STAMP_BLACKLIST="$STAMP_DIR_BLACKLIST/$pkg" 
    4946        rm -f "$STAMP_FAILED" 
    50         [ -f "$STAMP_SUCCESS" ] && continue 
     47        [ -f "$STAMP_SUCCESS" ] && return 
    5148        [ -n "$SELECTED" ] || { 
    5249                echo "Package $pkg is not selected" 
    53                 continue 
     50                return 
    5451        } 
    5552        [ -f "$STAMP_BLACKLIST" ] && { 
    5653                echo "Package $pkg is blacklisted" 
    57                 continue 
     54                return 
    5855        } 
    5956        echo "Testing package $pkg..." 
     
    7471                echo "Building package $pkg failed!" 
    7572        fi 
    76 done 
     73} 
     74 
     75[ -f "$BASEDIR/include/toplevel.mk" ] || \ 
     76        die "Error: Could not find buildsystem base directory" 
     77[ -f "$BASEDIR/.config" ] || \ 
     78        die "The buildsystem is not configured. Please run make menuconfig." 
     79cd "$BASEDIR" || die "Failed to enter base directory" 
     80 
     81mkdir -p "$STAMP_DIR_SUCCESS" "$STAMP_DIR_FAILED" "$STAMP_DIR_BLACKLIST" \ 
     82        "$BUILD_DIR" "$BUILD_DIR_HOST" "$LOG_DIR" 
     83 
     84[ -d "$STAGING_DIR_HOST_TMPL" ] || { 
     85        rm -rf staging_dir/host 
     86        make tools/install V=99 || die "make tools/install failed, please check" 
     87        cp -al staging_dir/host "$STAGING_DIR_HOST_TMPL" 
     88        make toolchain/install V=99 || die "make toolchain/install failed, please check" 
     89        make target/linux/install V=99 || die "make target/linux/install failed, please check" 
     90} 
     91 
     92if [ $# -eq 0 ]; then 
     93        # iterate over all packages 
     94        for pkg in `cat tmp/.packagedeps  | grep CONFIG_PACKAGE | grep -v curdir | sed -e 's,.*[/=]\s*,,' | sort -u`; do 
     95                test_package "$pkg" 
     96        done 
     97else 
     98        # Only check the specified packages 
     99        while [ $# -ne 0 ]; do 
     100                test_package "$1" 
     101                shift 
     102        done 
     103fi 
Note: See TracChangeset for help on using the changeset viewer.