From 3ef9081b78fe273b3a200eba9f39c19ca39f1e79 Mon Sep 17 00:00:00 2001 From: johnkeis Date: Mon, 3 Feb 2003 03:28:51 +0000 Subject: [PATCH] Administrate a machine --- webtools/tinderbox3/scripts/adminmachine.pl | 92 +++++++++++++++++++++ webtools/tinderbox3/server/adminmachine.pl | 92 +++++++++++++++++++++ 2 files changed, 184 insertions(+) create mode 100755 webtools/tinderbox3/scripts/adminmachine.pl create mode 100755 webtools/tinderbox3/server/adminmachine.pl diff --git a/webtools/tinderbox3/scripts/adminmachine.pl b/webtools/tinderbox3/scripts/adminmachine.pl new file mode 100755 index 00000000000..3e9d53bbf98 --- /dev/null +++ b/webtools/tinderbox3/scripts/adminmachine.pl @@ -0,0 +1,92 @@ +#!/usr/bin/perl -wT -I. + +use CGI; +use Tinderbox3::Header; +use Tinderbox3::DB; +use Tinderbox3::Login; +use strict; + +# +# Init +# +my $p = new CGI; +my $dbh = get_dbh(); +my ($login, $cookie) = check_session($p, $dbh); + +my $tree = $p->param('tree') || ""; + +# For edit_machine +my $machine_id = Tinderbox3::DB::update_machine_action($p, $dbh, $login); + +# Get patch from DB +my $machine_info = $dbh->selectrow_arrayref("SELECT tree_name, machine_name, os, os_version, compiler, clobber, commands, visible FROM tbox_machine WHERE machine_id = ?", undef, $machine_id); +if (!defined($machine_info)) { + die "Could not get machine!"; +} +my ($machine_name, $os, $os_version, $compiler, $clobber, $commands, $visible); +($tree, $machine_name, $os, $os_version, $compiler, $clobber, $commands, $visible) = @{$machine_info}; + +my %machine_config; +my $sth = $dbh->prepare("SELECT name, value FROM tbox_machine_config WHERE machine_id = ?"); +$sth->execute($machine_id); +while (my $row = $sth->fetchrow_arrayref) { + $machine_config{$row->[0]} = $row->[1]; +} + +header($p, $login, $cookie, "Edit Machine $machine_name", $tree, $machine_id, $machine_name); + +# +# Edit patch form +# + +print < + +@{[$p->hidden(-name=>'tree', -default=>$tree)]} +@{[$p->hidden(-name=>'machine_id', -default=>$machine_id)]} + + + + + + + +
Machine Name:@{[$p->escapeHTML($machine_name)]}
OS:@{[$p->escapeHTML("$os $os_version")]}
Compiler:@{[$p->escapeHTML($compiler)]}
Clobber:@{[$clobber ? 'Clobber' : 'Depend']}
Commands@{[$p->textfield(-name=>'commands', -default=>$commands)]}
Visible:
+ +.mozconfig (set to blank to use default):
+ +@{[$p->textarea(-name=>'machine_config0_val', -default=>$machine_config{mozconfig}, -rows=>5, + -columns=>100)]}
+EOM + +print "

Machine Config:
"; +print "(Empty a line to use default for tree)
"; +print "\n"; +my $config_num = 1; +while (my ($var, $value) = each %machine_config) { + if ($var ne "mozconfig") { + print ""; + print "\n"; + $config_num++; + } +} +foreach my $i ($config_num..($config_num+2)) { + print ""; + print "\n"; +} +print "
VarValue
", $p->textfield(-name=>"machine_config$config_num", -default=>$var, -override=>1), "", $p->textfield(-name=>"machine_config${config_num}_val", -default=>$value, -override=>1), "
", $p->textfield(-name=>"machine_config$i", -override=>1), "", $p->textfield(-name=>"machine_config${i}_val", -override=>1), "

