def compare_version(self, other): if self.packagetype == 'R' and other.packagetype == 'R': return labelCompare(self.get_version_string(), other.get_version_string()) elif self.packagetype == 'D' and other.packagetype == 'D': vs = Version(self.get_version_string()) vo = Version(other.get_version_string()) return version_compare(vs, vo)
def check_if_reboot_required(self, host_highest): ver, rel = self.kernel.split('-')[:2] kernel_ver = ('', str(ver), str(rel)) host_highest_ver = ('', host_highest.version, host_highest.release) if labelCompare(kernel_ver, host_highest_ver) == -1: self.reboot_required = True else: self.reboot_required = False
def check_if_reboot_required(self, host_highest): to_strip = ['xen', '-xen', 'PAE', '-pae', '-default', 'vanilla', '-pv'] kernel = self.kernel for s in to_strip: if kernel.endswith(s): kernel = kernel[:-len(s)] ver, rel = kernel.rsplit('-') kernel_ver = ('', str(ver), str(rel)) host_highest_ver = ('', host_highest.version, host_highest.release) if labelCompare(kernel_ver, host_highest_ver) == -1: self.reboot_required = True else: self.reboot_required = False
def compare_version(self, other): if self.packagetype == 'R' and other.packagetype == 'R': return labelCompare(self.get_version_string(), other.get_version_string()) elif self.packagetype == 'D' and other.packagetype == 'D': vs = Version(self.get_version_string()) vo = Version(other.get_version_string()) return version_compare(vs, vo) elif self.packagetype == 'A' and other.packagetype == 'A': if self.epoch == other.epoch \ and self.version == other.version \ and self.release == other.release: return 0 vs = Version(self.get_version_string()) vo = Version(other.get_version_string()) return version_compare(vs, vo)