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
Make FDTD_Solutions easyblock do the install with copytree instead of rpm rebuild #1307
Changes from 5 commits
8194ae8
1eb434a
66d5d2e
f22225d
4c6ac06
b29e67e
ef4a4df
9db1b06
351a3af
5a2ff78
e8d41fb
bdadd97
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,64 +33,39 @@ | |
from easybuild.easyblocks.generic.packedbinary import PackedBinary | ||
from easybuild.easyblocks.generic.rpm import rebuild_rpm | ||
from easybuild.tools.build_log import EasyBuildError | ||
from easybuild.tools.run import run_cmd_qa | ||
from easybuild.tools.filetools import rmtree2 | ||
from easybuild.tools.run import run_cmd, run_cmd_qa | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'easybuild.tools.run.run_cmd_qa' imported but unused |
||
|
||
|
||
class EB_FDTD_underscore_Solutions(PackedBinary): | ||
"""Support for building/installing FDTD Solutions.""" | ||
|
||
def build_step(self): | ||
"""No build step for FDTD Solutions.""" | ||
# locate RPM and rebuild it to make it relocatable | ||
rpms = glob.glob(os.path.join(self.cfg['start_dir'], 'rpm_install_files', 'FDTD-%s*.rpm' % self.version)) | ||
def extract_step(self): | ||
""" | ||
After unpacking the main tar file, we need to unpack the rpm | ||
inside it. | ||
""" | ||
super(EB_FDTD_underscore_Solutions, self).extract_step() | ||
|
||
rpms = glob.glob(os.path.join(self.src[0]['finalpath'], 'rpm_install_files', 'FDTD-%s*.rpm' % self.version)) | ||
if len(rpms) != 1: | ||
raise EasyBuildError("Incorrect number of RPMs found, was expecting exactly one: %s", rpms) | ||
rebuilt_dir = os.path.join(self.cfg['start_dir'], 'rebuilt') | ||
rebuild_rpm(rpms[0], rebuilt_dir) | ||
cmd = "rpm2cpio %s | cpio -idm " % rpms[0] | ||
run_cmd(cmd, log_all=True, simple=True) | ||
|
||
# replace original RPM with relocatable RPM | ||
rebuilt_rpms = glob.glob(os.path.join(rebuilt_dir, '*', '*.rpm')) | ||
if len(rebuilt_rpms) != 1: | ||
raise EasyBuildError("Incorrect number of rebuilt RPMs found, was expecting exactly one: %s", rebuilt_rpms) | ||
|
||
try: | ||
os.rename(rpms[0], '%s.bk' % rpms[0]) | ||
shutil.copy2(rebuilt_rpms[0], rpms[0]) | ||
except OSError, err: | ||
raise EasyBuildError("Failed to replace original RPM with rebuilt RPM: %s", err) | ||
def build_step(self): | ||
"""No build step for FDTD Solutions.""" | ||
pass | ||
|
||
def install_step(self): | ||
"""Install FDTD Solutions using install.sh script.""" | ||
cmd = "./install.sh" | ||
acceptq = ''.join([ | ||
"If you accept the terms above, type ACCEPT, otherwise press <enter> ", | ||
"to cancel the install [REJECT]:" | ||
]) | ||
qa = { | ||
acceptq: "ACCEPT", | ||
"Please select an option from the list [1]:": '1', | ||
"Please enter the install directory [/opt/lumerical/fdtd]:": self.installdir, | ||
} | ||
no_qa = [ | ||
] | ||
std_qa = { | ||
"Press <enter> to continue.*": '' | ||
} | ||
run_cmd_qa(cmd, qa, no_qa=no_qa, std_qa=std_qa, log_all=True, simple=True) | ||
|
||
def make_module_req_guess(self): | ||
"""Adjust values for PATH, LD_LIBRARY_PATH, etc.""" | ||
guesses = super(EB_FDTD_underscore_Solutions, self).make_module_req_guess() | ||
guesses.update({ | ||
'PATH': ['opt/lumerical/fdtd/bin'], | ||
'LD_LIBRARY_PATH': ['opt/lumerical/fdtd/lib'], | ||
}) | ||
return guesses | ||
"""Install FDTD Solutions using copy tree.""" | ||
fdtd_dir = os.path.join(self.cfg['start_dir'], 'opt', 'lumerical', 'fdtd') | ||
akesandgren marked this conversation as resolved.
Show resolved
Hide resolved
|
||
copy_dir(ftdt_dir, self.installdir, symlinks=self.cfg['keepsymlinks']) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. undefined name 'copy_dir' |
||
|
||
def sanity_check_step(self): | ||
"""Custom sanity check for FDTD Solutions.""" | ||
custom_paths = { | ||
'files': [], | ||
'dirs': ['opt/lumerical/fdtd/bin', 'opt/lumerical/fdtd/lib'], | ||
'files': ['bin/fdtd-solutions', 'lib/fdtd-engine-mpichp4_libFNP.so'], | ||
'dirs': ['api'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @akesandgren There no And for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gah.... I only have 8.16.982 to look at... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about just checking for That's still a little bit stricter than what was there (which was basically just checking for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. checking for a non-empty lib? what do you mean? I can check for an existing lib dir like it was done before, but how can i check for a non-empty one without checking for a specific file? Or did you just mean an existing lib dir? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct me if I'm wrong, but There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does? Didn't really know that, but if that's the case it's good enough for me :-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exactly, the |
||
} | ||
super(EB_FDTD_underscore_Solutions, self).sanity_check_step(custom_paths=custom_paths) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'easybuild.tools.filetools.rmtree2' imported but unused