OpenPKG CVS Repository
  http://cvs.openpkg.org/
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Thomas Lotterer
  Root:   /v/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-tools                    Date:   15-Feb-2005 14:44:50
  Branch: HEAD                             Handle: 2005021513445000

  Modified files:
    openpkg-tools/cmd       bf-ui.pl

  Log:
    visualize support table to track importance grace of instances

  Summary:
    Revision    Changes     Path
    1.12        +56 -5      openpkg-tools/cmd/bf-ui.pl
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-tools/cmd/bf-ui.pl
  ============================================================================
  $ cvs diff -u -r1.11 -r1.12 bf-ui.pl
  --- openpkg-tools/cmd/bf-ui.pl        11 Feb 2005 09:11:40 -0000      1.11
  +++ openpkg-tools/cmd/bf-ui.pl        15 Feb 2005 13:44:50 -0000      1.12
  @@ -1069,6 +1069,25 @@
           push @classes, $c;
       }
   
  +    my $supportpri = {
  +        "deprecated" => 1,
  +        "obsoleted"  => 2,
  +        "supported"  => 3,
  +        "tentative"  => 4,
  +        "forecasted" => 5
  +    };
  +    $rv = $dbh->selectall_hashref("SELECT su_inst_host, su_support FROM 
support;", "su_inst_host");
  +    if (not $rv) {
  +        die "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
  +    }
  +
  +    my $hostsupport = {};
  +    foreach my $i (keys %{$rv}) {
  +        my $s = %{$rv}->{$i}->{"su_support"};
  +        my $p = $supportpri->{$s} || 6;
  +        $hostsupport->{$i} = $p;
  +    }
  +
       my @insts;
       $rv = $dbh->selectall_arrayref("SELECT DISTINCT st_inst_host, 
st_inst_arch, st_inst_os " .
                                      "FROM status " .
  @@ -1076,7 +1095,15 @@
       if (not $rv) {
           die "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
       }
  -    foreach my $i (@{$rv}) {
  +
  +    sub bysupport {
  +        my $supporta = $hostsupport->{$a->[0]} || 7;
  +        my $supportb = $hostsupport->{$b->[0]} || 7;
  +        if ($supporta == $supportb) { return $a <=> $b }
  +        return $supporta-$supportb;
  +    }
  +
  +    foreach my $i (sort bysupport @{$rv}) {
           push @insts, @{$i}->[0] . "-" . @{$i}->[1] . "-" . @{$i}->[2];
       }
   
  @@ -1141,25 +1168,49 @@
                   for my $i (@{$rv}) {
                       $row->{$i->[0] . "-" . $i->[1] . "-" . $i->[2]} = 
$i->[3];
                   }
  +                my ($goodrow, $lastsupport, $line);
  +                $goodrow = 1;
  +                $lastsupport = undef;
  +                $line = "";
                   foreach my $inst (@insts) {
                       my ($host, $arch, $os, $tag) = &splitinst($inst . 
"-openpkg"); # bsd1-ix86-freebsd5.3-openpkg
                       my $logfile = "$inst/$package.log.$host.$arch-$os-$tag";
   
  +                    # support
  +                    my $support = $hostsupport->{$host};
  +                    $line .= " " if (defined $lastsupport and $lastsupport 
!= $support);
  +                    $lastsupport = $support;
  +
                       # color
                       my $color = $row->{$inst};
                       my $l = "<a 
href=\"$myurl?page=log&mode=tail&file=$logfile\">";
                       my $r = "</a>";
                       if ($color eq "green") {
  -                        $html .= "$l<img 
src=\"$myurl?page=gif&name=icon-ok\" alt=\"green\" border=\"0\">$r";
  +                        $line .= "$l<img 
src=\"$myurl?page=gif&name=icon-ok\" alt=\"green\" border=\"0\">$r";
                       }
                       elsif ($color eq "red") {
  -                        $html .= "$l<img src=\"$myurl?page=gif&name=icon-x\" 
alt=\"red\" border=\"0\">$r";
  +                        $line .= "$l<img src=\"$myurl?page=gif&name=icon-x\" 
alt=\"red\" border=\"0\">$r";
  +                        $goodrow = 0 if ($class eq "CORE" and $support >= 2 
and $support <= 4);
  +                        $goodrow = 0 if ($class eq "BASE" and $support == 3);
  +                        $goodrow = 0 if ($class eq "PLUS" and $support == 3);
                       }
                       else {
  -                        $html .= "$l<img 
src=\"$myurl?page=gif&name=icon-dot\" alt=\"$color\" border=\"0\">$r";
  +                        $line .= "$l<img 
src=\"$myurl?page=gif&name=icon-dot\" alt=\"$color\" border=\"0\">$r";
  +                        $goodrow = 0 if ($class eq "CORE" and $support >= 2 
and $support <= 4);
  +                        $goodrow = 0 if ($class eq "BASE" and $support == 3);
  +                        $goodrow = 0 if ($class eq "PLUS" and $support == 3);
                       }
                   }
  -                $html .= "&nbsp;<a 
href=\"$myurl?page=status&submit=status&vs_package=$package\">$package</a>\n";
  +                $line .= "&nbsp;<a 
href=\"$myurl?page=status&submit=status&vs_package=$package\">$package</a>\n";
  +                $html .= "[<a 
href=\"$myurl?page=status&submit=status&vs_package=$package\">";
  +                if ($goodrow) {
  +                    $html .= "<img src=\"$myurl?page=gif&name=icon-ok\" 
alt=\"green\" border=\"0\">";
  +                }
  +                else {
  +                    $html .= "<img src=\"$myurl?page=gif&name=icon-x\" 
alt=\"red\" border=\"0\">";
  +                }
  +                $html .= "</a>]&nbsp;";
  +                $html .= $line;
               }
               print STDOUT $html;
               $html = '';
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [email protected]

Reply via email to