\n"; + +if (!$login) { + print login_fields(); +} + +print < + +
@{[$p->hidden(-name => 'tree', -default => $tree, -override => 1)]}@{[$p->hidden(-name => 'action', -default => 'delete_machine', -override => 1)]}@{[$p->hidden(-name => 'machine_id', -default => $machine_id, -override => 1)]} +
+EOM + + +footer($p); +$dbh->disconnect; diff --git a/webtools/tinderbox3/server/adminmachine.pl b/webtools/tinderbox3/server/adminmachine.pl new file mode 100755 index 00000000000..3e9d53bbf98 --- /dev/null +++ b/webtools/tinderbox3/server/adminmachine.pl @@ -0,0 +1,92 @@ +#!/usr/bin/perl -wT -I. + +use CGI; +use Tinderbox3::Header; +use Tinderbox3::DB; +use Tinderbox3::Login; +use strict; + +# +# Init +# +my $p = new CGI; +my $dbh = get_dbh(); +my ($login, $cookie) = check_session($p, $dbh); + +my $tree = $p->param('tree') || ""; + +# For edit_machine +my $machine_id = Tinderbox3::DB::update_machine_action($p, $dbh, $login); + +# Get patch from DB +my $machine_info = $dbh->selectrow_arrayref("SELECT tree_name, machine_name, os, os_version, compiler, clobber, commands, visible FROM tbox_machine WHERE machine_id = ?", undef, $machine_id); +if (!defined($machine_info)) { + die "Could not get machine!"; +} +my ($machine_name, $os, $os_version, $compiler, $clobber, $commands, $visible); +($tree, $machine_name, $os, $os_version, $compiler, $clobber, $commands, $visible) = @{$machine_info}; + +my %machine_config; +my $sth = $dbh->prepare("SELECT name, value FROM tbox_machine_config WHERE machine_id = ?"); +$sth->execute($machine_id); +while (my $row = $sth->fetchrow_arrayref) { + $machine_config{$row->[0]} = $row->[1]; +} + +header($p, $login, $cookie, "Edit Machine $machine_name", $tree, $machine_id, $machine_name); + +# +# Edit patch form +# + +print < + +@{[$p->hidden(-name=>'tree', -default=>$tree)]} +@{[$p->hidden(-name=>'machine_id', -default=>$machine_id)]} + + + + + + + +
Machine Name:@{[$p->escapeHTML($machine_name)]}
OS:@{[$p->escapeHTML("$os $os_version")]}
Compiler:@{[$p->escapeHTML($compiler)]}
Clobber:@{[$clobber ? 'Clobber' : 'Depend']}
Commands@{[$p->textfield(-name=>'commands', -default=>$commands)]}
Visible:
+ +.mozconfig (set to blank to use default):
+ +@{[$p->textarea(-name=>'machine_config0_val', -default=>$machine_config{mozconfig}, -rows=>5, + -columns=>100)]}
+EOM + +print "

Machine Config:
"; +print "(Empty a line to use default for tree)
"; +print "\n"; +my $config_num = 1; +while (my ($var, $value) = each %machine_config) { + if ($var ne "mozconfig") { + print ""; + print "\n"; + $config_num++; + } +} +foreach my $i ($config_num..($config_num+2)) { + print ""; + print "\n"; +} +print "
VarValue
", $p->textfield(-name=>"machine_config$config_num", -default=>$var, -override=>1), "", $p->textfield(-name=>"machine_config${config_num}_val", -default=>$value, -override=>1), "
", $p->textfield(-name=>"machine_config$i", -override=>1), "", $p->textfield(-name=>"machine_config${i}_val", -override=>1), "

\n"; + +if (!$login) { + print login_fields(); +} + +print < + +
@{[$p->hidden(-name => 'tree', -default => $tree, -override => 1)]}@{[$p->hidden(-name => 'action', -default => 'delete_machine', -override => 1)]}@{[$p->hidden(-name => 'machine_id', -default => $machine_id, -override => 1)]} +
+EOM + + +footer($p); +$dbh->disconnect;