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: 17-Feb-2005 11:00:26
Branch: HEAD Handle: 2005021710002600
Modified files:
openpkg-tools/cmd bf-db.pl
Log:
modify amendment logic to fill in color for previously missing
records, too
Summary:
Revision Changes Path
1.11 +48 -24 openpkg-tools/cmd/bf-db.pl
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-tools/cmd/bf-db.pl
============================================================================
$ cvs diff -u -r1.10 -r1.11 bf-db.pl
--- openpkg-tools/cmd/bf-db.pl 11 Feb 2005 15:35:13 -0000 1.10
+++ openpkg-tools/cmd/bf-db.pl 17 Feb 2005 10:00:26 -0000 1.11
@@ -255,23 +255,63 @@
exit(2);
}
}
- else {
- if ($amend) {
- printf STDERR "amendment for inst=%s, package=%s skipped\n",
$inst, $package;
- return;
- }
+ elsif ($sth->rows > 1) {
+ printf STDERR "internal application problem getting %d rows
where only 0 or 1 expected\n", $sth->rows;
+ exit(2);
}
}
if (defined $color) {
+ unless ($amend) {
+ $sth = $dbh->prepare(
+ "UPDATE status SET st_build_end = ?, st_build_color = ?
WHERE ( " .
+ " st_inst_host = ? and st_inst_arch = ? and st_inst_os =
? and st_inst_tag = ? and " .
+ " st_package_name = ? );"
+ );
+ $retries = $lockretries; do {
+ $rv = $sth->execute(
+ $time, $color,
+ $host, $arch, $os, $tag,
+ $name
+ );
+ } 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);
+ if (not $rv) {
+ print STDERR "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
+ exit(2);
+ }
+ }
+ else {
+ $sth = $dbh->prepare(
+ "UPDATE status SET st_build_color = ? WHERE ( " .
+ " st_inst_host = ? and st_inst_arch = ? and st_inst_os =
? and st_inst_tag = ? and " .
+ " st_package_name = ? );"
+ );
+ $retries = $lockretries; do {
+ $rv = $sth->execute(
+ $color,
+ $host, $arch, $os, $tag,
+ $name
+ );
+ } 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);
+ if (not $rv) {
+ print STDERR "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
+ exit(2);
+ }
+ printf STDERR "amendment for inst=%s, package=%s completed, time
untouched, set color=%s\n", $inst, $package, $color;
+ return;
+ }
+ }
+ else {
$sth = $dbh->prepare(
- "UPDATE status SET st_build_end = ?, st_build_color = ? WHERE (
" .
+ "UPDATE status SET st_build_end = ? WHERE ( " .
" st_inst_host = ? and st_inst_arch = ? and st_inst_os = ?
and st_inst_tag = ? and " .
" st_package_name = ? );"
);
$retries = $lockretries; do {
$rv = $sth->execute(
- $time, $color,
+ $time,
$host, $arch, $os, $tag,
$name
);
@@ -282,26 +322,10 @@
exit(2);
}
if ($amend) {
- printf STDERR "amendment for inst=%s, package=%s completed, set
color=%s\n", $inst, $package, $color;
+ printf STDERR "amendment for inst=%s, package=%s completed, set
time, color untouched\n", $inst, $package;
return;
}
}
- else {
- $sth = $dbh->prepare(
- "UPDATE status SET st_build_end = ? WHERE ( " .
- " st_inst_host = ? and st_inst_arch = ? and st_inst_os = ?
and st_inst_tag = ? and " .
- " st_package_name = ? );"
- );
- $rv = $sth->execute(
- $time,
- $host, $arch, $os, $tag,
- $name
- );
- }
- if (not $rv) {
- print STDERR "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
- exit(2);
- }
$sth = $dbh->prepare(
"INSERT INTO processing ( " .
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [email protected]