diff --git a/slpkg/sbo/greps.py b/slpkg/sbo/greps.py index f7b4be56..34d19fa4 100644 --- a/slpkg/sbo/greps.py +++ b/slpkg/sbo/greps.py @@ -32,19 +32,17 @@ class SBoGrep(Utils): def __init__(self, name): self.name = name self.meta = _meta_ - arch64 = "x86_64" + self.arch64 = "x86_64" self.line_name = "SLACKBUILD NAME: " self.line_files = "SLACKBUILD FILES: " self.line_down = "SLACKBUILD DOWNLOAD: " - self.line_down_64 = f"SLACKBUILD DOWNLOAD_{arch64}: " + self.line_down_64 = f"SLACKBUILD DOWNLOAD_{self.arch64}: " self.line_req = "SLACKBUILD REQUIRES: " self.line_ver = "SLACKBUILD VERSION: " self.line_md5 = "SLACKBUILD MD5SUM: " - self.line_md5_64 = f"SLACKBUILD MD5SUM_{arch64}: " + self.line_md5_64 = f"SLACKBUILD MD5SUM_{self.arch64}: " self.line_des = "SLACKBUILD SHORT DESCRIPTION: " self.sbo_txt = self.meta.lib_path + "sbo_repo/SLACKBUILDS.TXT" - self.answer = ["y", "Y"] - self.unst = ["UNSUPPORTED", "UNTESTED"] self.SLACKBUILDS_TXT = self.read_file(self.sbo_txt) def _names_grabbing(self): @@ -73,25 +71,7 @@ class SBoGrep(Utils): if line.startswith(self.line_down_64): if sbo_name == self.name and line[28:].strip(): source64 = line[28:] - return self._select_source_arch(source, source64) - - def _select_source_arch(self, source, source64): - """Return sources by arch - """ - src = "" - if self.meta.arch == "x86_64": - if source64: - src = source64 - else: - src = source - if self.meta.skip_unst in self.answer and source64 in self.unst: - src = source - else: - if source: - src = source - if self.meta.skip_unst in self.answer and source in self.unst: - src = source64 - return src + return self._sorting_arch(source, source64) def requires(self): """Grab package requirements @@ -126,20 +106,7 @@ class SBoGrep(Utils): if line.startswith(self.line_md5): if sbo_name == self.name and line[19:].strip(): md5sum = line[19:].strip().split() - return self._select_md5sum_arch(md5sum, md5sum64) - - def _select_md5sum_arch(self, md5sum, md5sum64): - """Return checksums by arch - """ - if md5sum and md5sum64: - if self.meta.arch == "x86_64": - return md5sum64 - else: - return md5sum - if md5sum: - return md5sum - else: - return md5sum64 + return self._sorting_arch(md5sum, md5sum64) def description(self): """Grab package version @@ -160,3 +127,10 @@ class SBoGrep(Utils): if line.startswith(self.line_files): if sbo_name == self.name: return line[18:].strip() + + def _sorting_arch(self, arch, arch64): + """Return sources by arch + """ + if self.meta.arch == self.arch64 and arch64: + return arch64 + return arch