Changeset 749

Show
Ignore:
Timestamp:
06/07/07 18:15:59 (6 years ago)
Author:
max
Message:

Various cosmetic changes, in particular make standard update text less noisy

Files:
2 modified

Legend:

Unmodified
Added
Removed
  • applications/shepherd

    r744 r749  
    22 
    33my $progname = 'shepherd'; 
    4 my $version = '0.4.110'; 
     4my $version = '0.4.111'; 
    55 
    66# tv_grab_au 
     
    333333    $ver = $components->{$proggy}->{ver} if (defined $components->{$proggy} and -e query_filename($proggy,$progtype)); 
    334334 
    335     my ($result, $action); 
     335    my ($result, $action, $component_csum); 
    336336 
    337337    if ($components->{$proggy} and $components->{$proggy}->{disabled} and $components->{$proggy}->{disabled} == 1) 
     
    354354        } 
    355355    } 
     356 
     357    # if component is up-to-date, check it still works and isn't tainted (modified) 
     358    if (defined $result and $result == 0) 
     359    { 
     360        # check it still works 
     361        my $test_result = 1; 
     362        if ($progtype ne 'application' and $progtype ne 'reference')  
     363        { 
     364            $test_result = test_proggy($proggy, $progtype, undef, 1); 
     365        } 
     366 
     367        if (!$test_result)  
     368        { 
     369            # broken 
     370            $action = 'FAILED'; 
     371            $plugin_data->{$proggy}->{failed_test} = 1; 
     372        }  
     373        else  
     374        { 
     375            # verify the component isn't tainted 
     376            $component_csum = csum_file(query_ldir($proggy, $progtype)."/".$proggy); 
     377            if ($component_csum ne $csum2)  
     378            { 
     379                # tainted 
     380                $action = 'TAINTED'; 
     381            } 
     382        } 
     383    } 
     384 
    356385    &log(2,sprintf  "* %-54s%17s\n", 
    357386                    ucfirst($progtype) . " $proggy" . 
     
    359388                    $action); 
    360389 
    361     # if component is up-to-date, check it still works and isn't tainted (modified) 
    362     if ((defined $result) && ($result == 0)) { 
    363         # check that it still works 
    364         my $test_result = 1; 
    365         if ($progtype ne 'application' and $progtype ne 'reference') { 
    366             $test_result = test_proggy($proggy, $progtype, undef, 1); 
    367         } 
    368  
    369         if (!$test_result) { 
    370             # broken 
    371             $plugin_data->{$proggy}->{failed_test} = 1; 
    372         } else { 
    373             # verify that the component isn't tainted 
    374             my $component_csum = csum_file(query_ldir($proggy, $progtype)."/".$proggy); 
    375             if ($component_csum ne $csum2) { 
    376                 # tainted 
    377                 &log(2,"\nWARNING: Component '$proggy' ($progtype) has been modified/tainted\n". 
    378                     " -  expected checksum: $csum2\n". 
    379                     " -  actual checksum:   $component_csum\n\n"); 
    380  
    381                 # are we running a manual update? 
    382                 if ($opt->{update}) { 
    383                     # yes - manually force the tainted module to be reinstalled 
    384                     $result = -1; 
    385                     &log("Forcing reinstall of $proggy due to existing component modified/tainted.\n". 
    386                         "If you DON'T wish this to happen CTRL-C now...\n"); 
    387                     &countdown(15); 
    388                 } else { 
    389                     # no - whinge about the tainted module 
    390                     $plugin_data->{$proggy}->{tainted} = 1; 
    391                     $plugin_data->{tainted} = 1; 
    392                     $components_used .= "[tainted]" if ($proggy eq $progname); 
    393  
    394                     &log(2,"Modifying Shepherd or its components is not recommended.  If you have added\n". 
    395                         "functionality in some way, why not contribute it back?  See the wiki at\n". 
    396                         "$wiki for details.\n\n". 
    397                         "If you wish to revert $proggy back to the standard module, run ".ucfirst($progname)."\n". 
    398                         "with --update manually.\n\n"); 
    399                     &countdown(10); 
    400                     &log(2,"\n\n"); 
    401                 } 
    402             } 
    403         } 
    404     } 
     390    if ($action eq 'FAILED') 
     391    { 
     392        &log(2,"  For details, run Shepherd with --check option.\n"); 
     393    } 
     394    if ($action eq 'TAINTED') 
     395    { 
     396        &log(2,"\nWARNING: Component '$proggy' ($progtype) has been modified/tainted\n". 
     397               " -  expected checksum: $csum2\n". 
     398               " -  actual checksum:   $component_csum\n\n"); 
     399 
     400        # are we running a manual update? 
     401        if ($opt->{update}) { 
     402            # yes - manually force the tainted module to be reinstalled 
     403            $result = -1; 
     404            &log("Forcing reinstall of $proggy due to existing component modified/tainted.\n". 
     405                 "If you DON'T wish this to happen CTRL-C now...\n"); 
     406             &countdown(15); 
     407         } else { 
     408             # no - whinge about the tainted module 
     409             $plugin_data->{$proggy}->{tainted} = 1; 
     410             $plugin_data->{tainted} = 1; 
     411             $components_used .= "[tainted]" if ($proggy eq $progname); 
     412 
     413             &log(2,"Modifying Shepherd or its components is not recommended.  If you have added\n". 
     414                    "functionality in some way, why not contribute it back?  See the wiki at\n". 
     415                    "$wiki for details.\n\n". 
     416                    "If you wish to revert $proggy back to the standard module, run ".ucfirst($progname)."\n". 
     417                    "with --update manually.\n\n"); 
     418             &countdown(10); 
     419             &log(2,"\n\n"); 
     420         } 
     421     } 
    405422 
    406423    return $result if (defined $opt->{noupdate}); 
     
    426443{ 
    427444    my ($proggy, $latestversion, $progtype, $oldver, $csum1, $csum2) = @_; 
     445 
    428446    my $config; 
    429  
    430447    my $rdir = ""; 
    431448    my $basedir = $CWD."/".$progtype."s"; 
     
    567584    if ($result) 
    568585    { 
    569         &log("Testing $proggy ... ") if ($quiet); 
    570         &log("FAIL.\n\n".ucfirst($progtype) . " $proggy did not exit cleanly!\n" . 
    571              "It may require configuration.\n"); 
    572  
    573         &log(sprintf("<<<<<< output from $proggy was as follows:\n%s\n>>>>>> end output from $proggy\n",$test_output)); 
    574  
     586        unless ($quiet) 
     587        { 
     588            &log("FAIL.\n\n".ucfirst($progtype) . " $proggy did not exit cleanly!\n"); 
     589 
     590            # can we give any more details on why it failed? 
     591            if ($test_output and $test_output =~ /Can't locate (.*) in \@INC/)  
     592            { 
     593                my $modname = $1; 
     594                $modname =~ s#/#::#g;       # turn / into :: 
     595                $modname =~ s#\.pm##g;      # remove .pm suffix 
     596                $statusmsg = "Missing module \"$modname\""; 
     597 
     598                &log("Probably failed due to dependency on missing module '".$modname."'\n"); 
     599            } 
     600            else 
     601            { 
     602                &log("It may require configuration.\n"); 
     603            } 
     604 
     605            &log(sprintf("\n<<<<<< output from $proggy was as follows:\n%s>>>>>> end output from $proggy\n\n",$test_output)); 
     606        } 
    575607        # set proggy status accordingly 
    576         $statusmsg = sprintf "FAILED (return code %d%s) on %s", 
    577             $result, 
    578             ($resultmsg eq "" ? "" : ", '$resultmsg'"), 
    579             POSIX::strftime("%a%d%b%y", localtime(time)); 
    580  
    581         # can we give any more details on why it failed? 
    582         if ($test_output and $test_output =~ /Can't locate (.*) in \@INC/) { 
    583             my $modname = $1; 
    584             $modname =~ s#/#::#g;       # turn / into :: 
    585             $modname =~ s#\.pm##g;      # remove .pm suffix 
    586             $statusmsg .= ": missing '".$modname."' module."; 
    587  
    588             &log("Probably failed due to dependency on missing module '".$modname."'\n"); 
    589         } 
    590  
    591         &log("\n"); 
     608        unless ($statusmsg) 
     609        { 
     610            $statusmsg = sprintf "return code %d%s", $result, ($resultmsg eq "" ? "" : ", '$resultmsg'"); 
     611        } 
     612        $statusmsg = sprintf "FAILED (%s) on %s", 
     613                         $statusmsg, 
     614                         POSIX::strftime("%a%d%b%y", localtime(time)); 
    592615    } 
    593616    else 
     
    603626 
    604627    # update status message 
    605     if ((defined $statusmsg) && ($statusmsg ne "")) { 
    606         if ((defined $specific_version) && ($specific_version ne "")) { 
     628    if ($statusmsg) { 
     629        if ($specific_version) { 
    607630            $components_pending_install->{$proggy}->{admin_status} = $statusmsg; 
    608631        } elsif (defined $components->{$proggy}) { 
     
    11271150 
    11281151    &rotate_logfiles; 
    1129     &log(1, "Logging to $log_file.\n"); 
     1152    &log(1, "Logging to: $log_file\n"); 
    11301153    open(LOG_FILE,">>$LOG_DIR/$log_file") || die "can't open log file $LOG_DIR/$log_file for writing: $!\n"; 
    11311154 
     
    11791202{ 
    11801203    my ($component,$prog,$want_output,$timeout,$display_output,$progtype) = @_; 
     1204 
    11811205    $timeout = 0 if (!defined $timeout); 
    11821206    $want_output = 0 if (!defined $want_output); 
     
    12421266        return (($? & 127), "Died:$msg", $prog_output); 
    12431267    }  
    1244     &log(1, (sprintf "%s exited with value %d\n", ucfirst($component), ($? >> 8))); 
    12451268 
    12461269    return (0,"",$prog_output) unless ($? >> 8); 
     
    14941517sub check_lock 
    14951518{ 
    1496     print "Locking $0.\n"; 
    1497     open SELF, "< $0" or die "Can't open $0: $!\n"; 
    1498     $lock = (flock SELF, &Fcntl::LOCK_EX | &Fcntl::LOCK_NB); 
     1519    print "Locking: $0\n"; 
     1520    if (open SELF, "< $0") 
     1521    { 
     1522        $lock = (flock SELF, &Fcntl::LOCK_EX | &Fcntl::LOCK_NB); 
     1523    } 
     1524    else 
     1525    { 
     1526        print "Lock failed: can't open $0: $!\n"; 
     1527    } 
    14991528} 
    15001529 
  • status

    r748 r749  
    1 application     shepherd            0.4.110 
     1application     shepherd            0.4.111 
    22reference       channel_list        2 
    33reference       Shepherd/Common.pm  0.15