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:   19-Nov-2005 23:06:58
  Branch: HEAD                             Handle: 2005111922065701

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

  Log:
    make error messages independent of the database kind; send proper
    content type for CSS; variable initialization; remove unused code
    fragments generating HTML header; strict naming in welcome message;
    proper table record closure tag

  Summary:
    Revision    Changes     Path
    1.17        +10 -10     openpkg-tools/cmd/bf-db.pl
    1.25        +21 -23     openpkg-tools/cmd/bf-ui.pl
    1.16        +2  -2      openpkg-tools/cmd/src2make.pl
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-tools/cmd/bf-db.pl
  ============================================================================
  $ cvs diff -u -r1.16 -r1.17 bf-db.pl
  --- openpkg-tools/cmd/bf-db.pl        24 Mar 2005 11:21:11 -0000      1.16
  +++ openpkg-tools/cmd/bf-db.pl        19 Nov 2005 22:06:57 -0000      1.17
  @@ -189,7 +189,7 @@
       } while (not $rv and $dbh->errstr =~ m|lock|i and sleep(1) and 
$retries-- >= 1);
       printf STDERR "DEBUG:$0: countdown from %d to %d\n", $lockretries, 
$retries if($opt_verbose or $retries != $lockretries);
       if (not $rv) {
  -        print STDERR "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
  +        print STDERR "ERROR:$0: DataBase error: ".$dbh->errstr."\n";
           exit(2);
       }
   
  @@ -209,7 +209,7 @@
       } while (not $rv and $dbh->errstr =~ m|lock|i and sleep(1) and 
$retries-- >= 1);
       printf STDERR "DEBUG:$0: countdown from %d to %d\n", $lockretries, 
$retries if($opt_verbose or $retries != $lockretries);
       if (not $rv) {
  -        print STDERR "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
  +        print STDERR "ERROR:$0: DataBase error: ".$dbh->errstr."\n";
           exit(2);
       }
   }
  @@ -240,7 +240,7 @@
           } while (not $rv and $dbh->errstr =~ m|lock|i and sleep(1) and 
$retries-- >= 1);
           printf STDERR "DEBUG:$0: countdown from %d to %d\n", $lockretries, 
$retries if($opt_verbose or $retries != $lockretries);
           if (not $rv) {
  -            print STDERR "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
  +            print STDERR "ERROR:$0: DataBase error: ".$dbh->errstr."\n";
               exit(2);
           }
           $rv = $sth->fetchrow_array;
  @@ -259,7 +259,7 @@
               } while (not $rv and $dbh->errstr =~ m|lock|i and sleep(1) and 
$retries-- >= 1);
               printf STDERR "DEBUG:$0: countdown from %d to %d\n", 
$lockretries, $retries if($opt_verbose or $retries != $lockretries);
               if (not $rv) {
  -                print STDERR "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
  +                print STDERR "ERROR:$0: DataBase error: ".$dbh->errstr."\n";
                   exit(2);
               }
           }
  @@ -285,7 +285,7 @@
               } while (not $rv and $dbh->errstr =~ m|lock|i and sleep(1) and 
$retries-- >= 1);
               printf STDERR "DEBUG:$0: countdown from %d to %d\n", 
$lockretries, $retries if($opt_verbose or $retries != $lockretries);
               if (not $rv) {
  -                print STDERR "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
  +                print STDERR "ERROR:$0: DataBase error: ".$dbh->errstr."\n";
                   exit(2);
               }
           }
  @@ -304,7 +304,7 @@
               } while (not $rv and $dbh->errstr =~ m|lock|i and sleep(1) and 
$retries-- >= 1);
               printf STDERR "DEBUG:$0: countdown from %d to %d\n", 
$lockretries, $retries if($opt_verbose or $retries != $lockretries);
               if (not $rv) {
  -                print STDERR "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
  +                print STDERR "ERROR:$0: DataBase error: ".$dbh->errstr."\n";
                   exit(2);
               }
               printf STDERR "amendment for inst=%s, package=%s completed, time 
