-
Notifications
You must be signed in to change notification settings - Fork 14
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
Replace cmp_version with rpm python bindings #110
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
requests | ||
more-executors | ||
ubi-config | ||
cmp_version | ||
rpm-py-installer | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,15 +4,16 @@ | |
import time | ||
|
||
from urllib3.util.retry import Retry | ||
from ubipop._utils import split_filename | ||
|
||
try: | ||
from urllib.parse import urljoin | ||
except ImportError: | ||
from urlparse import urljoin | ||
|
||
import requests | ||
from rpm import labelCompare as label_compare # pylint: disable=no-name-in-module | ||
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. Instead of adding an extra dep, would not be easy to just borrow this function? 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. yeah, sounds like a plan. 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. But it's implemented in C, isn't it? I would rather keep our stuff pure-python as much as we can. 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. Yep, it's in C, I also wouldn't like to have extra C code in our stuff. 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. Oh, if it's in C makes sense. |
||
|
||
from cmp_version import cmp_version | ||
|
||
_LOG = logging.getLogger("ubipop") | ||
|
||
|
@@ -296,24 +297,27 @@ def __init__(self, name, filename, sourcerpm_filename=None, is_modular=False): | |
self.filename = filename | ||
self.sourcerpm_filename = sourcerpm_filename | ||
self.is_modular = is_modular | ||
# return name, ver, rel, epoch, arch | ||
_, self.version, self.release, self.epoch, _ = split_filename(self.filename) | ||
self.evr_tuple = (self.epoch, self.version, self.release) | ||
|
||
def __lt__(self, other): | ||
return cmp_version(self.filename, other.filename) < 0 | ||
return label_compare(self.evr_tuple, other.evr_tuple) < 0 | ||
|
||
def __gt__(self, other): | ||
return cmp_version(self.filename, other.filename) > 0 | ||
return label_compare(self.evr_tuple, other.evr_tuple) > 0 | ||
|
||
def __eq__(self, other): | ||
return cmp_version(self.filename, other.filename) == 0 | ||
return label_compare(self.evr_tuple, other.evr_tuple) == 0 | ||
|
||
def __le__(self, other): | ||
return cmp_version(self.filename, other.filename) <= 0 | ||
return label_compare(self.evr_tuple, other.evr_tuple) <= 0 | ||
|
||
def __ge__(self, other): | ||
return cmp_version(self.filename, other.filename) >= 0 | ||
return label_compare(self.evr_tuple, other.evr_tuple) >= 0 | ||
|
||
def __ne__(self, other): | ||
return cmp_version(self.filename, other.filename) != 0 | ||
return label_compare(self.evr_tuple, other.evr_tuple) != 0 | ||
|
||
def __str__(self): | ||
return self.filename | ||
|
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.
I think this might cause some issues for the RPM packages of this project. Is this going to result in the egg always requiring some "rpm-py-installer" distribution to be present, while it's actually nonsense to set that as Requires in an RPM?
In general though I think it's OK for what we put in these repos to be somewhat ignorant of RPM packaging complexities. So this comment is more like a heads up that this might cause us to run into issues and we may need patches in dist-git, or may need to revisit this later.