Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for STAR-CCM+ installs with .aol installer #3510

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 59 additions & 12 deletions easybuild/easyblocks/s/star_ccm.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@
"""
import os
import tempfile
import stat

import easybuild.tools.environment as env
from easybuild.framework.easyblock import EasyBlock
from easybuild.tools.config import build_option
from easybuild.tools.filetools import change_dir, find_glob_pattern
from easybuild.tools.filetools import change_dir, find_glob_pattern, adjust_permissions, copy_file
from easybuild.tools.run import run_cmd


Expand All @@ -46,6 +47,26 @@ def __init__(self, *args, **kwargs):
self.starccm_subdir = None
self.starview_subdir = None

# adding an extract_step to support Siemens distributions with extension .aol
def extract_step(self):
# Siemens distributions are tarballs or executables with .aol extension
if self.src[0]['name'].endswith('.aol'):
self.aol_install = True
Copy link
Contributor

@appolloford appolloford Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The source file we got from users is still a tarball file. Maybe this variable can be set by version instead of extension name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should still work for tarballs. It doesn't for you? I'm not sure how Siemens is planning to distribute this (I'm not even sure how they do it now), the idea is that this supports both tarballs and .aol

Copy link
Contributor

@appolloford appolloford Feb 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested with my STAR-CCM easyconfig: (easybuilders/easybuild-easyconfigs#21911) and it looks trying to look for .sh file

$ eb --include-easyblocks-from-pr 3510 STAR-CCM+-19.06.008.eb --rebuild
== Temporary log file in case of crash /dev/shm/eb-4a0mvwcb/easybuild-zfxp_n4p.log
== easyblock star_ccm.py included from PR #3510
== processing EasyBuild easyconfig /apps/c3se-test-easyconfigs/STAR-CCM+-19.06.008.eb
== building and installing STAR-CCM+/19.06.008...
...
FAILED: Installation ended unsuccessfully (build directory: /dev/shm/STARCCM/19.06.008/system-system): build failed (first 300 chars): Was expecting exactly one
match for './STAR-CCM+19.06.008_*.sh', found 0: [] (took 1 min 30 secs)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just adding that this didn't work for me either (STAR-CCM+/19.06.009 from a source tarball containing a .aol installer).

Copy link
Contributor Author

@WilleBell WilleBell Feb 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MaximeVdB The source you have is a tarball containing (only) a .aol file? (I didn't come across that type of source file)
@appolloford Is that the case for your tarball too?
The changes in this PR should only have effect if the source is .aol, so they must have changed their tarballs (?).
Unfortunatelly, I only have a tarball for 18.06.007 to test and it works for that one.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are the content of my tarball

$ ls starccm+_19.06.008/
STAR-CCM+2410_008_linux-x86_64-2.28_gnu11.4.aol  doc  fnp_LicAdmin.pdf

else:
self.aol_install = False

if self.aol_install:
# required for correctly guessing start directory
self.src[0]['finalpath'] = self.builddir

# copy the .aol to build dir
for source in self.src:
dst = os.path.join(self.builddir, source['name'])
copy_file(source['path'], dst)
adjust_permissions(dst, stat.S_IRWXU, add=True)
else:
EasyBlock.extract_step(self)

def configure_step(self):
"""No configuration procedure for STAR-CCM+."""
pass
Expand All @@ -57,7 +78,11 @@ def build_step(self):
def install_step(self):
"""Custom install procedure for STAR-CCM+."""

install_script_pattern = "./STAR-CCM+%s_*.sh" % self.version
if self.aol_install:
install_script_pattern = "./STAR-CCM+*.aol"
else:
install_script_pattern = "./STAR-CCM+%s_*.sh" % self.version

if self.dry_run:
install_script = install_script_pattern
else:
Expand All @@ -69,15 +94,33 @@ def install_step(self):

env.setvar('IATEMPDIR', tempfile.mkdtemp())

cmd = ' '.join([
self.cfg['preinstallopts'],
install_script,
"-i silent",
"-DINSTALLDIR=%s" % self.installdir,
"-DINSTALLFLEX=false",
"-DADDSYSTEMPATH=false",
self.cfg['installopts'],
])
# argument -DINSTALLFLEX is -DINSTALL_LICENSING for the .aol installer
if self.aol_install:
cmd = ' '.join([
self.cfg['preinstallopts'],
# The install_script installs also the Siemens Installer Program (SIP)
# under $HOME, this is not need to run STAR-CCM+
'HOME=%s' % self.builddir,
install_script,
"-i silent",
# for some reason the installation directory's name cannot be the version
# So using builddir and then moving to installdir
"-DINSTALLDIR=%s" % self.builddir,
"-DINSTALL_LICENSING=false",
"-DADDSYSTEMPATH=false",
self.cfg['installopts'],
"&& mv %s/%s* %s" % (self.builddir, self.version, self.installdir),
])
else:
cmd = ' '.join([
self.cfg['preinstallopts'],
install_script,
"-i silent",
"-DINSTALLDIR=%s" % self.installdir,
"-DINSTALLFLEX=false",
"-DADDSYSTEMPATH=false",
self.cfg['installopts'],
])

# ignore exit code of command, since there's always a non-zero exit if $CHECK_DISK_SPACE is set to OFF;
# rely on sanity check to catch problems with the installation
Expand Down Expand Up @@ -115,7 +158,11 @@ def sanity_check_step(self):
os.path.join(self.installdir, self.starview_subdir, 'bin', 'starview+')],
'dirs': [],
}
super(EB_STAR_minus_CCM_plus_, self).sanity_check_step(custom_paths=custom_paths)
custom_commands = ["starccm+ --help 2>&1 | grep 'Usage: '"]
super(EB_STAR_minus_CCM_plus_, self).sanity_check_step(
custom_paths=custom_paths,
custom_commands=custom_commands
)

def make_module_extra(self):
"""Extra statements specific to STAR-CCM+ to include in generated module file."""
Expand Down