OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Thomas Lotterer
Root: /e/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-tools Date: 11-Feb-2005 16:35:13
Branch: HEAD Handle: 2005021115351300
Modified files:
openpkg-tools/cmd bf-db.pl bf-mk.pl
Log:
add support table to track importance grace of instances
Summary:
Revision Changes Path
1.10 +57 -5 openpkg-tools/cmd/bf-db.pl
1.19 +17 -0 openpkg-tools/cmd/bf-mk.pl
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-tools/cmd/bf-db.pl
============================================================================
$ cvs diff -u -r1.9 -r1.10 bf-db.pl
--- openpkg-tools/cmd/bf-db.pl 11 Feb 2005 15:27:28 -0000 1.9
+++ openpkg-tools/cmd/bf-db.pl 11 Feb 2005 15:35:13 -0000 1.10
@@ -52,6 +52,7 @@
my $opt_help = 0;
my $opt_verbose = 0;
my $opt_color = undef;
+my $opt_support = undef;
my $opt_inst = undef;
my $opt_package = undef;
@@ -66,6 +67,7 @@
print "$progname:$level: Usage: $progname [common options][[specific
options] command]\n" .
"Available options:\n" .
" -c|color=s color (red|green)\n" .
+ " -s|support=s support
(deprecated|obsoleted|supported|tentative|forecasted)\n" .
" -i|inst=s instance (<host>-<arch>-<os>-<tag>)\n" .
" -p|package=s package (<name>-<version>-<release>)\n" .
" -H|help print out this usage page\n" .
@@ -74,7 +76,8 @@
"Available commands:\n" .
" begin log beginning of build for instance and
package\n" .
" end log end and color of build for instance and
package\n" .
- " amend log end and color only if entry currently
missing\n";
+ " amend log end and color only if entry currently
missing\n" .
+ " support set support grade for instance\n";
exit(1) if (defined $level);
exit(0);
}
@@ -86,6 +89,7 @@
Getopt::Long::Configure("bundling");
my $result = GetOptions(
'c|color=s' => \$opt_color,
+ 's|support=s' => \$opt_support,
'i|inst=s' => \$opt_inst,
'p|package=s' => \$opt_package,
'C|config=s' => \$opt_config,
@@ -101,10 +105,11 @@
my $lockretries = $cfg->{"master"}->{"lockretries"} || 250;
my $dbh = &dbinit($dbfile);
-if ( $ARGV[0] =~ m|^init$| ) { }
-elsif ( $ARGV[0] =~ m|^begin$| ) { &status_begin($opt_inst, $opt_package); }
-elsif ( $ARGV[0] =~ m|^end$| ) { &status_end ($opt_inst, $opt_package,
$opt_color, 0); }
-elsif ( $ARGV[0] =~ m|^amend$| ) { &status_end ($opt_inst, $opt_package,
$opt_color, 1); }
+if ( $ARGV[0] =~ m|^init$| ) { }
+elsif ( $ARGV[0] =~ m|^begin$| ) { &status_begin ($opt_inst,
$opt_package); }
+elsif ( $ARGV[0] =~ m|^end$| ) { &status_end ($opt_inst, $opt_package,
$opt_color, 0); }
+elsif ( $ARGV[0] =~ m|^amend$| ) { &status_end ($opt_inst, $opt_package,
$opt_color, 1); }
+elsif ( $ARGV[0] =~ m|^support$| ) { &support ($opt_inst,
$opt_support); }
else { &usage(); }
$dbh->disconnect();
undef $dbh;
@@ -320,6 +325,36 @@
}
+sub support ($$)
+{
+ my ($inst, $support) = @_;
+ my ($host, $arch, $os, $tag) = &splitinst($inst);
+ my ($sth, $rv, $retries);
+ printf STDERR "DEBUG:$0: support(%s, %s) host=%s, arch=%s, os=%s,
tag=%s;\n", $inst, $support, $host, $arch, $os, $tag if ($opt_verbose);
+
+ if (not $support =~
m/^(deprecated|obsoleted|supported|tentative|forecasted)$/) {
+ die "support must be one of \"deprecated\", \"obsoleted\",
\"supported\", \"tentative\", \"forecasted\"";
+ }
+
+ $sth = $dbh->prepare(
+ "INSERT INTO support ( " .
+ " su_inst_host, su_inst_arch, su_inst_os, su_inst_tag, " .
+ " su_support ) " .
+ "VALUES ( ?, ?, ?, ?, ? );"
+ );
+ $retries = $lockretries; do {
+ $rv = $sth->execute(
+ $host, $arch, $os, $tag,
+ $support
+ );
+ } 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);
+ }
+}
+
# open/create database and create all missing tables on the fly
sub dbinit ($)
{
@@ -378,6 +413,23 @@
$dbh->do($sql);
};
+ unless ($tables->{support}) {
+ printf STDERR "DEBUG:$0: creating \"support\" table in database file
\"%s\"\n", $dbfile if ($opt_verbose);
+ my $sql = '';
+ $sql .= "CREATE TABLE support"; # field
description | example
+ $sql .= "(\n"; #
-----------------------------------+-----------
+ $sql .= " su_inst_host TEXT NOT NULL,\n"; # 1st p.
PLATFORM in Makefile.rules | bsd1
+ $sql .= " su_inst_arch TEXT NOT NULL,\n"; # 2st p.
PLATFORM in Makefile.rules | ix86
+ $sql .= " su_inst_os TEXT NOT NULL,\n"; # 3rd p.
PLATFORM in Makefile.rules | freebsd5.3
+ $sql .= " su_inst_tag TEXT NOT NULL,\n"; # 4th p.
PLATFORM in Makefile.rules | openpkg
+ $sql .= " su_support TEXT,\n"; #
deprecated|obsoleted | supported
+ # supported
+ #
tentative|forecasted
+ $sql .= "PRIMARY KEY ( su_inst_host, su_inst_tag ) ON CONFLICT
REPLACE\n";
+ $sql .= ");\n";
+ $dbh->do($sql);
+ };
+
return $dbh;
}
@@ .
patch -p0 <<'@@ .'
Index: openpkg-tools/cmd/bf-mk.pl
============================================================================
$ cvs diff -u -r1.18 -r1.19 bf-mk.pl
--- openpkg-tools/cmd/bf-mk.pl 11 Feb 2005 15:33:45 -0000 1.18
+++ openpkg-tools/cmd/bf-mk.pl 11 Feb 2005 15:35:13 -0000 1.19
@@ -536,6 +536,21 @@
)
}
+cmd_support ()
+{
+ %{driver.shtool} echo -e "%B++ [EMAIL PROTECTED]:%{shared.prefix}: set
support identifiation for SLAVE%b"
+ support=""
+ [ ".$1" = .deprecated -o ".$1" = .deprecate -o ".$1" = .deprecat -o
".$1" = .depreca -o ".$1" = .deprec -o ".$1" = .depre -o ".$1" = .depr -o ".$1"
= .dep -o ".$1" = .de -o ".$1" = .d ] && support="deprecated"
+ [ ".$1" = .obsoleted -o ".$1" = .obsolete -o ".$1" = .obsolet -o ".$1" =
.obsole -o ".$1" = .obsol -o ".$1" = .obso -o ".$1" = .obs -o ".$1" = .ob -o
".$1" = .o ] && support="obsoleted"
+ [ ".$1" = .supported -o ".$1" = .supporte -o ".$1" = .support -o ".$1" =
.suppor -o ".$1" = .suppo -o ".$1" = .supp -o ".$1" = .sup -o ".$1" = .su -o
".$1" = .s ] && support="supported"
+ [ ".$1" = .tentative -o ".$1" = .tentativ -o ".$1" = .tentati -o ".$1" =
.tentat -o ".$1" = .tenta -o ".$1" = .tent -o ".$1" = .ten -o ".$1" = .te -o
".$1" = .t ] && support="tentative"
+ [ ".$1" = .forecasted -o ".$1" = .forecaste -o ".$1" = .forecast -o
".$1" = .forecas -o ".$1" = .foreca -o ".$1" = .forec -o ".$1" = .fore -o ".$1"
= .for -o ".$1" = .fo -o ".$1" = .f ] && support="forecasted"
+ if [ ".$support" = . ]; then
+ die "support must be one of \"deprecated\", \"obsoleted\",
\"supported\", \"tentative\", \"forecasted\""
+ fi
+ %{slaves.bfdb} -i $HOST-$ARCH-$OS-$TAG -s $support support
+}
+
cmd_amend ()
{
createslavestructure
@@ -571,6 +586,7 @@
echo " -l|loop run slave in a loop"
echo " -H|help print out this usage page"
echo " -A|amend amend slave packages"
+ echo " -s|support set support grade"
echo "Notes on slave mode"
echo " with -[1l] the application executes the SLAVE role"
echo "To reconfigure settings, change bf.conf on the MASTER"
@@ -617,6 +633,7 @@
if [ ".$TERM" = .screen ]; then %{driver.shtool} echo -n
"k$HOST-$ARCH-$OS\\"; fi
cmd=""
+if [ ".$1" = ".-s" -o ".$1" = ".--support" ]; then shift; cmd="support"; fi
if [ ".$1" = ".-1" -o ".$1" = ".--oneshot" ]; then shift; cmd="oneshot"; fi
if [ ".$1" = ".-l" -o ".$1" = ".--loop" ]; then shift; cmd="loop"; fi
if [ ".$1" = ".-A" -o ".$1" = ".--amend" ]; then shift; cmd="amend"; fi
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [email protected]