Changeset 2733

Show
Ignore:
Timestamp:
01/21/06 14:20:48 (3 years ago)
Author:
tarjei
Message:

Better errorhandling.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/support/checkManifest.php

    r2732 r2733  
    11<?php 
    22$tmpfile = $argv[1]; 
     3$debug   = $argv[2]; 
    34 
    45$manifests = file_get_contents($tmpfile); 
     
    1011foreach (explode ("\n", $manifests) as $num =>  $file )  
    1112{ 
     13    if ($debug == 1 ) { 
     14        echo $file . "\n"; 
     15    } 
    1216    if ($file != '')  
    1317    { 
    14         $component = check_component($file); 
    15         if ($component) 
     18        $component = check_component($file, $debug); 
     19        if ($component == -1 ) { 
     20            echo "\n$file contains errors fix them before continuing!!\n"; 
     21            exit ( 1); 
     22        } 
     23        if ( $component  ) 
    1624        { 
    1725            $pear_manifests[] = $component;     
    18         }     
     26        } 
     27         
    1928    } 
    2029} 
     
    2231echo implode ("\n", $pear_manifests); 
    2332 
    24 function check_component($file)  
     33function check_component($file, $debug)  
    2534{ 
    2635     
     
    2938    if (!file_exists($component['manifest_file'])) 
    3039    { 
     40        return -1; 
    3141        die("Component manifest {$component['manifest_file']} not found.\n"); 
    3242    } 
    3343     
    3444    // Read the manifest 
    35     eval('$component[\'manifest\'] = Array('.file_get_contents($component['manifest_file']).');'); 
     45 
     46     
     47    eval('$component[\'manifest\'] = Array('.file_get_contents($component['manifest_file']).');');  
     48 
     49     
    3650    if (   !is_array($component['manifest']) 
    3751        || count($component['manifest']) == 0) 
    3852    { 
     53        return -1; 
    3954        die("Component manifest {$component['manifest_file']} is broken.\n"); 
    4055    } 
    41      
    4256     
    4357    eval('$component[\'manifest\'] = Array('.file_get_contents($component['manifest_file']).');'); 
  • trunk/support/findComponents.sh

    r2732 r2733  
    33PHP=`which php` 
    44 
     5 
    56find ../ -name "manifest.inc" > "./manifests.tmp" 
    6 $PHP ./checkManifest.php ./manifests.tmp 
     7 
     8output=`$PHP ./checkManifest.php ./manifests.tmp 0` 
     9 
     10if [ $? != 0 ];then 
     11    echo  "Error in manifestfile. Exiting!\n" 
     12    echo  "$output "; 
     13    exit 1 
     14fi 
     15 
     16 
     17$PHP ./checkManifest.php ./manifests.tmp 0 
    718rm -f "./manifests.tmp" 
    819 
  • trunk/support/makedist2.sh

    r2731 r2733  
    66# Note: your PEAR must be patched according to: 
    77# http://bergie.iki.fi/midcom-permalink-d6068a9ddfb168af1aae6d5f61579dc3 
    8 PEAR="/sw/bin/pear" 
    9 #PEAR=`which pear` 
     8#PEAR="/sw/bin/pear" 
     9PEAR=`which pear` 
    1010PHP=`which php` 
     11echo "Using PEAR fund here: $PEAR" 
     12echo "Using PHP found here: $PHP" 
    1113MIDCOM_SUPPORT_DIR=`dirname $0` 
    1214 
     
    2931de.linkm.taviewer 
    3032net.nemein.ping 
    31 net.nehmer.jobmarket" 
     33net.nehmer.jobmarket 
     34
     35COMPONENTS=`./findComponents.sh` 
     36if [ $? != 0 ];then 
     37    echo  "$COMPONENTS "; 
     38    exit 1 
     39fi 
     40 
    3241 
    3342for component in $COMPONENTS; do