untouched, set color=%s\n", $inst, $package, $color;
  @@ -326,7 +326,7 @@
           } while (not $rv and $dbh->errstr =~ m|lock|i and sleep(1) and 
$retries-- >= 1);
           printf STDERR "DEBUG:$0: countdown from %d to %d\n", $lockretries, 
$retries if($opt_verbose or $retries != $lockretries);
           if (not $rv) {
  -            print STDERR "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
  +            print STDERR "ERROR:$0: DataBase error: ".$dbh->errstr."\n";
               exit(2);
           }
           if ($amend) {
  @@ -351,7 +351,7 @@
       } while (not $rv and $dbh->errstr =~ m|lock|i and sleep(1) and 
$retries-- >= 1);
       printf STDERR "DEBUG:$0: countdown from %d to %d\n", $lockretries, 
$retries if($opt_verbose or $retries != $lockretries);
       if (not $rv) {
  -        print STDERR "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
  +        print STDERR "ERROR:$0: DataBase error: ".$dbh->errstr."\n";
           exit(2);
       }
   
  @@ -382,7 +382,7 @@
       } while (not $rv and $dbh->errstr =~ m|lock|i and sleep(1) and 
$retries-- >= 1);
       printf STDERR "DEBUG:$0: countdown from %d to %d\n", $lockretries, 
$retries if($opt_verbose or $retries != $lockretries);
       if (not $rv) {
  -        print STDERR "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
  +        print STDERR "ERROR:$0: DataBase error: ".$dbh->errstr."\n";
           exit(2);
       }
   }
  @@ -393,7 +393,7 @@
       my ($dbfile) = @_;
       my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile", "", "", { RaiseError 
