Skip to content

Commit

Permalink
Merge pull request #253 from markito3/revert_bms_osname_change
Browse files Browse the repository at this point in the history
Go back to commit 7361d7c.
  • Loading branch information
markito3 committed Jul 17, 2022
2 parents e6a3b4f + 1ebfc45 commit beb02b7
Showing 1 changed file with 33 additions and 9 deletions.
42 changes: 33 additions & 9 deletions osrelease.pl
Expand Up @@ -30,6 +30,12 @@
exit;
}

# container tag
$container_tag = "";
if (-d "/.singularity.d" || -f "/.dockerenv") {
$container_tag = "-cntr";
}

# This first section sets the uname and release variables
# which hold the "OS" and "_flavor##" parts of the string.
$uname = `uname`;
Expand Down Expand Up @@ -71,7 +77,27 @@
} elsif ($release_string =~ /^CentOS release 6.*/) {
$release = '_CentOS6';
} elsif ($release_string =~ /^CentOS Linux release 7\.*/) {
$release = '_CentOS7';
if ($release_string !~ /^CentOS Linux release 7\.2/) {
$nodename = `uname -n`;
if ($nodename =~ /.jlab.org$/
&& $container_tag eq ""
&& ($nodename =~ /^farm/
|| $nodename =~ /^ifarm/
|| $nodename =~ /^qcd/
|| $nodename =~ /^sciml/)) {
@token = split(/\s+/, $release_string);
@version = split(/\./, $token[3]);
$version_minor = $version[1];
if ($version_minor == 9) {
$version_minor = 7;
}
$release = "_CentOS7.$version_minor";
} else {
$release = '_CentOS7';
}
} else {
$release = '_CentOS7';
}
} elsif ($release_string =~ /^CentOS Linux release 8\.*/) {
$release = '_CentOS8';
} elsif ($release_string =~ /^CentOS Stream release 8\.*/) {
Expand Down Expand Up @@ -146,15 +172,12 @@
if ($compiler_version_str =~ /\sgcc version\s/) {

$compiler_type = "gcc";
$gccdump = `gcc -dumpversion`;
if (! ($gccdump =~ /\./)) { # if there are no periods in the gcc
$ccversion = `gcc -dumpversion`;
if (! ($ccversion =~ /\./)) { # if there are no periods in the gcc
# version number
$gccdump = `gcc -dumpfullversion`
$ccversion = `gcc -dumpfullversion`
}
chomp $gccdump;
@versions = split(/\./, $gccdump);
$ccversion = $versions[0] . "." . $versions[1];

chomp $ccversion;

} elsif ($compiler_version_str =~ /clang version\s+/) {

Expand Down Expand Up @@ -187,6 +210,7 @@
$ccversion = $`;
}


# Set the processor type
# We fall back to the type reported by uname -p, but only if we
# can't get the type from the cc -v result. The reason is that on
Expand Down Expand Up @@ -215,5 +239,5 @@
}

# Finally, form and print the complete string to stdout
print "${uname}${release}-${processor}-${compiler_version}\n";
print "${uname}${release}-${processor}-${compiler_version}${container_tag}\n";
exit;

0 comments on commit beb02b7

Please sign in to comment.