-
Notifications
You must be signed in to change notification settings - Fork 170
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
DPDK MANA CentOS 7 changes #3373
base: mcgov/dpdk-mana-merge
Are you sure you want to change the base?
Changes from all commits
7309b7a
638a282
7edabb1
d2c5d1e
b981aee
30a2987
22acf02
518ca35
648f442
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 |
---|---|---|
|
@@ -93,6 +93,9 @@ class SourceInstallerSchema(BaseInstallerSchema): | |
), | ||
) | ||
|
||
# Additional build dependencies | ||
build_deps: List[str] = field(default_factory=list) | ||
|
||
|
||
class SourceInstaller(BaseInstaller): | ||
_code_path: PurePath | ||
|
@@ -143,7 +146,7 @@ def install(self) -> str: | |
runbook: SourceInstallerSchema = self.runbook | ||
assert runbook.location, "the repo must be defined." | ||
|
||
self._install_build_tools(node) | ||
self._install_build_tools(node, runbook.build_deps) | ||
|
||
factory = subclasses.Factory[BaseLocation](BaseLocation) | ||
source = factory.create_by_runbook( | ||
|
@@ -286,33 +289,49 @@ def _build_code(self, node: Node, code_path: PurePath, kconfig_file: str) -> Non | |
) | ||
result.assert_exit_code() | ||
|
||
# the gcc version of Redhat 7.x is too old. Upgrade it. | ||
if isinstance(node.os, Redhat) and node.os.information.version < "8.0.0": | ||
node.os.install_packages(["devtoolset-8"]) | ||
node.tools[Mv].move("/bin/gcc", "/bin/gcc_back", overwrite=True, sudo=True) | ||
result.assert_exit_code() | ||
result = node.execute( | ||
"ln -s /opt/rh/devtoolset-8/root/usr/bin/gcc /bin/gcc", sudo=True | ||
) | ||
result.assert_exit_code() | ||
|
||
make = node.tools[Make] | ||
make.make(arguments="olddefconfig", cwd=code_path) | ||
|
||
# set timeout to 2 hours | ||
make.make(arguments="", cwd=code_path, timeout=60 * 60 * 2) | ||
|
||
def _install_build_tools(self, node: Node) -> None: | ||
def _fix_mirrorlist_to_vault(self, node: Node) -> None: | ||
node.execute("sed -i '\ | ||
s/^mirrorlist=/#mirrorlist=/;\ | ||
s/^#baseurl=/baseurl=/;\ | ||
/^baseurl=/ s/mirror/vault/\ | ||
' /etc/yum.repos.d/CentOS-*.repo", shell=True, sudo=True) | ||
|
||
def _install_build_tools(self, node: Node, build_deps: list[str]) -> None: | ||
os = node.os | ||
self._log.info("installing build tools") | ||
if isinstance(node.os, Redhat) and node.os.information.version < "8.0.0": | ||
self._fix_mirrorlist_to_vault(node) | ||
if isinstance(os, Redhat): | ||
for package in list( | ||
["elfutils-libelf-devel", "openssl-devel", "dwarves", "bc"] | ||
["elfutils-libelf-devel", "openssl-devel", "dwarves", "bc"] + build_deps | ||
): | ||
if os.is_package_in_repo(package): | ||
os.install_packages(package) | ||
os.group_install_packages("Development Tools") | ||
|
||
# if the kernel requires devtoolset, install its gcc | ||
devtoolsets = [ | ||
pkg | ||
for pkg in build_deps | ||
if pkg.startswith("devtoolset") | ||
] | ||
if devtoolsets: | ||
assert len(devtoolsets) == 1, f"only one devtoolset can be given, instead of {devtoolsets}" | ||
devtoolset = devtoolsets[0] | ||
node.os.install_packages(devtoolset) | ||
node.tools[Mv].move("/bin/gcc", "/bin/gcc_back", overwrite=True, sudo=True) | ||
result.assert_exit_code() | ||
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. add message, so once the assertion failed, the error message give more details. 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. Please take care all |
||
result = node.execute( | ||
f"ln -s /opt/rh/{devtoolset}/root/usr/bin/gcc /bin/gcc", sudo=True | ||
) | ||
result.assert_exit_code(f"can not link {devtoolset} to gcc") | ||
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. Use named arguments, so it won't be broken, if the interface changed in future. |
||
|
||
if os.information.version < "8.0.0": | ||
# git from default CentOS/RedHat 7.x does not support git tag format | ||
# syntax temporarily use a community repo, then remove it | ||
|
@@ -336,7 +355,7 @@ def _install_build_tools(self, node: Node) -> None: | |
"libssl-dev", | ||
"bc", | ||
"ccache", | ||
] | ||
] + build_deps | ||
) | ||
elif isinstance(os, CBLMariner): | ||
os.install_packages( | ||
|
@@ -355,7 +374,7 @@ def _install_build_tools(self, node: Node) -> None: | |
"xz-libs", | ||
"openssl-libs", | ||
"openssl-devel", | ||
] | ||
] + build_deps | ||
) | ||
else: | ||
raise LisaException( | ||
|
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.
Can the build_deps be added into this class, instead of configurable? It makes repro harder from others.
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.
Can you please elaborate?
Currently it is added as a configurable because different kernel versions might need different build dependencies.
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.
You can add checks for kernel versions, if it's some version, add the deps. If the deps are maintained out of code, it's hard to others to make the build tools works without the right configuration.
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.
Yeah, but we fetch the kernel version after installation of the build tools (otherwise
make kernelrelease
might fail). Should I add a second call to install_build_tools after kernel version is known?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.
Yes, you can call installation again, after know kernel version. Please add comments to explain the dependencies.