=> 0, AutoCommit => 1 });
       if (not defined $dbh) {
  -        print STDERR "ERROR:$0: \"cannot open database file \"$dbfile\". 
SQLite error: ".$dbh->errstr."\n";
  +        print STDERR "ERROR:$0: \"cannot open database file \"$dbfile\". 
DataBase error: ".$dbh->errstr."\n";
           exit(2);
       }
   
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-tools/cmd/bf-ui.pl
  ============================================================================
  $ cvs diff -u -r1.24 -r1.25 bf-ui.pl
  --- openpkg-tools/cmd/bf-ui.pl        16 Oct 2005 11:52:01 -0000      1.24
  +++ openpkg-tools/cmd/bf-ui.pl        19 Nov 2005 22:06:57 -0000      1.25
  @@ -154,7 +154,7 @@
   if    ($cgi->param("page") eq "css") {
       my $out;
       $out = '';
  -    $out .= &viewhttp('text/html', '+10s');
  +    $out .= &viewhttp('text/css', '+600s');
       $out .= &viewcss();
       print STDOUT $out;
   }
  @@ -255,6 +255,7 @@
   else {
       my $out;
       $cgi->delete_all();
  +    $out = '';
       $out .= &viewhttp();
       $out .= &viewhtmlhead();
       $out .= &viewmainform();
  @@ -282,16 +283,14 @@
       return $cgi->header($header);
   }
   
  -sub viewhtmlhead ($)
  +sub viewhtmlhead ()
   {
  -    my ($html) = @_;
       my $head = "";
       $head .= "<html>\n";
       $head .= "  <head>\n";
       $head .= "    <link rel=\"stylesheet\" type=\"text/css\" 
href=\"$myurl?page=css\">\n";
       $head .= "  </head>\n";
       $head .= "  <body>\n";
  -    #$head .= "    <table class=\"bf\">\n";
       $head .= "      <img src=\"http://www.openpkg.org/openpkg.gif\"; alt=\"\" 
width=\"148\" height=\"80\" align=\"right\">\n";
       $head .= "      <h1>OpenPKG Build Farm</h1>\n";
       return $head;
  @@ -300,7 +299,6 @@
   sub viewhtmltail ()
   {
       my $tail = "";
  -    #$tail .= "    </table>\n";
       $tail .= "  </body>\n";
       $tail .= "</html>\n";
       return $tail;
  @@ -310,7 +308,7 @@
       my $css = '';
   
       $css .= "/*\n";
  -    $css .= "**  bfui.cgi - OpenPKG build farm user interface CGI\n";
  +    $css .= "**  bf-ui.pl - OpenPKG build farm user interface\n";
       $css .= "*/\n";
       $css .= "\n";
       $css .= "HTML {\n";
  @@ -842,7 +840,7 @@
                                      "FROM status " .
                                      "ORDER BY st_build_color;");
       if (not $rv) {
  -        die "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
  +        die "ERROR:$0: DataBase error: ".$dbh->errstr."\n";
       }
       foreach my $i (@{$rv}) {
           push @color, @{$i}->[0] unless (@{$i}->[0] eq "");
  @@ -854,7 +852,7 @@
                                      "FROM status " .
                                      "ORDER BY st_inst_host, st_inst_arch, 
st_inst_os;");
       if (not $rv) {
  -        die "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
  +        die "ERROR:$0: DataBase error: ".$dbh->errstr."\n";
       }
       foreach my $i (@{$rv}) {
           push @inst, @{$i}->[0] . "-" . @{$i}->[1] . "-" . @{$i}->[2];
  @@ -866,7 +864,7 @@
                                      "FROM class " .
                                      "ORDER BY cl_package_class;");
       if (not $rv) {
  -        die "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
  +        die "ERROR:$0: DataBase error: ".$dbh->errstr."\n";
       }
       foreach my $i (@{$rv}) {
           push @class, @{$i}->[0] unless (@{$i}->[0] eq "");
  @@ -878,7 +876,7 @@
                                      "FROM status " .
                                      "ORDER BY st_package_name, 
st_package_version, st_package_release;");
       if (not $rv) {
  -        die "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
  +        die "ERROR:$0: DataBase error: ".$dbh->errstr."\n";
       }
       foreach my $i (@{$rv}) {
           push @package, @{$i}->[0] . "-" . @{$i}->[1] . "-" . @{$i}->[2];
  @@ -1014,7 +1012,7 @@
   
       $rv = $dbh->selectall_hashref("SELECT * FROM processing;", 
"pr_inst_host");
       if (not $rv) {
  -        die "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
  +        die "ERROR:$0: DataBase error: ".$dbh->errstr."\n";
       }
   
       $html .= "<table class=\"bf\">\n";
  @@ -1024,7 +1022,7 @@
       $html .= "<td><b>name-version-release</b></td>";
       $html .= "<td><b>building&nbsp;since</b></td>";
       $html .= "<td><b>duration</b></td>";
  -    $html .= "<tr>\n";
  +    $html .= "</tr>\n";
       for my $i (sort keys %{$rv}) {
            my ($name, $version, $release) = (%{$rv}->{$i}->{pr_package_name}, 
%{$rv}->{$i}->{pr_package_version}, %{$rv}->{$i}->{pr_package_release});
            my ($host, $arch, $os, $tag) = (%{$rv}->{$i}->{pr_inst_host}, 
%{$rv}->{$i}->{pr_inst_arch}, %{$rv}->{$i}->{pr_inst_os}, 
%{$rv}->{$i}->{pr_inst_tag});
  @@ -1130,7 +1128,7 @@
   
       $rv = $dbh->selectall_hashref("SELECT * FROM processing;", 
"pr_inst_host");
       if (not $rv) {
  -        die "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
  +        die "ERROR:$0: DataBase error: ".$dbh->errstr."\n";
       }
       for my $i (sort keys %{$rv}) {
            my ($name, $version, $release) = (%{$rv}->{$i}->{pr_package_name}, 
%{$rv}->{$i}->{pr_package_version}, %{$rv}->{$i}->{pr_package_release});
  @@ -1145,7 +1143,7 @@
                                      "FROM class " .
                                      "ORDER BY cl_package_class;");
       if (not $rv) {
  -        die "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
  +        die "ERROR:$0: DataBase error: ".$dbh->errstr."\n";
       }
   
       my $classpri = {
  @@ -1180,7 +1178,7 @@
       };
       $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";
  +        die "ERROR:$0: DataBase error: ".$dbh->errstr."\n";
       }
   
       my $hostsupport = {};
  @@ -1195,7 +1193,7 @@
                                      "FROM status " .
                                      "ORDER BY st_inst_host, st_inst_arch, 
st_inst_os;");
       if (not $rv) {
  -        die "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
  +        die "ERROR:$0: DataBase error: ".$dbh->errstr."\n";
       }
   
       sub bysupport {
  @@ -1220,7 +1218,7 @@
           ";"
       );
       if (not $sthpackages) {
  -        die "ERROR:$0: SQLite error prepare";
  +        die "ERROR:$0: DataBase error prepare";
       }
   
       $sth = $dbh->prepare(
  @@ -1235,7 +1233,7 @@
           ");"
       );
       if (not $sth) {
  -        die "ERROR:$0: SQLite error prepare";
  +        die "ERROR:$0: DataBase error prepare";
       }
   
       $html = '';
  @@ -1252,7 +1250,7 @@
           my @packages;
           $rv = $sthpackages->execute($class);
           if (not $rv) {
  -            die "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
  +            die "ERROR:$0: DataBase error: ".$dbh->errstr."\n";
           }
           $rv = $sthpackages->fetchall_arrayref();
           foreach my $i (@{$rv}) {
  @@ -1266,7 +1264,7 @@
                   $class
               );
               if (not $rv) {
  -                die "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
  +                die "ERROR:$0: DataBase error: ".$dbh->errstr."\n";
               }
               $rv = $sth->fetchall_arrayref();
               if ($#{$rv} >= 0 ) {
  @@ -1466,11 +1464,11 @@
       if ($#args >= 0) {
           $sth = $dbh->prepare($select);
           if (not $sth) {
  -            die "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
  +            die "ERROR:$0: DataBase error: ".$dbh->errstr."\n";
           }
           $rv = $sth->execute(@args);
           if (not $rv) {
  -            die "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
  +            die "ERROR:$0: DataBase error: ".$dbh->errstr."\n";
           }
           $rv = $sth->fetchall_arrayref({});
       }
  @@ -1538,7 +1536,7 @@
   {
       my ($dbfile) = @_;
       my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile", "", "", { RaiseError 
=> 0, AutoCommit => 1 });
  -    if (not defined $dbh) { die "$0: \"cannot open database file 
\"$dbfile\". SQLite error: ".$dbh->errstr."\n"; }
  +    if (not defined $dbh) { die "$0: \"cannot open database file 
\"$dbfile\". DataBase error: ".$dbh->errstr."\n"; }
   
       my $tables = $dbh->selectall_hashref("SELECT name FROM sqlite_master 
WHERE type='table' ORDER BY name;", "name");
   
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-tools/cmd/src2make.pl
  ============================================================================
  $ cvs diff -u -r1.15 -r1.16 src2make.pl
  --- openpkg-tools/cmd/src2make.pl     3 Oct 2005 11:50:45 -0000       1.15
  +++ openpkg-tools/cmd/src2make.pl     19 Nov 2005 22:06:58 -0000      1.16
  @@ -998,7 +998,7 @@
       my ($dbfile) = @_;
       my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile", "", "", { RaiseError 
=> 0, AutoCommit => 1 });
       if (not defined $dbh) {
  -        print STDERR "ERROR:$0: \"cannot open database file \"$dbfile\". 
SQLite error: ".$dbh->errstr."\n";
  +        print STDERR "ERROR:$0: \"cannot open database file \"$dbfile\". 
DataBase error: ".$dbh->errstr."\n";
           exit(2);
       }
   
  @@ -1037,7 +1037,7 @@
       } while (not $rv and $dbh->errstr =~ m|lock|i and sleep(1) and 
$retries-- >= 1);
       printf STDERR "DEBUG:$0: countdown from %d to %d\n", $lockretries, 
$retries if($debug or $retries != $lockretries);
       if (not $rv) {
  -        print STDERR "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
  +        print STDERR "ERROR:$0: DataBase error: ".$dbh->errstr."\n";
           exit(2);
       }
   }
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     openpkg-cvs@openpkg.org

Reply via email to