Skip to content

Commit

Permalink
Merge pull request #75 from perftool-incubator/dev-kmr
Browse files Browse the repository at this point in the history
Dev kmr
  • Loading branch information
k-rister authored Feb 16, 2023
2 parents 7eac4f7 + c007b02 commit c0d7f10
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 2 deletions.
24 changes: 23 additions & 1 deletion schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
"enum": [
"2020.03.02",
"2020.04.30",
"2022.07.25"
"2022.07.25",
"2023.02.16"
]
}
},
Expand Down Expand Up @@ -119,6 +120,27 @@
"properties": {
"type": "object",
"properties": {
"platform": {
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"type": "object",
"properties": {
"architecture": {
"type": "string",
"enum": [
"x86_64",
"aarch64"
]
}
},
"required": [
"architecture"
],
"additionalProperties": false
}
},
"packages": {
"type": "object",
"properties": {
Expand Down
10 changes: 9 additions & 1 deletion userenvs/fedora36-ci.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"workshop": {
"schema": {
"version": "2020.03.02"
"version": "2023.02.16"
}
},
"userenv": {
Expand All @@ -12,6 +12,14 @@
"tag": "36"
},
"properties": {
"platform": [
{
"architecture": "x86_64"
},
{
"architecture": "aarch64"
}
],
"packages": {
"type": "rpm",
"manager": "dnf"
Expand Down
39 changes: 39 additions & 0 deletions workshop.pl
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ sub get_exit_code {
'no_label' => 92,
'package_remove' => 93,
'group_remove' => 94,
'architecture_query_failed' => 95,
'unsupported_platform_architecture' => 96
);

if (exists($reasons{$exit_reason})) {
Expand Down Expand Up @@ -579,6 +581,43 @@ sub delete_proto {
}
}

if (exists $userenv_json->{'userenv'}{'properties'}{'platform'}) {
# the userenv has platform information that indicates what type of
# system architecture(s) it supports so validate that what we are
# about to build is supported
my $my_architecture;
logger('info', "performing userenv platform validation...\n", 1);
($command, $command_output, $rc) = run_command("uname -m");
if ($rc == 0) {
command_logger('verbose', $command, $rc, $command_output);
$command_output = filter_output($command_output);
chomp($command_output);
$my_architecture = $command_output;
logger('info', "found current system architecture is " . $my_architecture . "\n", 2);
} else {
logger('info', "failed\n", 2);
command_logger('error', $command, $rc, $command_output);
logger('error', "Failed to obtain the current system architecture!\n");
exit(get_exit_code('architecture_query_failed'));
}

my $supported = 0;
# loop through the supported platforms and see if our architecture matches one of them
foreach my $platform (@{$userenv_json->{'userenv'}{'properties'}{'platform'}}) {
if ($platform->{'architecture'} eq $my_architecture) {
$supported = 1;
}
}

if ($supported) {
logger('info', "succeeded...the userenv is supported for my architecture.\n", 2);
} else {
logger('info', "failed...the userenv is not supported for my architecture.\n", 2);
logger('error', "The userenv is not supported for my architecure.\n");
exit(get_exit_code('unsupported_platform_architecture'));
}
}

if (!defined $args{'proj'}) {
if (defined $args{'label'}) {
# Support default behavior before --proj was introduced
Expand Down

0 comments on commit c0d7f10

Please sign in to comment.