mirror of
https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git
synced 2024-12-28 05:03:09 +00:00
Save progress, might be working.
This commit is contained in:
parent
d5bbba8120
commit
0d1268cd57
@ -20,11 +20,11 @@ sub run {
|
|||||||
|
|
||||||
# We will fetch the version data from various locations.
|
# We will fetch the version data from various locations.
|
||||||
# Download data from Bodhi for
|
# Download data from Bodhi for
|
||||||
assert_script_run("curl -o bodhi-$current.json https://bodhi.fedoraproject.org/releases/F$current");
|
|
||||||
assert_script_run("curl -o bodhi-$target.json https://bodhi.fedoraproject.org/releases/F$target");
|
assert_script_run("curl -o bodhi-$target.json https://bodhi.fedoraproject.org/releases/F$target");
|
||||||
# Download data from Fedora Schedule
|
# Download data from Fedora Schedule
|
||||||
assert_script_run("curl -o schedule-$current.json https://fedorapeople.org/groups/schedule/f-$current/f-$current-key.json");
|
|
||||||
assert_script_run("curl -o schedule-$target.json https://fedorapeople.org/groups/schedule/f-$target/f-$target-key.json");
|
assert_script_run("curl -o schedule-$target.json https://fedorapeople.org/groups/schedule/f-$target/f-$target-key.json");
|
||||||
|
# Install jq to modify the downloaded jsons and make sure, they will be correctly formed.
|
||||||
|
assert_script_run("dnf install -y jq", timeout => 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub test_flags {
|
sub test_flags {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use base "installedtest";
|
use base "installedtest";
|
||||||
use strict;
|
use strict;
|
||||||
use JSON::PP;
|
use JSON;
|
||||||
use Time::Piece;
|
use Time::Piece;
|
||||||
use testapi;
|
use testapi;
|
||||||
use utils;
|
use utils;
|
||||||
@ -18,10 +18,10 @@ sub json_to_hash {
|
|||||||
# This will convert a Json string into a valid
|
# This will convert a Json string into a valid
|
||||||
# Perl hash for further processing.
|
# Perl hash for further processing.
|
||||||
my $json = shift;
|
my $json = shift;
|
||||||
my $hash;
|
# The file is transferred via openQA methods and it basically
|
||||||
eval {
|
# is a string with \n symbols in it, which does not
|
||||||
my $hash = JSON::PP->new->utf8->decode($json);
|
# make it a valid json file. First, we need to remove these.
|
||||||
};
|
my $hash = decode_json($json);
|
||||||
die("Failed to parse JSON: $@") if ($@);
|
die("Failed to parse JSON: $@") if ($@);
|
||||||
return $hash;
|
return $hash;
|
||||||
}
|
}
|
||||||
@ -50,7 +50,7 @@ sub get_bodhi_eol {
|
|||||||
# date should be returned.
|
# date should be returned.
|
||||||
my $ver = shift;
|
my $ver = shift;
|
||||||
# The content of the downloaded file is a JSON string.
|
# The content of the downloaded file is a JSON string.
|
||||||
my $json = script_output("cat ~/version_data/bodhi-$ver.json");
|
my $json = script_output("cat ~/version_data/bodhi-$ver.json | jq -c");
|
||||||
my $bodhi = json_to_hash($json);
|
my $bodhi = json_to_hash($json);
|
||||||
my $eol = $bodhi->{"eol"};
|
my $eol = $bodhi->{"eol"};
|
||||||
$eol = date_to_epoch($eol);
|
$eol = date_to_epoch($eol);
|
||||||
@ -63,22 +63,21 @@ sub get_schedule_eol {
|
|||||||
# the EOL date from that file. As argument, it takes the version
|
# the EOL date from that file. As argument, it takes the version
|
||||||
# number from which the EOL date should be returned.
|
# number from which the EOL date should be returned.
|
||||||
my $ver = shift;
|
my $ver = shift;
|
||||||
my $json = script_output("cat ~/version_data/schedule-$ver.json");
|
my $json = script_output("cat ~/version_data/schedule-$ver.json | jq -c");
|
||||||
my $schedule = json_to_hash($json);
|
my $schedule = json_to_hash($json);
|
||||||
my $eol;
|
my $eol;
|
||||||
# The format of the json is quite complicated, so we need to do
|
# The format of the json is quite complicated, so a lot of magic is necessary to come onto the EOL date inside, especially
|
||||||
# quite a lot of magic to arrive at the correct date, so let's
|
# when some parts are placed in a list and Perl complains about incorrect HASH reference.
|
||||||
# hope the format stays the same in the future.
|
# However, I realized that it also has a field "end" just at the top structure which has the same value.
|
||||||
# FIXME parsing the tasks
|
my $tasks = $schedule->{'tasks'}[0]{'tasks'}[0]{'tasks'};
|
||||||
my $tasks = $json->{tasks}[0]{tasks}[0]{tasks};
|
|
||||||
my $eol;
|
my $eol;
|
||||||
|
|
||||||
foreach my $task (@$tasks) {
|
foreach my $task (@$tasks) {
|
||||||
if ($task->{name} && $task->{name} =~ /End of Life/) {
|
if ($task->{'name'} and $task->{'name'} =~ /End of Life/) {
|
||||||
$eol = $task->{end};
|
$eol = $task->{'end'};
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# The EOL date is provided as an epoch, so just return it.
|
# The EOL date is provided as an epoch, so just return it.
|
||||||
return $eol;
|
return $eol;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user