-
Notifications
You must be signed in to change notification settings - Fork 263
fix vmaccess for opensuse 15 #917
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
Changes from all commits
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 |
|---|---|---|
|
|
@@ -6509,10 +6509,13 @@ def DistInfo(fullname=0): | |
| distinfo[0] = distinfo[0].strip() # remove trailing whitespace in distro name | ||
| if not distinfo[0]: | ||
| distinfo = dist_info_SLES15() | ||
| if not distinfo[0]: | ||
| distinfo = dist_info_opensuse15() | ||
| return distinfo | ||
| else: | ||
| return platform.dist() | ||
|
|
||
|
|
||
| def dist_info_SLES15(): | ||
| os_release_filepath = "/etc/os-release" | ||
| if not os.path.isfile(os_release_filepath): | ||
|
|
@@ -6535,6 +6538,27 @@ def dist_info_SLES15(): | |
| return ["","",""] | ||
|
|
||
|
|
||
| def dist_info_opensuse15(): | ||
| os_release_filepath = "/etc/os-release" | ||
| if not os.path.isfile(os_release_filepath): | ||
| return ["","",""] | ||
| info = open(os_release_filepath).readlines() | ||
|
Contributor
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 this throw if we don't have the permissions?
Contributor
Author
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. OS release is readable for everyone in every distro. Yes, it could throw if somebody were to lock down something as fundamental as /etc/os-release but that would be a really far-fetched corner case. |
||
| found_name_opensuse_leap = False | ||
| found_id_opensuse_leap = False | ||
| version_id = "" | ||
| for line in info: | ||
| if "NAME=\"openSUSE" in line and "Leap" in line: | ||
| found_name_opensuse_leap = True | ||
| if "ID=\"opensuse-leap\"" in line: | ||
| found_id_opensuse_leap = True | ||
| if "VERSION_ID" in line: | ||
| match = re.match(r'VERSION_ID="([.0-9]+)"', line) | ||
| if match: | ||
| version_id = match.group(1) | ||
| if found_name_opensuse_leap and found_id_opensuse_leap and version_id: | ||
| return "SuSE", version_id, "suse" | ||
| return ["","",""] | ||
|
|
||
|
|
||
| def PackagedInstall(buildroot): | ||
| """ | ||
|
|
||
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.
Seems rather inefficient. Why not have one method that figures out the distinfo?
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.
This fix is needed because the library we use to determine the OS and distro fails for newer distros which stopped having release files like they used to, e.g. /etc/suse-release has been dropped in newer distors in favor of /etc/os-release.
We have had to add such methods do deal with these cases since we can't rely on one single method to determine distinfo