Uploaded image for project: 'RHEL Conversions'
  1. RHEL Conversions
  2. RHELC-667

Improve package version comparison

XMLWordPrintable

    • False
    • False
    • Hide

      None

      Show
      None
    • 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

              prwatson@redhat.com Preston Watson
              rolivier@redhat.com Rodolfo Olivieri
              Toshio Kuratomi
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: