-
Task
-
Resolution: Done
-
Normal
-
None
-
False
-
False
-
-
3
-
2023-Q1
This is a follow-up issue regarding a refactor for the function `_package_version_cmp()`.
As of now, there is only one item left to be addressed that is to improve the current function we have in the code `_package_version_cmp()`, which was improved in RHELC-297, but tkuratom@redhat.com made a few comments that we should address to improve the function itself.
Acceptance Criteria
- Separate version parsing and version comparison
- The parsing function will take a version string in either ENVR or NEVR format.
- If epoch or arch does not exist in the input string, it will be set to None in the tuple.
- Parsing arch will be slightly tricky as I don't think there's a fool-proof way to separate an optional arch from release. Maybe looking for a list of allowed arch patterns is the best we can do. Something like: .*(x86_64|s390x|i.86)?$
- The version comparison function will take two version strings in either ENVR or NEVR format.
- The strings will be passed to the parsing functions to return the information in a normalized form.
- The names and arches will be compared.
- An error will be emitted if names do not match.
- An error will be emitted if arches do not match and both arches are not None.
- rpm.labelCompare() will then be used to compare the EVR for both packages and the results returned.
- Port existing use of pkghandler.compare_package_versions() to use the new comparison function.
- Remove pkghandler.compare_package_versions() and utils.string_to_version().
Notes
- Link for the thread discussion https://github.com/oamg/convert2rhel/pull/469#discussion_r873971400
- is related to
-
RHELC-884 Disable RHEL repos when performing checks
- Closed