From: <ssk...@vh...> - 2005-09-23 12:32:22
|
Author: sskracic Date: 2005-09-23 14:22:34 +0200 (Fri, 23 Sep 2005) New Revision: 920 Modified: trunk/tools/misc/build-all.sh Log: build-all is now finally able to sort all supplied application in the proper dependency order, so that the whole shebang can be done with simple: $ echo ccm-* > all-apps.txt $ tools/misc/build-all.sh all-apps.txt In the case there's some missing dependency, build-all now tries to be helpful suggesting the app name that needs to be added to the app listing file, as well as the tip about restarting the build process. Modified: trunk/tools/misc/build-all.sh =================================================================== --- trunk/tools/misc/build-all.sh 2005-09-23 12:13:43 UTC (rev 919) +++ trunk/tools/misc/build-all.sh 2005-09-23 12:22:34 UTC (rev 920) @@ -157,7 +157,17 @@ then echo " Found only: $output, check $APPS_FILE and $CCM_APP/$CCM_APP/application.xml" else - echo " Application $app_name not built at all, check order of apps in $APPS_FILE" + echo + echo -n " Application $app_name not built at all" + if echo " ${APPS} " | grep -F " ${app_name} " > /dev/null + then + : + else + echo -n ", please add it to $APPS_FILE" + fi + echo + echo " Restart the build process with '-r $app_name'" + echo fi exit 1 @@ -265,15 +275,29 @@ display_usage fi +# get rid of newlines +apps=$(echo $(cat $APPS_FILE)) + APPS="" +# First, reorder the supplied list of apps in proper dependency order +app_build_order=$(grep ccm:requires */*/application.xml | sed 's!^\(ccm-[^/]*\)/.*name="\([^"]*\)".*!\2 \1!' | tsort) +for app in $app_build_order +do + if echo " ${apps} " | grep -F " ${app} " > /dev/null + then + APPS="$APPS $app" + fi +done + + BUILD_APPS="" BOOTSTRAP=1 -for app in `cat $APPS_FILE`; do - APPS="$APPS $app"; +for app in $APPS +do if [ "x$RESTART_FOUND" = "x1" -o "x$RESTART_FROM" = "x$app" ]; then - RESTART_FOUND=1; - BOOTSTRAP=0 - BUILD_APPS="$BUILD_APPS $app"; + RESTART_FOUND=1; + BOOTSTRAP=0 + BUILD_APPS="$BUILD_APPS $app"; fi done @@ -281,13 +305,14 @@ BUILD_APPS=$APPS fi + if [ ! -z $RESTART_FROM ] && [ -z $RESTART_FOUND ] && [ $DO_BUILD = 1 ]; then echo "$RESTART_FROM not found in app list"; display_usage fi -echo "Processing apps: $APPS" -echo "Building apps: $BUILD_APPS" +echo "Processing apps: $apps" +echo "Building apps in order: $BUILD_APPS" BUILD_HOME=`pwd` VIRTUAL_ROOT=$BUILD_HOME/root @@ -553,7 +578,7 @@ ( set -e set_application_properties $i - $RPM $RPM_ARGS --noscripts --relocate /usr=$VIRTUAL_ROOT --relocate /etc=$VIRTUAL_ROOT/etc -ivh $HOMERPMDIR/$APP_NAME-$APP_VERSION-$RELEASE.noarch.rpm + $RPM $RPM_ARGS --force --noscripts --relocate /usr=$VIRTUAL_ROOT --relocate /etc=$VIRTUAL_ROOT/etc -Uvh $HOMERPMDIR/$APP_NAME-$APP_VERSION-$RELEASE.noarch.rpm ) || exit $? done |