From 90a5649ad52430b6d8e8eeb9a811cd63b48caf41 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Feb 2020 19:57:25 +0100 Subject: [PATCH] Bugfix slack repo #122 --- ChangeLog.txt | 5 +++++ slpkg/binary/greps.py | 34 +++++++++++++++++++++++++++++++++- slpkg/binary/install.py | 24 ++---------------------- 3 files changed, 40 insertions(+), 23 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 0d28d120..d9a6a368 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,8 @@ +3.8.1 - 13/02/2020 +FIxed: +- Bugfix double install packages from slack regular repo + and patches directory #122 + 3.8.0 - 05/02/2020 Added: - Many changes happen in this version, a big part of code has been rewritten diff --git a/slpkg/binary/greps.py b/slpkg/binary/greps.py index 231f7e5f..d8352e51 100644 --- a/slpkg/binary/greps.py +++ b/slpkg/binary/greps.py @@ -38,6 +38,7 @@ def repo_data(PACKAGES_TXT, repo, flag): for line in PACKAGES_TXT.splitlines(): if _meta_.rsl_deps in ["on", "ON"] and "--resolve-off" not in flag: status(0.000005) + if line.startswith("PACKAGE NAME:"): name.append(line[15:].strip()) if line.startswith("PACKAGE LOCATION:"): @@ -46,7 +47,14 @@ def repo_data(PACKAGES_TXT, repo, flag): size.append(line[28:-2].strip()) if line.startswith("PACKAGE SIZE (uncompressed):"): unsize.append(line[30:-2].strip()) - if repo == "rlw": + + if repo == "slack": + (rname, + rlocation, + rsize, + runsize + ) = slack_filter(name, location, size, unsize, flag) + elif repo == "rlw": (rname, rlocation, rsize, @@ -75,6 +83,30 @@ def repo_data(PACKAGES_TXT, repo, flag): return [rname, rlocation, rsize, runsize] +def slack_filter(name, location, size, unsize, flag): + """Slackware filter seperate packages from patches/ directory + """ + (fname, flocation, fsize, funsize) = ([] for i in range(4)) + + if "--patches" not in flag: + for n, l, s, u in zip(name, location, size, unsize): + if f"_slack{slack_ver()}" not in n: + fname.append(n) + flocation.append(l) + fsize.append(s) + funsize.append(u) + + if "--patches" in flag: + for n, l, s, u in zip(name, location, size, unsize): + if f"_slack{slack_ver()}" in n: + fname.append(n) + flocation.append(l) + fsize.append(s) + funsize.append(u) + + return [fname, flocation, fsize, funsize] + + def rlw_filter(name, location, size, unsize): """Filter rlw repository data """ diff --git a/slpkg/binary/install.py b/slpkg/binary/install.py index d0ac5988..884016aa 100644 --- a/slpkg/binary/install.py +++ b/slpkg/binary/install.py @@ -331,6 +331,7 @@ class BinaryInstall: install.append(pk) comp_sum.append(comp) uncomp_sum.append(uncomp) + if not install: for pkg in packages: for pk, loc, comp, uncomp in zip(self.data[0], self.data[1], @@ -346,26 +347,5 @@ class BinaryInstall: install.reverse() comp_sum.reverse() uncomp_sum.reverse() - if self.repo == "slack": - dwn, install, comp_sum, uncomp_sum = self.patches(dwn, install, - comp_sum, - uncomp_sum) - return [dwn, install, comp_sum, uncomp_sum] - def patches(self, dwn, install, comp_sum, uncomp_sum): - """Seperates packages from patches/ directory - """ - dwnp, installp, comp_sump, uncomp_sump = ([] for i in range(4)) - for d, i, c, u in zip(dwn, install, comp_sum, uncomp_sum): - if "_slack" + slack_ver() in i: - dwnp.append(d) - dwn.remove(d) - installp.append(i) - install.remove(i) - comp_sump.append(c) - comp_sum.remove(c) - uncomp_sump.append(u) - uncomp_sum.remove(u) - if "--patches" in self.flag: - return dwnp, installp, comp_sump, uncomp_sump - return dwn, install, comp_sum, uncomp_sum + return [dwn, install, comp_sum, uncomp_sum]