From a89b122ebd89a3d16913dbd7a5a56649e58a25d0 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Fri, 8 Dec 2023 14:29:50 +0000 Subject: [PATCH] script for changing compiler name --- scripts/re_cmp_name_system.pl | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 scripts/re_cmp_name_system.pl diff --git a/scripts/re_cmp_name_system.pl b/scripts/re_cmp_name_system.pl new file mode 100755 index 0000000..48d58b3 --- /dev/null +++ b/scripts/re_cmp_name_system.pl @@ -0,0 +1,51 @@ +#!/usr/bin/perl +# Update the compiler name for a system + +use strict; +use warnings; +use DBI; +use Data::Dumper; + +die "Must pass current sysname and new compiler name\n" unless scalar @ARGV == 2; + +use vars qw($dbhost $dbname $dbuser $dbpass $dbport + $user_list_format +); + +use FindBin qw($RealBin); +require "$RealBin/../BuildFarmWeb.pl"; + +die "no dbname" unless $dbname; +die "no dbuser" unless $dbuser; + +my $dsn="dbi:Pg:dbname=$dbname"; +$dsn .= ";host=$dbhost" if $dbhost; +$dsn .= ";port=$dbport" if $dbport; + +my $db = DBI->connect($dsn,$dbuser,$dbpass); + +die $DBI::errstr unless $db; + +my $sth_up = $db->prepare(q[ + UPDATE buildsystems AS b + SET compiler = ? + WHERE name = ? + ]); +$sth_up->execute($ARGV[1],$ARGV[0]); + +my $sth = $db->prepare(q[ + SELECT name, status, compiler, compiler_version, sys_owner, owner_email + FROM buildsystems AS b + ORDER BY name ASC + ]); +$sth->execute(); + +printf $user_list_format, + "SysName", "Status", "Owner", "Email", "Compiler", "Version"; +while (my $row = $sth->fetchrow_hashref) +{ + printf $user_list_format, + $row->{name}, $row->{status}, $row->{sys_owner}, + $row->{owner_email}, $row->{compiler}, $row->{compiler_version}; +} +$db->disconnect(); -- 2.30.2