-
Notifications
You must be signed in to change notification settings - Fork 212
DPDK: install path fixes for meson and Ubuntu 24.04 #3598
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
base: main
Are you sure you want to change the base?
Changes from 16 commits
f9d179d
08bf094
d34f4be
b77c65a
f6be104
97ba111
124c351
370fc4e
b3a37ad
3cfa460
186221b
6bc582c
adfa8cd
452df1c
74d8808
459acb3
5530bc8
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 | ||||
---|---|---|---|---|---|---|
|
@@ -8,20 +8,26 @@ | |||||
|
||||||
from lisa.executable import Tool | ||||||
from lisa.operating_system import Posix | ||||||
from lisa.util import parse_version | ||||||
|
||||||
from .ln import Ln | ||||||
from .python import Pip | ||||||
from .whoami import Whoami | ||||||
|
||||||
|
||||||
class Meson(Tool): | ||||||
_minimum_version = parse_version("0.52.0") | ||||||
|
||||||
@property | ||||||
def command(self) -> str: | ||||||
return "meson" | ||||||
|
||||||
def _check_exists(self) -> bool: | ||||||
result = self.node.execute("meson --version", shell=True) | ||||||
return result.exit_code == 0 and VersionInfo.parse(result.stdout) >= "0.52.0" | ||||||
return ( | ||||||
result.exit_code == 0 | ||||||
and VersionInfo.parse(result.stdout) >= self._minimum_version | ||||||
) | ||||||
|
||||||
@property | ||||||
def can_install(self) -> bool: | ||||||
|
@@ -30,12 +36,52 @@ def can_install(self) -> bool: | |||||
def _install(self) -> bool: | ||||||
posix_os: Posix = cast(Posix, self.node.os) | ||||||
# use pip to make sure we install a recent version | ||||||
if (not posix_os.package_exists("meson")) or posix_os.get_package_information( | ||||||
"meson", use_cached=False | ||||||
) < "0.52.0": | ||||||
|
||||||
package_installed = "" | ||||||
package_available = "" | ||||||
# packaged as 'meson' on older systems and 'python3-meson' on newer ones, | ||||||
# since it's actually just a python package. | ||||||
# But now we have a bunch of annoying cases. | ||||||
# 'meson' is installed but the wrong version | ||||||
# meson is installed but the right version | ||||||
# meson is not installed and it's the wrong version | ||||||
# meson is not installed and it's the right version | ||||||
for pkg in [ | ||||||
"python3-meson", | ||||||
"meson", | ||||||
]: | ||||||
if posix_os.package_exists(pkg): | ||||||
package_installed = pkg | ||||||
break | ||||||
elif posix_os.is_package_in_repo(pkg): | ||||||
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.
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. Can you be more specific with your request from 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.
Suggested change
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. Right. So making just that change will introduce an unintended side effect of updating the package before we check the version of the currently installed package. Let me see if I can make the decisions more clear in the code. I was intentionally not installing an updated version from the package manager if one was already installed because it was convenient for my meson use cases... But really it would be better to write for the general case; even though it will be a little uglier and use another round trip or two. 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 wasn't so bad to rework! Testing the more commented, reworked version now |
||||||
package_available = pkg | ||||||
break | ||||||
|
||||||
# install the available package, if one was available and not installed | ||||||
if package_available: | ||||||
posix_os.install_packages(package_available) | ||||||
package_installed = package_available | ||||||
|
||||||
# now, if either previoulsy or newly installed package, check the version | ||||||
if package_installed: | ||||||
if ( | ||||||
posix_os.get_package_information(package_installed, use_cached=False) | ||||||
< self._minimum_version | ||||||
): | ||||||
# and uninstall if the version is not recent enough | ||||||
posix_os.uninstall_packages(package_installed) | ||||||
package_installed = "" | ||||||
else: | ||||||
# otherwise, we're done. | ||||||
return self._check_exists() | ||||||
|
||||||
# If we get here, we couldn't find a good version from the package manager | ||||||
# so we will install with pip. This is least desirable since it introduces | ||||||
# unpredictable behavior when running meson or ninja with sudo. | ||||||
# Like sudo ninja install, for example. | ||||||
if not package_installed: | ||||||
username = self.node.tools[Whoami].get_username() | ||||||
self.node.tools[Pip].install_packages("meson", install_to_user=True) | ||||||
# environment variables won't expand even when using shell=True :\ | ||||||
self.node.tools[Ln].create_link( | ||||||
f"/home/{username}/.local/bin/meson", "/usr/bin/meson", force=True | ||||||
) | ||||||
|
@@ -48,6 +94,7 @@ def _install(self) -> bool: | |||||
no_info_log=True, | ||||||
no_error_log=True, | ||||||
) | ||||||
|
||||||
return self._check_exists() | ||||||
|
||||||
def setup(self, args: str, cwd: PurePath, build_dir: str = "build") -> PurePath: | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.