scripts for local updates of animals
authorJeremy Harris <jgh@wizmail.org>
Tue, 1 Nov 2022 13:21:21 +0000 (13:21 +0000)
committerJeremy Harris <jgh@wizmail.org>
Tue, 1 Nov 2022 13:21:21 +0000 (13:21 +0000)
scripts/re_cmp_version_system.pl [new file with mode: 0644]
scripts/re_os_version_system.pl [new file with mode: 0644]

diff --git a/scripts/re_cmp_version_system.pl b/scripts/re_cmp_version_system.pl
new file mode 100644 (file)
index 0000000..8defd41
--- /dev/null
@@ -0,0 +1,51 @@
+#!/usr/bin/perl
+# Update the ompiler version for a system
+
+use strict;
+use warnings;
+use DBI;
+use Data::Dumper;
+
+die "Must pass current sysname and new version-string\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_version = ?
+       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();
diff --git a/scripts/re_os_version_system.pl b/scripts/re_os_version_system.pl
new file mode 100644 (file)
index 0000000..8dd6634
--- /dev/null
@@ -0,0 +1,52 @@
+#!/usr/bin/perl
+# Update the OS version for a system
+
+use strict;
+use warnings;
+use DBI;
+use Data::Dumper;
+
+die "Must pass current sysnames and new version-string\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 os_version = ?
+       WHERE name = ?
+      ]);
+$sth_up->execute($ARGV[1],$ARGV[0]);
+
+my $sth = $db->prepare(q[ 
+       SELECT name, status, operating_system, os_version, sys_owner, owner_email
+       FROM buildsystems AS b
+       ORDER BY name ASC
+      ]);
+$sth->execute();
+
+printf $user_list_format,
+       "SysName", "Status", "Owner", "Email", "Distro", "Version";
+while (my $row = $sth->fetchrow_hashref)
+{
+  printf $user_list_format,
+                  $row->{name}, $row->{status}, $row->{sys_owner},
+                  $row->{owner_email}, $row->{operating_system},
+                  $row->{os_version};
+}
+$db->disconnect();