Skip to content

Commit fe28ba8

Browse files
committed
drop now unused version_compare & package_version_compare
superseded by the PackageVersion comparison class
1 parent b3c1d27 commit fe28ba8

File tree

1 file changed

+0
-41
lines changed

1 file changed

+0
-41
lines changed

osgtest/library/core.py

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -449,47 +449,6 @@ def get_package_envra(package_name):
449449
return (epoch, name, version, release, arch)
450450

451451

452-
def version_compare(evr1, evr2):
453-
"""Compare the EVRs (epoch, version, release) of two RPMs and return
454-
- -1 if the first EVR is older than the second,
455-
- 0 if the two arguments are equal,
456-
- 1 if the first EVR is newer than the second.
457-
458-
Each EVR may be specified as a string (of the form "V-R" or "E:V-R"), or
459-
as a 3-element tuple or list.
460-
461-
"""
462-
if is_string(evr1):
463-
epoch1, version1, release1 = stringToVersion(evr1)
464-
elif isinstance(evr1, bytes):
465-
epoch1, version1, release1 = stringToVersion(evr1.decode())
466-
else:
467-
epoch1, version1, release1 = evr1
468-
469-
if is_string(evr2):
470-
epoch2, version2, release2 = stringToVersion(evr2)
471-
elif isinstance(evr2, bytes):
472-
epoch2, version2, release2 = stringToVersion(evr2.decode())
473-
else:
474-
epoch2, version2, release2 = evr2
475-
476-
return rpm.labelCompare((epoch1, version1, release1), (epoch2, version2, release2))
477-
478-
def package_version_compare(package_name, evr):
479-
"""Compare EVR of installed package_name to provided evr and return:
480-
-1 if the package version is older than evr,
481-
0 if the package version is equal to evr,
482-
1 if the package version is newer than evr.
483-
484-
evr can be a string ("[E:]V[-R]") or 3-element tuple or list.
485-
486-
This is a wrapper around 'version_compare' that avoids having to call
487-
'get_package_envra' and extract (e,v,r)
488-
"""
489-
e,n,v,r,a = get_package_envra(package_name)
490-
return version_compare((e,v,r), evr)
491-
492-
493452
def diagnose(message, command, status, stdout, stderr):
494453
"""Constructs a detailed failure message based on arguments."""
495454
result = message + '\n'

0 commit comments

Comments
 (0)