Skip to content

Commit

Permalink
Implement compare_packages for the alpm backend
Browse files Browse the repository at this point in the history
  • Loading branch information
jelly authored and FrostyX committed Aug 20, 2021
1 parent 47b76c8 commit 30bee79
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tracer/packageManagers/alpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ def find_package(self, pkg_name, version):
if pkg and pyalpm.vercmp(pkg.version, version) == 0:
return pkg

def compare_packages(self, package1, package2):
"""
vercmp returns:
< 0 if ver1 < ver2
0 if ver1 == ver2
> 0 if ver1 > ver2
"""
return pyalpm.vercmp(package1.version, package2.version)

@staticmethod
def _bsearch_list(l, item):
"""
Expand Down

0 comments on commit 30bee79

Please sign in to comment.