-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemare_subject_create
executable file
·75 lines (59 loc) · 3.49 KB
/
temare_subject_create
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env perl
use strict;
use warnings;
use Net::FTP;
use 5.010;
# die "Broken! FTP links are not set correctly. Please fix and reactivate!\n";
$ENV{PATH} = "$ENV{PATH}:."; # temare calls look nicer
my @distros = ('sles-10.3','sles-11.1');
my $autoinstall_path = '/data/tapper/live/configs/autoinstall';
my $state = 'testing';
DISTRO:
foreach my $distro ( @distros ) {
my ($subject, $version) = split "-", $distro;
if (not ($subject and $version)) {
warn "$distro is not a valid distribution name in the form name-version";
next DISTRO;
}
my ($main_version, undef) = split /\./, $version;
my @paths = qx(find $autoinstall_path/stable/$subject/$main_version/ -type f);
my %tests;
foreach my $path ( @paths ) {
my ($bitness, $test) = $path =~ m"$autoinstall_path/stable/$subject/$main_version/([^/]+)/([^/]+)\.xml";
my $temare_subject = "autoinstall-$subject$main_version-$test";
next if $test eq 'bare';
$temare_subject .= "-32" if $bitness =~ m'i\d86'; # usually i386 but we also want to catch i686
my $kernel;
$kernel = "/tftpboot/$state/$subject/$version/$bitness/vmlinuz" if -e "/tftpboot/$state/$subject/$version/$bitness/vmlinuz";
$kernel = "/tftpboot/$state/$subject/$version/$bitness/linux" if -e "/tftpboot/$state/$subject/$version/$bitness/linux";
$tests{$temare_subject} = {
ks_file => "http://bancroft/autoinstall/$state/$subject/$version/$bitness/$test.xml",
initrd => "/tftpboot/$state/$subject/$version/$bitness/initrd",
kernel => $kernel,
};
if ($subject =~ m"suse|sles"i) {
my $ftp = Net::FTP->new("osko", Debug => 0)
or (warn"Cannot connect to osko: $@\n", next DISTRO);
$ftp->login("anonymous",'[email protected]')
or (warn("Cannot login ", $ftp->message, "\n"), next DISTRO);
if ($ftp->ls("/testing/$subject/$version/$bitness/")) {
$tests{$temare_subject}->{install} = "ftp://osko/testing/$subject/$version/$bitness/";
} else {
warn("Can not find installer for $temare_subject\n");
next DISTRO;
}
}
my $cmd = "temare subjectadd $temare_subject ";
$cmd .= $bitness eq 'x86_64' ? '64' : '32';
say($cmd);
while (my ($key, $value) = each %{$tests{$temare_subject}}) {
say("temare completionadd $temare_subject $key $value");
}
$cmd = "temare subjectstate $temare_subject ";
$cmd .= $bitness eq 'x86_64' ? '64' : '32';
say("$cmd enable");
}
}
print "Use these lines to add create Tapper testruns. Adapt the awk regex accordingly:\n\n";
print q(for queue in $(./temare subjectlist | awk '/opensuse|sles/ {print $2}'); do tapper-testrun newqueue --name $queue --priority 300 --active ; done),"\n";
print q(./temare subjectlist |awk '/opensuse|sles/ {printf "tapper-testrun new --queue=%s --macroprecond=/tmp/autoinstall.yml -Dsubject=%s -Dbitness=%s\n",$2,$2,$4}' | bash),"\n";