From 6b98d8cecacb8aaa27a09862616c8ce21da7e40e Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Feb 2020 12:22:41 +0100 Subject: [PATCH 01/29] Fixed message Signed-off-by: Dimitris Zlatanidis --- slpkg/slack/patches.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slpkg/slack/patches.py b/slpkg/slack/patches.py index 0c483dd6..a5618d76 100644 --- a/slpkg/slack/patches.py +++ b/slpkg/slack/patches.py @@ -129,7 +129,7 @@ class Patches: if self.meta.arch == "x86_64": slack_arch = "64" print(f"\nSlackware{slack_arch} '{self.version}' v{slack_ver()}" - f"distribution is up to date!\n") + f" distribution is up to date!\n") def store(self): """ @@ -272,4 +272,4 @@ class Patches: print(f"{self.green}Update the package lists ?{self.endc}") print("=" * 79) if self.msg.answer() in ["y", "Y"]: - Update().repository(["slack"]) \ No newline at end of file + Update().repository(["slack"]) From 28ff31ac298258a44dc5c1576419dc335cf0c843 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Feb 2020 19:48:41 +0100 Subject: [PATCH 02/29] Remove pasture/ directory --- slpkg/init.py | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/slpkg/init.py b/slpkg/init.py index 8e5be858..18fb6707 100644 --- a/slpkg/init.py +++ b/slpkg/init.py @@ -114,7 +114,7 @@ class Initialization: os.mkdir(log) if not os.path.exists(lib): os.mkdir(lib) - dirs = ["core/", "extra/", "pasture/", "patches/"] + dirs = ["core/", "extra/", "patches/"] for d in dirs: if not os.path.exists(lib + d): os.mkdir(lib + d) @@ -123,10 +123,10 @@ class Initialization: CHECKSUMS_MD5 = mirrors(md5_file, "") self.EXTRA = mirrors(lib_file, dirs[1]) self.EXT_CHECKSUMS = mirrors(md5_file, dirs[1]) - self.PASTURE = mirrors(lib_file, dirs[2]) - self.PAS_CHECKSUMS = mirrors(md5_file, dirs[2]) - self.PATCHES = mirrors(lib_file, dirs[3]) - self.PAT_CHECKSUMS = mirrors(md5_file, dirs[3]) + # self.PASTURE = mirrors(lib_file, dirs[2]) + # self.PAS_CHECKSUMS = mirrors(md5_file, dirs[2]) + self.PATCHES = mirrors(lib_file, dirs[2]) + self.PAT_CHECKSUMS = mirrors(md5_file, dirs[2]) ChangeLog_txt = mirrors(log_file, "") if self.check: return self.checks_logs(log, ChangeLog_txt) @@ -134,21 +134,19 @@ class Initialization: self.down(lib + dirs[0], CHECKSUMS_MD5, repo_name) self.down(lib + dirs[1], self.EXTRA, repo_name) self.down(lib + dirs[1], self.EXT_CHECKSUMS, repo_name) - if slack_ver() != "14.0": # no pasture/ folder for 14.0 version - self.down(lib + dirs[2], self.PASTURE, repo_name) - self.down(lib + dirs[2], self.PAS_CHECKSUMS, repo_name) - self.down(lib + dirs[3], self.PATCHES, repo_name) - self.down(lib + dirs[3], self.PAT_CHECKSUMS, repo_name) + # if slack_ver() != "14.0": # no pasture/ folder for 14.0 version + # self.down(lib + dirs[2], self.PASTURE, repo_name) + # self.down(lib + dirs[2], self.PAS_CHECKSUMS, repo_name) + self.down(lib + dirs[2], self.PATCHES, repo_name) + self.down(lib + dirs[2], self.PAT_CHECKSUMS, repo_name) self.down(log, ChangeLog_txt, repo_name) self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5, FILELIST_TXT, repo_name) self.merge(lib, "PACKAGES.TXT", ["core/PACKAGES.TXT", "extra/PACKAGES.TXT", - "pasture/PACKAGES.TXT", "patches/PACKAGES.TXT"]) self.merge(lib, "CHECKSUMS.md5", ["core/CHECKSUMS.md5", "extra/CHECKSUMS.md5", - "pasture/CHECKSUMS.md5", "patches/CHECKSUMS_md5"]) def sbo(self): @@ -669,7 +667,7 @@ class Initialization: self.file_remove(lib_path, CHECKSUMS_MD5.split("/")[-1]) self.file_remove(lib_path, FILELIST_TXT.split("/")[-1]) if repo == "slack": - dirs = ["core/", "extra/", "pasture/"] + dirs = ["core/", "extra/"] for d in dirs: self.file_remove(lib_path + d, "PACKAGES.TXT") self.file_remove(lib_path + d, "CHECKSUMS.md5") @@ -677,9 +675,9 @@ class Initialization: self.down(lib_path + "core/", CHECKSUMS_MD5, repo) self.down(lib_path + "extra/", self.EXTRA, repo) self.down(lib_path + "extra/", self.EXT_CHECKSUMS, repo) - if slack_ver() != "14.0": # no pasture/ folder for 14.0 version - self.down(lib_path + "pasture/", self.PASTURE, repo) - self.down(lib_path + "pasture/", self.PAS_CHECKSUMS, repo) + # if slack_ver() != "14.0": # no pasture/ folder for 14.0 version + # self.down(lib_path + "pasture/", self.PASTURE, repo) + # self.down(lib_path + "pasture/", self.PAS_CHECKSUMS, repo) # download new files if repo != "slack": self.down(lib_path, PACKAGES_TXT, repo) From 90a5649ad52430b6d8e8eeb9a811cd63b48caf41 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Feb 2020 19:57:25 +0100 Subject: [PATCH 03/29] 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] From 7ff99c075f67587206a2cb650fef2f2dd1a38149 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Feb 2020 20:20:08 +0100 Subject: [PATCH 04/29] Removed status bar Signed-off-by: Dimitris Zlatanidis --- conf/slpkg.conf | 8 ++------ slpkg/binary/check.py | 2 -- slpkg/binary/dependency.py | 2 -- slpkg/binary/greps.py | 4 ---- slpkg/binary/install.py | 2 -- slpkg/init.py | 8 -------- slpkg/sbo/check.py | 2 -- slpkg/sbo/dependency.py | 3 --- slpkg/sbo/slackbuild.py | 3 --- slpkg/slack/patches.py | 5 +---- slpkg/toolbar.py | 1 - 11 files changed, 3 insertions(+), 37 deletions(-) diff --git a/conf/slpkg.conf b/conf/slpkg.conf index 25d0fd2d..002059e7 100644 --- a/conf/slpkg.conf +++ b/conf/slpkg.conf @@ -115,15 +115,11 @@ SLACKPKG_LOG=on # packages required for distribution. ONLY_INSTALLED=off -# Enable or disable the progress bar. Status bar progress delays the search -# process in package lists. Default is "off". -PRG_BAR=off - -# Register a text editor that uses the slpkg in a few options. +# Register a text editor that uses the slpkg in a few options. # Default is "nano". EDITOR=nano # If you don't want slpkg downgrade packages, setting this variable to "on". # Warning: Possible failure building packages or running applications after # install. Default is "off". -NOT_DOWNGRADE=off +NOT_DOWNGRADE=off \ No newline at end of file diff --git a/slpkg/binary/check.py b/slpkg/binary/check.py index e64611ec..dbc85f0a 100644 --- a/slpkg/binary/check.py +++ b/slpkg/binary/check.py @@ -25,7 +25,6 @@ from pkg_resources import parse_version from slpkg.messages import Msg -from slpkg.toolbar import status from slpkg.splitting import split_package from slpkg.upgrade_checklist import choose_upg from slpkg.__metadata__ import MetaData as _meta_ @@ -48,7 +47,6 @@ def pkg_upgrade(repo, skip, flag): # unsize = data[3] data = repo_data(PACKAGES_TXT, repo, flag="") for pkg in installed(): - status(0.0005) inst_pkg = split_package(pkg) for name in data[0]: if name: # this tips because some pkg_name is empty diff --git a/slpkg/binary/dependency.py b/slpkg/binary/dependency.py index ea8b9a4e..2203dc81 100644 --- a/slpkg/binary/dependency.py +++ b/slpkg/binary/dependency.py @@ -24,7 +24,6 @@ import sys -from slpkg.toolbar import status from slpkg.__metadata__ import MetaData as _meta_ from slpkg.binary.greps import Requires @@ -48,7 +47,6 @@ class Dependencies: requires = Requires(name, self.repo).get_deps() if requires: for req in requires: - status(0) if req and req not in self.black: dependencies.append(req) if dependencies: diff --git a/slpkg/binary/greps.py b/slpkg/binary/greps.py index d8352e51..f47d5915 100644 --- a/slpkg/binary/greps.py +++ b/slpkg/binary/greps.py @@ -23,7 +23,6 @@ from slpkg.utils import Utils -from slpkg.toolbar import status from slpkg.splitting import split_package from slpkg.__metadata__ import MetaData as _meta_ @@ -36,9 +35,6 @@ def repo_data(PACKAGES_TXT, repo, flag): (name, location, size, unsize, rname, rlocation, rsize, runsize) = ([] for i in range(8)) 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:"): diff --git a/slpkg/binary/install.py b/slpkg/binary/install.py index 884016aa..f7c0f23c 100644 --- a/slpkg/binary/install.py +++ b/slpkg/binary/install.py @@ -28,7 +28,6 @@ from pkg_resources import parse_version from slpkg.utils import Utils from slpkg.sizes import units from slpkg.messages import Msg -from slpkg.toolbar import status from slpkg.checksum import check_md5 from slpkg.blacklist import BlackList from slpkg.downloader import Download @@ -266,7 +265,6 @@ class BinaryInstall: self.flag != "--resolve-off"): self.msg.resolving() for dep in self.packages: - status(0.05) dependencies = [] dependencies = Utils().dimensional_list(Dependencies( self.repo, self.blacklist).binary(dep, self.flag)) diff --git a/slpkg/init.py b/slpkg/init.py index 18fb6707..aa59d08d 100644 --- a/slpkg/init.py +++ b/slpkg/init.py @@ -123,8 +123,6 @@ class Initialization: CHECKSUMS_MD5 = mirrors(md5_file, "") self.EXTRA = mirrors(lib_file, dirs[1]) self.EXT_CHECKSUMS = mirrors(md5_file, dirs[1]) - # self.PASTURE = mirrors(lib_file, dirs[2]) - # self.PAS_CHECKSUMS = mirrors(md5_file, dirs[2]) self.PATCHES = mirrors(lib_file, dirs[2]) self.PAT_CHECKSUMS = mirrors(md5_file, dirs[2]) ChangeLog_txt = mirrors(log_file, "") @@ -134,9 +132,6 @@ class Initialization: self.down(lib + dirs[0], CHECKSUMS_MD5, repo_name) self.down(lib + dirs[1], self.EXTRA, repo_name) self.down(lib + dirs[1], self.EXT_CHECKSUMS, repo_name) - # if slack_ver() != "14.0": # no pasture/ folder for 14.0 version - # self.down(lib + dirs[2], self.PASTURE, repo_name) - # self.down(lib + dirs[2], self.PAS_CHECKSUMS, repo_name) self.down(lib + dirs[2], self.PATCHES, repo_name) self.down(lib + dirs[2], self.PAT_CHECKSUMS, repo_name) self.down(log, ChangeLog_txt, repo_name) @@ -675,9 +670,6 @@ class Initialization: self.down(lib_path + "core/", CHECKSUMS_MD5, repo) self.down(lib_path + "extra/", self.EXTRA, repo) self.down(lib_path + "extra/", self.EXT_CHECKSUMS, repo) - # if slack_ver() != "14.0": # no pasture/ folder for 14.0 version - # self.down(lib_path + "pasture/", self.PASTURE, repo) - # self.down(lib_path + "pasture/", self.PAS_CHECKSUMS, repo) # download new files if repo != "slack": self.down(lib_path, PACKAGES_TXT, repo) diff --git a/slpkg/sbo/check.py b/slpkg/sbo/check.py index 8f33c6fa..37688e36 100644 --- a/slpkg/sbo/check.py +++ b/slpkg/sbo/check.py @@ -26,7 +26,6 @@ import os from pkg_resources import parse_version from slpkg.messages import Msg -from slpkg.toolbar import status from slpkg.blacklist import BlackList from slpkg.splitting import split_package from slpkg.upgrade_checklist import choose_upg @@ -43,7 +42,6 @@ def sbo_upgrade(skip, flag): data = SBoGrep(name="").names() blacklist = BlackList().packages(pkgs=data, repo="sbo") for pkg in sbo_list(): - status(0.02) name = split_package(pkg)[0] ver = split_package(pkg)[1] if (name in data and name not in skip and name not in blacklist): diff --git a/slpkg/sbo/dependency.py b/slpkg/sbo/dependency.py index 7401ee2c..e996a08f 100644 --- a/slpkg/sbo/dependency.py +++ b/slpkg/sbo/dependency.py @@ -24,7 +24,6 @@ import sys -from slpkg.toolbar import status from slpkg.blacklist import BlackList from slpkg.__metadata__ import MetaData as _meta_ @@ -52,8 +51,6 @@ class Requires: requires = SBoGrep(name).requires() if requires: for req in requires: - status(0.03) - # toolbar_width = status(index, toolbar_width, 1) # avoid to add %README% as dependency and # if require in blacklist if "%README%" not in req and req not in self.blacklist: diff --git a/slpkg/sbo/slackbuild.py b/slpkg/sbo/slackbuild.py index 772f7ea2..7e862a92 100644 --- a/slpkg/sbo/slackbuild.py +++ b/slpkg/sbo/slackbuild.py @@ -28,7 +28,6 @@ from pkg_resources import parse_version from slpkg.utils import Utils from slpkg.messages import Msg -from slpkg.toolbar import status from slpkg.log_deps import write_deps from slpkg.blacklist import BlackList from slpkg.downloader import Download @@ -99,7 +98,6 @@ class SBoInstall: self.is_upgrade = is_upgrade self.case_insensitive() for _sbo in self.slackbuilds: - status(0.03) if _sbo in self.data and _sbo not in self.blacklist: sbo_deps = Requires(self.flag).sbo(_sbo) self.deps += sbo_deps @@ -233,7 +231,6 @@ class SBoInstall: """ sbo_versions, sources = [], [] for sbo in slackbuilds: - status(0.02) sbo_ver = f"{sbo}-{SBoGrep(sbo).version()}" sbo_versions.append(sbo_ver) sources.append(SBoGrep(sbo).source()) diff --git a/slpkg/slack/patches.py b/slpkg/slack/patches.py index a5618d76..f2850673 100644 --- a/slpkg/slack/patches.py +++ b/slpkg/slack/patches.py @@ -31,7 +31,6 @@ from slpkg.utils import Utils from slpkg.sizes import units from slpkg.messages import Msg from slpkg.url_read import URL -from slpkg.toolbar import status from slpkg.checksum import check_md5 from slpkg.blacklist import BlackList from slpkg.downloader import Download @@ -138,7 +137,6 @@ class Patches: data = repo_data(self.PACKAGES_TXT, "slack", self.flag) black = BlackList().packages(pkgs=data[0], repo="slack") for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]): - status(0.0003) repo_pkg_name = split_package(name)[0] if (not os.path.isfile(self.meta.pkg_path + name[:-4]) and repo_pkg_name not in black and @@ -163,9 +161,8 @@ class Patches: text = "Press 'spacebar' to unchoose packages from upgrade" title = " Upgrade " backtitle = f"{self.meta.__all__} {self.meta.__version__}" - status = True pkgs = DialogUtil(data, text, title, backtitle, - status).checklist() + status=True).checklist() index = 0 for pkg, comp, uncomp in zip(self.upgrade_all, self.comp_sum, self.uncomp_sum): diff --git a/slpkg/toolbar.py b/slpkg/toolbar.py index 9e23444c..91a0cede 100644 --- a/slpkg/toolbar.py +++ b/slpkg/toolbar.py @@ -22,7 +22,6 @@ # along with this program. If not, see . -import sys import time from slpkg.__metadata__ import MetaData as _meta_ From 1d00a34dd56abdc3f7dfc5d97584d79f45315e17 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Feb 2020 20:21:28 +0100 Subject: [PATCH 05/29] Removed toolbar Signed-off-by: Dimitris Zlatanidis --- ChangeLog.txt | 4 +++- slpkg/toolbar.py | 38 -------------------------------------- 2 files changed, 3 insertions(+), 39 deletions(-) delete mode 100644 slpkg/toolbar.py diff --git a/ChangeLog.txt b/ChangeLog.txt index d9a6a368..e44ef3f3 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,7 +1,9 @@ 3.8.1 - 13/02/2020 -FIxed: +Fixed: - Bugfix double install packages from slack regular repo and patches directory #122 +Updated: +- Removed status progress bar 3.8.0 - 05/02/2020 Added: diff --git a/slpkg/toolbar.py b/slpkg/toolbar.py deleted file mode 100644 index 91a0cede..00000000 --- a/slpkg/toolbar.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/python3 -# -*- coding: utf-8 -*- - -# toolbar.py file is part of slpkg. - -# Copyright 2014-2020 Dimitris Zlatanidis -# All rights reserved. - -# Slpkg is a user-friendly package manager for Slackware installations - -# https://gitlab.com/dslackw/slpkg - -# Slpkg is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - - -import time - -from slpkg.__metadata__ import MetaData as _meta_ - - -def status(sec): - """Toolbar progressive status - """ - if _meta_.prg_bar in ["on", "ON"]: - syms = ["|", "/", "-", "\\"] - for sym in syms: - print(f"\b{_meta_.color['GREY']}{sym}{_meta_.color['ENDC']}", end="") - print(end="", flush=True) - time.sleep(float(sec)) From cc3708b9666fd1ce5e5dcf6ce7dfd0da2f2959a8 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Feb 2020 20:41:15 +0100 Subject: [PATCH 06/29] Updated setup Signed-off-by: Dimitris Zlatanidis --- ChangeLog.txt | 1 + setup.py | 39 ++++++++++--------------------------- slackbuild/slpkg.SlackBuild | 13 +------------ slpkg/__metadata__.py | 2 +- 4 files changed, 13 insertions(+), 42 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index e44ef3f3..40f86511 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -4,6 +4,7 @@ Fixed: and patches directory #122 Updated: - Removed status progress bar +- Setup and installing 3.8.0 - 05/02/2020 Added: diff --git a/setup.py b/setup.py index d66454e3..acf3bff5 100755 --- a/setup.py +++ b/setup.py @@ -25,8 +25,6 @@ import os import sys import time -import shutil -from slpkg.md5sum import md5 from slpkg.__metadata__ import MetaData as _meta_ try: @@ -79,7 +77,16 @@ setup( package_data={"": ["LICENSE", "README.md", "CHANGELOG"]}, data_files=[("man/man8", ["man/slpkg.8"]), ("/etc/bash_completion.d", ["conf/slpkg.bash-completion"]), - ("/etc/fish/completions", ["conf/slpkg.fish"])], + ("/etc/fish/completions", ["conf/slpkg.fish"]), + ("/etc/slpkg", ["conf/slpkg.conf", + "conf/repositories.conf", + "conf/blacklist", + "conf/slackware-mirrors", + "conf/default-repositories", + "conf/custom-repositories", + "conf/rlworkman.deps", + "conf/pkg_security"]) + ], install_requires=install_requires, extras_require={ "optional": optional_requires, @@ -104,29 +111,3 @@ setup( "Topic :: Utilities"], python_requires=">=3.7" ) - -# Install configuration files with pip. -if "install" in sys.argv: - conf_file = [ - "conf/slpkg.conf", - "conf/repositories.conf", - "conf/blacklist", - "conf/slackware-mirrors", - "conf/default-repositories", - "conf/custom-repositories", - "conf/rlworkman.deps", - "conf/pkg_security" - ] - if not os.path.exists(_meta_.conf_path): - os.makedirs(_meta_.conf_path) - for conf in conf_file: - filename = conf.split("/")[-1] - if os.path.isfile(_meta_.conf_path + filename): - old = md5(_meta_.conf_path + filename) - new = md5(conf) - if old != new: - shutil.copy2(conf, _meta_.conf_path + filename + ".new") - else: - shutil.copy2(conf, _meta_.conf_path) - shutil.copy2(conf_file[0], - _meta_.conf_path + conf_file[0].split("/")[-1] + ".orig") diff --git a/slackbuild/slpkg.SlackBuild b/slackbuild/slpkg.SlackBuild index 0f3496d9..8a909964 100755 --- a/slackbuild/slpkg.SlackBuild +++ b/slackbuild/slpkg.SlackBuild @@ -77,22 +77,11 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; -# skip pip installs -sed -i 's/if "install"/if ""/' setup.py - python3 setup.py install --root=$PKG find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true -mkdir -p $PKG/etc/slpkg -# install configurations files -CONFIGS="slpkg.conf repositories.conf blacklist slackware-mirrors default-repositories \ - custom-repositories rlworkman.deps pkg_security" -for file in $CONFIGS; do - install -D -m0644 conf/$file $PKG/etc/slpkg/${file}.new -done - # keep original configuration file for reset cp -p conf/slpkg.conf $PKG/etc/slpkg/slpkg.conf.orig @@ -111,4 +100,4 @@ cat $CWD/doinst.sh > $PKG/install/doinst.sh cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz} -$INSTALL $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz +$INSTALL $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz \ No newline at end of file diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py index d9d5aaba..2be4e835 100644 --- a/slpkg/__metadata__.py +++ b/slpkg/__metadata__.py @@ -76,7 +76,7 @@ class MetaData: __all__ = "slpkg" __author__ = "dslackw" - __version_info__ = (3, 8, 0) + __version_info__ = (3, 8, 1) __version__ = "{0}.{1}.{2}".format(*__version_info__) __license__ = "GNU General Public License v3 (GPLv3)" __email__ = "d.zlatanidis@gmail.com" From aac32b7a1493d474d9f16c543c42751590500d79 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Feb 2020 22:12:28 +0100 Subject: [PATCH 07/29] Updated installation method Signed-off-by: Dimitris Zlatanidis --- INSTALL.md | 7 ++----- setup.py | 25 +++++++------------------ slackbuild/doinst.sh | 2 +- slackbuild/slpkg.SlackBuild | 8 ++++++++ 4 files changed, 18 insertions(+), 24 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 8ff23b8f..b4f7ce56 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -11,7 +11,7 @@ distribution like SalixOS, Slackel etc. ##### Install slpkg -There are mainly 3 ways: +There are mainly 2 ways: 1. Suggested method, download latest slpkg version from: '`https://gitlab.com/dslackw/slpkg/releases`' @@ -20,7 +20,4 @@ There are mainly 3 ways: slpkg auto-installed as Slackware package (root privileges are required). 2. Download binary package from '`https://sourceforge.net/projects/slpkg/files/binary/`' - and use Slackware command '`upgradepkg --install-new `' - -3. Using pip: '`pip3 install https://gitlab.com/dslackw/slpkg/-/archive/3.8.0/slpkg-3.8.0.tar.gz`' - or instead '`'python3 -m pip install`''. + and use Slackware command '`upgradepkg --install-new `' \ No newline at end of file diff --git a/setup.py b/setup.py index acf3bff5..ef4cce17 100755 --- a/setup.py +++ b/setup.py @@ -23,7 +23,6 @@ import os -import sys import time from slpkg.__metadata__ import MetaData as _meta_ @@ -50,12 +49,11 @@ optional_requires = [ def print_logo(): """print slpkg logo""" - if "install" not in sys.argv: - logo_fname = os.path.join(os.path.dirname(__file__), 'logo.txt') - with open(logo_fname, 'rb') as f: - logo = f.read().decode('utf-8') - print(logo) - time.sleep(1) + logo_fname = os.path.join(os.path.dirname(__file__), 'logo.txt') + with open(logo_fname, 'rb') as f: + logo = f.read().decode('utf-8') + print(logo) + time.sleep(1) print_logo() @@ -77,16 +75,7 @@ setup( package_data={"": ["LICENSE", "README.md", "CHANGELOG"]}, data_files=[("man/man8", ["man/slpkg.8"]), ("/etc/bash_completion.d", ["conf/slpkg.bash-completion"]), - ("/etc/fish/completions", ["conf/slpkg.fish"]), - ("/etc/slpkg", ["conf/slpkg.conf", - "conf/repositories.conf", - "conf/blacklist", - "conf/slackware-mirrors", - "conf/default-repositories", - "conf/custom-repositories", - "conf/rlworkman.deps", - "conf/pkg_security"]) - ], + ("/etc/fish/completions", ["conf/slpkg.fish"])], install_requires=install_requires, extras_require={ "optional": optional_requires, @@ -110,4 +99,4 @@ setup( "Topic :: System :: Software Distribution", "Topic :: Utilities"], python_requires=">=3.7" -) +) \ No newline at end of file diff --git a/slackbuild/doinst.sh b/slackbuild/doinst.sh index 1f7ce244..8eb6acd1 100644 --- a/slackbuild/doinst.sh +++ b/slackbuild/doinst.sh @@ -16,4 +16,4 @@ done if [ -x /usr/bin/update-desktop-database ]; then /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1 -fi +fi \ No newline at end of file diff --git a/slackbuild/slpkg.SlackBuild b/slackbuild/slpkg.SlackBuild index 8a909964..b9aca314 100755 --- a/slackbuild/slpkg.SlackBuild +++ b/slackbuild/slpkg.SlackBuild @@ -82,6 +82,14 @@ python3 setup.py install --root=$PKG find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true +# install configuration files +mkdir -p $PKG/etc/slpkg +CONFIGS="slpkg.conf repositories.conf blacklist slackware-mirrors \ + default-repositories custom-repositories rlworkman.deps pkg_security" +for file in $CONFIGS; do + install -D -m0644 conf/$file $PKG/etc/slpkg/${file}.new +done + # keep original configuration file for reset cp -p conf/slpkg.conf $PKG/etc/slpkg/slpkg.conf.orig From 01dc98b778f0e6ac0cdd7a0af2b445cfb8be7210 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 13 Feb 2020 22:21:32 +0100 Subject: [PATCH 08/29] Updated copyright year Signed-off-by: Dimitris Zlatanidis --- conf/slpkg.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/slpkg.conf b/conf/slpkg.conf index 002059e7..ad090e24 100644 --- a/conf/slpkg.conf +++ b/conf/slpkg.conf @@ -2,7 +2,7 @@ # # slpkg.conf file is part of slpkg. # -# Copyright 2014-2019 Dimitris Zlatanidis +# Copyright 2014-2020 Dimitris Zlatanidis # All rights reserved. # # Slpkg is a user-friendly package manager for Slackware installations. From b74569bd02450c71e3ea62c1c97444d97c5c6fcc Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 14 Feb 2020 00:26:38 +0100 Subject: [PATCH 09/29] Fixed counting reinstalling packages Signed-off-by: Dimitris Zlatanidis --- slpkg/binary/install.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/slpkg/binary/install.py b/slpkg/binary/install.py index f7c0f23c..c85a58ac 100644 --- a/slpkg/binary/install.py +++ b/slpkg/binary/install.py @@ -46,8 +46,6 @@ from slpkg.binary.greps import repo_data from slpkg.binary.repo_init import RepoInit from slpkg.binary.dependency import Dependencies -from slpkg.slack.slack_version import slack_ver - class BinaryInstall: """Install binaries packages with all dependencies from @@ -288,7 +286,8 @@ class BinaryInstall: for pkg, comp in zip(install, comp_sum): pkg_repo = split_package(pkg[:-4]) if find_package(pkg[:-4], self.meta.pkg_path): - pkg_sum += 1 + if "--reinstall" in self.flag: + pkg_sum += 1 COLOR = self.meta.color["GREEN"] elif pkg_repo[0] == GetFromInstalled(pkg_repo[0]).name(): COLOR = self.meta.color["YELLOW"] From 2bcaab8f18e5342529bf1531bf4706aa32e1ea63 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 14 Feb 2020 01:06:39 +0100 Subject: [PATCH 10/29] Updated managed blacklist Signed-off-by: Dimitris Zlatanidis --- ChangeLog.txt | 1 + EXAMPLES.md | 7 ------ slpkg/binary/install.py | 2 +- slpkg/binary/search.py | 2 +- slpkg/blacklist.py | 53 +---------------------------------------- slpkg/pkg/find.py | 2 +- slpkg/sbo/check.py | 2 +- slpkg/sbo/dependency.py | 3 +-- slpkg/sbo/network.py | 2 +- slpkg/sbo/slackbuild.py | 2 +- slpkg/slack/patches.py | 2 +- slpkg/tracking.py | 2 +- 12 files changed, 11 insertions(+), 69 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 40f86511..06f10479 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -5,6 +5,7 @@ Fixed: Updated: - Removed status progress bar - Setup and installing +- Managed blacklit in the simple way 3.8.0 - 05/02/2020 Added: diff --git a/EXAMPLES.md b/EXAMPLES.md index b8181bd1..04c0797b 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -1202,14 +1202,7 @@ Packages in blacklist: live555 faac -Note: you can use asterisk "*" to match more packages like: -*lib* \\ Add all packages inlcude string "lib" -*lib \\ Add all packages ends with string "lib" -lib* \\ Add all packages starts with string "lib" - -multi:*multilib* \\ Add all packages include string "multilib" from "multi" - \\ repository. ``` Print a package description: diff --git a/slpkg/binary/install.py b/slpkg/binary/install.py index c85a58ac..9852d432 100644 --- a/slpkg/binary/install.py +++ b/slpkg/binary/install.py @@ -79,7 +79,7 @@ class BinaryInstall: self.repo_pkg_names = [] for name in self.data[0]: self.repo_pkg_names.append(split_package(name)[0]) - self.blacklist = BlackList().packages(self.data[0], self.repo) + self.blacklist = BlackList().get_black() self.matching = False def init_flags(self): diff --git a/slpkg/binary/search.py b/slpkg/binary/search.py index 548c8565..4aa548d5 100644 --- a/slpkg/binary/search.py +++ b/slpkg/binary/search.py @@ -33,6 +33,6 @@ def search_pkg(name, repo): """ PACKAGES_TXT = Utils().read_file(_meta_.lib_path + f"{repo}_repo/PACKAGES.TXT") names = list(Utils().package_name(PACKAGES_TXT)) - blacklist = BlackList().packages(pkgs=names, repo=repo) + blacklist = BlackList().get_black() if name in names and name not in blacklist: return name \ No newline at end of file diff --git a/slpkg/blacklist.py b/slpkg/blacklist.py index 284a9221..0bc45868 100644 --- a/slpkg/blacklist.py +++ b/slpkg/blacklist.py @@ -25,7 +25,6 @@ import os from slpkg.utils import Utils -from slpkg.splitting import split_package from slpkg.__metadata__ import MetaData as _meta_ @@ -90,54 +89,4 @@ class BlackList: print(f"{self.red}{line}{self.endc}") self.quit = True if self.quit: - print() # new line at exit - - def packages(self, pkgs, repo): - """Return packages in blacklist or by repository - """ - self.black = [] - for bl in self.get_black(): - pr = bl.split(":") - for pkg in pkgs: - self.__priority(pr, repo, pkg) - self.__blackpkg(bl, repo, pkg) - return self.black - - def __add(self, repo, pkg): - """Split packages by repository - """ - if repo == "sbo": - return pkg - else: - return split_package(pkg)[0] - - def __priority(self, pr, repo, pkg): - """Add packages in blacklist by priority - """ - if (pr[0] == repo and pr[1].startswith("*") and - pr[1].endswith("*")): - if pr[1][1:-1] in pkg: - self.black.append(self.__add(repo, pkg)) - elif pr[0] == repo and pr[1].endswith("*"): - if pkg.startswith(pr[1][:-1]): - self.black.append(self.__add(repo, pkg)) - elif pr[0] == repo and pr[1].startswith("*"): - if pkg.endswith(pr[1][1:]): - self.black.append(self.__add(repo, pkg)) - elif pr[0] == repo and "*" not in pr[1]: - self.black.append(self.__add(repo, pkg)) - - def __blackpkg(self, bl, repo, pkg): - """Add packages in blacklist - """ - if bl.startswith("*") and bl.endswith("*"): - if bl[1:-1] in pkg: - self.black.append(self.__add(repo, pkg)) - elif bl.endswith("*"): - if pkg.startswith(bl[:-1]): - self.black.append(self.__add(repo, pkg)) - elif bl.startswith("*"): - if pkg.endswith(bl[1:]): - self.black.append(self.__add(repo, pkg)) - if bl not in self.black and "*" not in bl: - self.black.append(bl) + print() # new line at exit \ No newline at end of file diff --git a/slpkg/pkg/find.py b/slpkg/pkg/find.py index 3133257b..8dffd840 100644 --- a/slpkg/pkg/find.py +++ b/slpkg/pkg/find.py @@ -32,7 +32,7 @@ def searching(find_pkg, directory): """ if os.path.isdir(directory): installed = os.listdir(directory) - blacklist = BlackList().packages(pkgs=installed, repo="local") + blacklist = BlackList().get_black() if os.path.exists(directory): for pkg in installed: if (not pkg.startswith(".") and pkg.startswith(find_pkg) and diff --git a/slpkg/sbo/check.py b/slpkg/sbo/check.py index 37688e36..3f84a33d 100644 --- a/slpkg/sbo/check.py +++ b/slpkg/sbo/check.py @@ -40,7 +40,7 @@ def sbo_upgrade(skip, flag): Msg().checking() upgrade_names = [] data = SBoGrep(name="").names() - blacklist = BlackList().packages(pkgs=data, repo="sbo") + blacklist = BlackList().get_black() for pkg in sbo_list(): name = split_package(pkg)[0] ver = split_package(pkg)[1] diff --git a/slpkg/sbo/dependency.py b/slpkg/sbo/dependency.py index e996a08f..c06a14e4 100644 --- a/slpkg/sbo/dependency.py +++ b/slpkg/sbo/dependency.py @@ -37,8 +37,7 @@ class Requires: self.flag = flag self.meta = _meta_ self.SLACKBUILDS_TXT = SBoGrep(name="").names() - self.blacklist = BlackList().packages(pkgs=self.SLACKBUILDS_TXT, - repo="sbo") + self.blacklist = BlackList().get_black() self.dep_results = [] def sbo(self, name): diff --git a/slpkg/sbo/network.py b/slpkg/sbo/network.py index 411b8580..75385c1f 100644 --- a/slpkg/sbo/network.py +++ b/slpkg/sbo/network.py @@ -76,7 +76,7 @@ class SBoNetwork: self.with_checklist() grep = SBoGrep(self.name) self.sbo_files = grep.files() - self.blacklist = BlackList().packages(pkgs=self.data, repo="sbo") + self.blacklist = BlackList().get_black() self.sbo_url = sbo_search_pkg(self.name) if self.sbo_url: self.sbo_desc = grep.description()[len(self.name) + 2:-1] diff --git a/slpkg/sbo/slackbuild.py b/slpkg/sbo/slackbuild.py index 7e862a92..0e887f84 100644 --- a/slpkg/sbo/slackbuild.py +++ b/slpkg/sbo/slackbuild.py @@ -80,7 +80,7 @@ class SBoInstall: self.count_uni = 0 self.msg.reading() self.data = SBoGrep(name="").names() - self.blacklist = BlackList().packages(pkgs=self.data, repo="sbo") + self.blacklist = BlackList().get_black() def init_flags(self): """Flags initialization diff --git a/slpkg/slack/patches.py b/slpkg/slack/patches.py index f2850673..fe3d959d 100644 --- a/slpkg/slack/patches.py +++ b/slpkg/slack/patches.py @@ -135,7 +135,7 @@ class Patches: Store and return packages for upgrading """ data = repo_data(self.PACKAGES_TXT, "slack", self.flag) - black = BlackList().packages(pkgs=data[0], repo="slack") + black = BlackList().get_black() for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]): repo_pkg_name = split_package(name)[0] if (not os.path.isfile(self.meta.pkg_path + name[:-4]) and diff --git a/slpkg/tracking.py b/slpkg/tracking.py index 6457ba8a..414daf39 100644 --- a/slpkg/tracking.py +++ b/slpkg/tracking.py @@ -129,7 +129,7 @@ class TrackingDeps: self.bin_case_insensitive() self.find_pkg = search_pkg(self.name, self.repo) if self.find_pkg: - self.black = BlackList().packages(self.names, self.repo) + self.black = BlackList().get_black() self.dependencies_list = Dependencies( self.repo, self.black).binary(self.name, self.flag) From 1f40f728340fb06fb108c7a1e6693f7e91a5dbb5 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 14 Feb 2020 10:33:24 +0100 Subject: [PATCH 11/29] Remove unused --- slpkg/blacklist.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/slpkg/blacklist.py b/slpkg/blacklist.py index 0bc45868..6e70d57c 100644 --- a/slpkg/blacklist.py +++ b/slpkg/blacklist.py @@ -32,7 +32,6 @@ class BlackList: """Blacklist class to add, remove or listed packages in blacklist file.""" def __init__(self): - self.quit = False self.green = _meta_.color["GREEN"] self.red = _meta_.color["RED"] self.endc = _meta_.color["ENDC"] @@ -58,9 +57,7 @@ class BlackList: for black in self.get_black(): if black: print(f"{self.green}{black}{self.endc}") - self.quit = True - if self.quit: - print() # new line at exit + print() def add(self, pkgs): """Add blacklist packages if not exist @@ -73,9 +70,7 @@ class BlackList: if pkg not in blacklist: print(f"{self.green}{pkg}{self.endc}") black_conf.write(pkg + "\n") - self.quit = True - if self.quit: - print() # new line at exit + print() def remove(self, pkgs): """Remove packages from blacklist @@ -87,6 +82,4 @@ class BlackList: remove.write(line + "\n") else: print(f"{self.red}{line}{self.endc}") - self.quit = True - if self.quit: - print() # new line at exit \ No newline at end of file + print() \ No newline at end of file From 6c3f50668e761581404c0845d0856375caf8544b Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 14 Feb 2020 12:41:41 +0100 Subject: [PATCH 12/29] Reduce the blacklist file --- conf/blacklist | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/conf/blacklist b/conf/blacklist index 72f68ed9..0a5c3895 100644 --- a/conf/blacklist +++ b/conf/blacklist @@ -2,26 +2,6 @@ # # blacklist file is part of slpkg. # -# Copyright 2014-2019 Dimitris Zlatanidis -# All rights reserved. -# -# Slpkg is a user-friendly package manager for Slackware installations. -# -# https://gitlab.com/dslackw/slpkg -# -# Slpkg is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -# END OF LEGAL NOTICE -# # ---------------------------------------------------------------------------- # This is the blacklist file. Each package listed here may not be # installed be upgraded be find or deleted. @@ -30,15 +10,6 @@ # To blacklist the package 'wicd-1.7.2.4-x86_64-4.txz' the line will be: # wicd # -# This one will blacklist all packages include string "lib" in package name: -# *lib* -# -# Add packages in blacklist by repository: -# slacky:* `add all packages from the slacky repository` -# sbo:py* `add all packages from the sbo starts with 'py'` -# sbo:jdk `add jdk package from the sbo repository` -# slack:*multi* `add packages include string 'multi' from the slack` -# msb:*.txz `add packages ends with '.txz' from the msb repository` # # Sometimes the automatic kernel update creates problems because you # may need to file intervention 'lilo'. The slpkg automatically detects From 6c026f9023b86210ad8190737d93545a6fe5a119 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 14 Feb 2020 12:51:09 +0100 Subject: [PATCH 13/29] Fixed print view --- slpkg/blacklist.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/slpkg/blacklist.py b/slpkg/blacklist.py index 6e70d57c..967b3480 100644 --- a/slpkg/blacklist.py +++ b/slpkg/blacklist.py @@ -53,11 +53,10 @@ class BlackList: def listed(self): """Print blacklist packages """ - print("\nPackages in the blacklist:\n") + print("Packages in the blacklist:\n") for black in self.get_black(): if black: print(f"{self.green}{black}{self.endc}") - print() def add(self, pkgs): """Add blacklist packages if not exist @@ -70,7 +69,6 @@ class BlackList: if pkg not in blacklist: print(f"{self.green}{pkg}{self.endc}") black_conf.write(pkg + "\n") - print() def remove(self, pkgs): """Remove packages from blacklist @@ -81,5 +79,4 @@ class BlackList: if line not in pkgs: remove.write(line + "\n") else: - print(f"{self.red}{line}{self.endc}") - print() \ No newline at end of file + print(f"{self.red}{line}{self.endc}") \ No newline at end of file From aa3329ecc67935d75d35032ca41138654ee2f96f Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 14 Feb 2020 12:53:47 +0100 Subject: [PATCH 14/29] Fixed print headers --- slpkg/blacklist.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slpkg/blacklist.py b/slpkg/blacklist.py index 967b3480..4146c3c9 100644 --- a/slpkg/blacklist.py +++ b/slpkg/blacklist.py @@ -63,7 +63,7 @@ class BlackList: """ blacklist = self.get_black() pkgs = set(pkgs) - print("\nAdd packages in the blacklist:\n") + print("Add packages in the blacklist:\n") with open(self.blackfile, "a") as black_conf: for pkg in pkgs: if pkg not in blacklist: @@ -73,7 +73,7 @@ class BlackList: def remove(self, pkgs): """Remove packages from blacklist """ - print("\nRemove packages from the blacklist:\n") + print("Remove packages from the blacklist:\n") with open(self.blackfile, "w") as remove: for line in self.black_conf.splitlines(): if line not in pkgs: From aee88ac8c70e378edf626f85f89f6ee6978a65da Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 14 Feb 2020 13:35:00 +0100 Subject: [PATCH 15/29] Fixed style --- slpkg/repoinfo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slpkg/repoinfo.py b/slpkg/repoinfo.py index 253c4f2e..27e7153b 100644 --- a/slpkg/repoinfo.py +++ b/slpkg/repoinfo.py @@ -64,7 +64,7 @@ class RepoInfo: if repo in self.meta.default_repositories: self.form["Default:"] = "yes" if (repo in self.meta.repositories and - os.path.isfile(self.meta.lib_path + f"{repo}_repo/PACKAGES.TXT")): + os.path.isfile(self.meta.lib_path + f"{repo}_repo/PACKAGES.TXT")): status = f"{self.green}enabled{self.endc}" if repo != "sbo": data = self.repository_data(repo) From dd4e55b3d66fcb68a906397c7fee3bd68c0c54aa Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 14 Feb 2020 13:35:27 +0100 Subject: [PATCH 16/29] Added filesize test --- tests/test_file_size.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/test_file_size.py diff --git a/tests/test_file_size.py b/tests/test_file_size.py new file mode 100644 index 00000000..c6865c7f --- /dev/null +++ b/tests/test_file_size.py @@ -0,0 +1,10 @@ +from slpkg.file_size import FileSize + + +def test_FileSize(): + url = "https://mirrors.slackware.com/slackware/slackware64-14.2/ChangeLog.txt" + lc = "tests/test_units.py" + fs1 = FileSize(url) + fs2 = FileSize(lc) + assert fs1.server() is not None + assert fs2.local() is not None From 5bbfe9eacf3b3077df5f5f1ef15a9f7bce10d782 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 14 Feb 2020 13:50:47 +0100 Subject: [PATCH 17/29] Updated code style --- slpkg/repoinfo.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/slpkg/repoinfo.py b/slpkg/repoinfo.py index 27e7153b..f64380b0 100644 --- a/slpkg/repoinfo.py +++ b/slpkg/repoinfo.py @@ -61,11 +61,14 @@ class RepoInfo: status = f"{self.red}disabled{self.endc}" self.form["Status:"] = status self.form["Default:"] = "no" + if repo in self.meta.default_repositories: self.form["Default:"] = "yes" + if (repo in self.meta.repositories and os.path.isfile(self.meta.lib_path + f"{repo}_repo/PACKAGES.TXT")): status = f"{self.green}enabled{self.endc}" + if repo != "sbo": data = self.repository_data(repo) size = units(data[1], data[2]) @@ -79,18 +82,20 @@ class RepoInfo: self.form["Status:"] = status self.form["Last updated:"] = data[3] elif (repo == "sbo" and os.path.isfile( - self.meta.lib_path + "{0}_repo/SLACKBUILDS.TXT".format(repo))): - status = "{0}enabled{1}".format(self.meta.color["GREEN"], - self.meta.color["ENDC"]) + self.meta.lib_path + f"{repo}_repo/SLACKBUILDS.TXT")): + status = f"{self.green}enabled{self.endc}" sum_sbo_pkgs = 0 + for line in (Utils().read_file( self.meta.lib_path + "sbo_repo/SLACKBUILDS." "TXT").splitlines()): if line.startswith("SLACKBUILD NAME: "): sum_sbo_pkgs += 1 + changelog_txt = Utils().read_file( self.meta.log_path + "sbo/ChangeLog.txt") last_upd = changelog_txt.split("\n", 1)[0] + self.form["Repo id:"] = repo self.form["Repo url:"] = self.all_repos[repo] self.form["Total compressed packages:"] = "" @@ -98,19 +103,17 @@ class RepoInfo: self.form["Number of packages:"] = sum_sbo_pkgs self.form["Status:"] = status self.form["Last updated:"] = last_upd - print() + for key, value in sorted(self.form.items()): - print(self.meta.color["GREY"] + key + self.meta.color["ENDC"], - value) - print() - raise SystemExit() + print(f"{self.green}{key}{self.endc} {value}") def repository_data(self, repo): """ Grap data packages """ sum_pkgs, size, unsize, last_upd = 0, [], [], "" - f = self.meta.lib_path + repo + "_repo/PACKAGES.TXT" + f = f"{self.meta.lib_path}{repo}_repo/PACKAGES.TXT" + for line in Utils().read_file(f).splitlines(): if line.startswith("PACKAGES.TXT;"): last_upd = line[14:].strip() @@ -120,8 +123,10 @@ class RepoInfo: size.append(line[28:-2].strip()) if line.startswith("PACKAGE SIZE (uncompressed): "): unsize.append(line[30:-2].strip()) + if repo in ["salix", "slackl"]: log = Utils().read_file( - self.meta.log_path + "{0}/ChangeLog.txt".format(repo)) + self.meta.log_path + f"{repo}/ChangeLog.txt") last_upd = log.split("\n", 1)[0] - return [sum_pkgs, size, unsize, last_upd] + + return [sum_pkgs, size, unsize, last_upd] \ No newline at end of file From 25e854963ccb98a8abba26b06efc45d739c24683 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 14 Feb 2020 14:04:06 +0100 Subject: [PATCH 18/29] Updated code style --- slpkg/repolist.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/slpkg/repolist.py b/slpkg/repolist.py index c222024e..37f4fc1a 100644 --- a/slpkg/repolist.py +++ b/slpkg/repolist.py @@ -32,6 +32,10 @@ class RepoList: """ def __init__(self): self.meta = _meta_ + self.green = self.meta.color["GREEN"] + self.red = self.meta.color["RED"] + self.grey = self.meta.color["GREY"] + self.endc = self.meta.color["ENDC"] self.msg = Msg() self.all_repos = Repo().default_repository() self.all_repos["slack"] = Repo().slack() @@ -41,7 +45,6 @@ class RepoList: """View or enabled or disabled repositories """ def_cnt, cus_cnt = 0, 0 - print() self.msg.template(78) print("{0}{1}{2}{3}{4}{5}{6}".format( "| Repo id", " " * 2, @@ -50,13 +53,13 @@ class RepoList: "Status")) self.msg.template(78) for repo_id, repo_URL in sorted(self.all_repos.items()): - status, COLOR = "disabled", self.meta.color["RED"] + status, COLOR = "disabled", self.red default = "yes" if len(repo_URL) > 49: repo_URL = repo_URL[:48] + "~" if repo_id in self.meta.repositories: def_cnt += 1 - status, COLOR = "enabled", self.meta.color["GREEN"] + status, COLOR = "enabled", self.green if repo_id not in self.meta.default_repositories: cus_cnt += 1 default = "no" @@ -64,13 +67,12 @@ class RepoList: repo_id, " " * (9 - len(repo_id)), repo_URL, " " * (52 - len(repo_URL)), default, " " * (8 - len(default)), - COLOR, status, self.meta.color["ENDC"])) + COLOR, status, self.endc)) print("\nRepositories summary") print("=" * 79) - print("{0}{1}/{2} enabled default repositories and {3} custom.".format( - self.meta.color["GREY"], def_cnt, len(self.all_repos), cus_cnt)) + print(f"{self.grey}{def_cnt}/{len(self.all_repos)} enabled default " + f"repositories and {cus_cnt} custom.") print("Edit the file '/etc/slpkg/repositories.conf' for enable " "and disable default\nrepositories or run 'slpkg " - "repo-enable' command.\n{0}".format(self.meta.color["ENDC"])) - raise SystemExit() + f"repo-enable' command.{self.endc}") From 5af887695652a36e51fd9c7a1af75720afb380c0 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 14 Feb 2020 15:51:28 +0100 Subject: [PATCH 19/29] Updated to generator --- slpkg/sbo/check.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/slpkg/sbo/check.py b/slpkg/sbo/check.py index 3f84a33d..3c8d5db6 100644 --- a/slpkg/sbo/check.py +++ b/slpkg/sbo/check.py @@ -37,7 +37,8 @@ from slpkg.sbo.greps import SBoGrep def sbo_upgrade(skip, flag): """Return packages for upgrade """ - Msg().checking() + msg = Msg() + msg.checking() upgrade_names = [] data = SBoGrep(name="").names() blacklist = BlackList().get_black() @@ -49,7 +50,7 @@ def sbo_upgrade(skip, flag): package = f"{name}-{ver}" if parse_version(sbo_package) > parse_version(package): upgrade_names.append(name) - Msg().done() + msg.done() if "--checklist" in flag: upgrade_names = choose_upg(upgrade_names) return upgrade_names @@ -58,8 +59,6 @@ def sbo_upgrade(skip, flag): def sbo_list(): """Return all SBo packages """ - sbo_packages = [] for pkg in os.listdir(_meta_.pkg_path): if pkg.endswith("_SBo"): - sbo_packages.append(pkg) - return sbo_packages + yield pkg \ No newline at end of file From 99b3f5b45696fc5f13acc7324b4d37cebb4bf3f6 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 14 Feb 2020 15:56:43 +0100 Subject: [PATCH 20/29] Updated code style Signed-off-by: Dimitris Zlatanidis --- setup.py | 2 +- slpkg/checks.py | 1 - slpkg/config.py | 1 - slpkg/desc.py | 6 +----- slpkg/slack/patches.py | 4 ++-- slpkg/slack/slackware_repo.py | 2 +- 6 files changed, 5 insertions(+), 11 deletions(-) diff --git a/setup.py b/setup.py index ef4cce17..5c544616 100755 --- a/setup.py +++ b/setup.py @@ -53,7 +53,7 @@ def print_logo(): with open(logo_fname, 'rb') as f: logo = f.read().decode('utf-8') print(logo) - time.sleep(1) + time.sleep(0.5) print_logo() diff --git a/slpkg/checks.py b/slpkg/checks.py index 1c0fab67..26f79bed 100644 --- a/slpkg/checks.py +++ b/slpkg/checks.py @@ -66,7 +66,6 @@ class Updates: def status_bar(self): """Top view bar status """ - print() self.msg.template(78) print("| Repository Status") self.msg.template(78) diff --git a/slpkg/config.py b/slpkg/config.py index 09b953d7..9cac90d7 100644 --- a/slpkg/config.py +++ b/slpkg/config.py @@ -44,7 +44,6 @@ class Config: def view(self): """View slpkg config file """ - print() # new line at start conf_args = [ "RELEASE", "SLACKWARE_VERSION", diff --git a/slpkg/desc.py b/slpkg/desc.py index 42823a42..00267752 100644 --- a/slpkg/desc.py +++ b/slpkg/desc.py @@ -53,7 +53,6 @@ class PkgDesc: def view(self): """Print package description by repository """ - print() # new line at start description, count = "", 0 if self.repo == "sbo": description = SBoGrep(self.name).description() @@ -68,7 +67,4 @@ class PkgDesc: if description: print(f"{self.color}{description}{self.meta.color['ENDC']}") else: - self.msg.pkg_not_found("", self.name, "No matching", "\n") - raise SystemExit(1) - if description and self.repo == "sbo": - print() + self.msg.pkg_not_found("", self.name, "No matching", "") \ No newline at end of file diff --git a/slpkg/slack/patches.py b/slpkg/slack/patches.py index fe3d959d..6b145bb3 100644 --- a/slpkg/slack/patches.py +++ b/slpkg/slack/patches.py @@ -184,10 +184,10 @@ class Patches: """ for upg, size in sorted(zip(self.upgrade_all, self.comp_sum)): pkg_repo = split_package(upg[:-4]) - color = self.meta.color["RED"] + color = self.red pkg_inst = GetFromInstalled(pkg_repo[0]).name() if pkg_repo[0] == pkg_inst: - color = self.meta.color["YELLOW"] + color = self.yellow ver = GetFromInstalled(pkg_repo[0]).version() print(f" {color}{pkg_repo[0] + ver}{self.endc}" f"{' ' * (23-len(pkg_repo[0] + ver))} {pkg_repo[1]}" diff --git a/slpkg/slack/slackware_repo.py b/slpkg/slack/slackware_repo.py index d1e1a4ce..5a177d09 100644 --- a/slpkg/slack/slackware_repo.py +++ b/slpkg/slack/slackware_repo.py @@ -33,7 +33,7 @@ def slackware_repository(): """ slack_repo, packages, names, name = [], [], [], "" slack_repo = repo_data( - Utils().read_file(_meta_.lib_path + "slack_repo/PACKAGES.TXT"), + Utils().read_file(f"{_meta_.lib_path}slack_repo/PACKAGES.TXT"), "slack", "") for pkg in slack_repo[0]: name = split_package(pkg)[0] From 8b371c33430369a9078a7940da38286f6ced1112 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 14 Feb 2020 16:06:36 +0100 Subject: [PATCH 21/29] Remove unused Signed-off-by: Dimitris Zlatanidis --- slpkg/status_deps.py | 1 - 1 file changed, 1 deletion(-) diff --git a/slpkg/status_deps.py b/slpkg/status_deps.py index cacfc6d7..2861d851 100644 --- a/slpkg/status_deps.py +++ b/slpkg/status_deps.py @@ -23,7 +23,6 @@ import os -import sys from slpkg.utils import Utils from slpkg.messages import Msg From 8094eb7ff852ac64a8c7f0edf6d2c19dcf15051e Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 14 Feb 2020 16:12:53 +0100 Subject: [PATCH 22/29] Updated start new line Signed-off-by: Dimitris Zlatanidis --- slpkg/new_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slpkg/new_config.py b/slpkg/new_config.py index b6946bd0..871804bc 100644 --- a/slpkg/new_config.py +++ b/slpkg/new_config.py @@ -62,7 +62,7 @@ class NewConfig: """Find all '.new' files from /etc/ folder and subfolders """ - print("\nSearch for .new configuration files:\n") + print("Search for .new configuration files:\n") for path, dirs, files in os.walk(self.etc): del dirs # delete unsed for f in files: From a8fa5b6b9ac4e7cecb7cc94107b59d3ae4e2093c Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 14 Feb 2020 16:22:01 +0100 Subject: [PATCH 23/29] Updated start new line Signed-off-by: Dimitris Zlatanidis --- slpkg/pkg_find.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slpkg/pkg_find.py b/slpkg/pkg_find.py index bac334e1..afe5d0bb 100644 --- a/slpkg/pkg_find.py +++ b/slpkg/pkg_find.py @@ -45,7 +45,7 @@ class FindFromRepos: def find(self, pkg, flag): """Start to find packages and print """ - print(f"\nPackages with name matching [ {self.cyan}{', '.join(pkg)}{self.endc} ]\n") + print(f"Packages with name matching [ {self.cyan}{', '.join(pkg)}{self.endc} ]\n") Msg().template(78) print(f"| Repository Package {' ' * 54}Size") Msg().template(78) From 7f6adfd5df24aa9531d71cba848a162b7bccefa9 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 14 Feb 2020 17:12:42 +0100 Subject: [PATCH 24/29] Updated code style Signed-off-by: Dimitris Zlatanidis --- slpkg/pkg/manager.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/slpkg/pkg/manager.py b/slpkg/pkg/manager.py index 6203a67a..87220452 100644 --- a/slpkg/pkg/manager.py +++ b/slpkg/pkg/manager.py @@ -199,7 +199,7 @@ class PackageManager: def _view_removed(self): """View packages before removed """ - print("\nPackages with name matching [ {0}{1}{2} ]\n".format( + print("Packages with name matching [ {0}{1}{2} ]\n".format( self.cyan, ", ".join(self.binary), self.endc)) removed, packages = self._get_removed() if packages and "--checklist" in self.extra: @@ -220,10 +220,9 @@ class PackageManager: self._calc_sizes() self._remove_summary() if "--third-party" in self.extra: - print("\n") + print() self.msg.template(78) - print(("| {0}{1}*** WARNING ***{2}").format( - " " * 27, self.red, self.endc)) + print(f"| {' ' * 27}{self.red}*** WARNING ***{self.endc}") print("| Before you use third-party option, be sure you have" " updated the packages \n| lists. Run the command" " 'slpkg update' and 'slpkg -c slack --upgrade'") @@ -395,7 +394,7 @@ class PackageManager: matching, packages = 0, [] pkg_cache, match_cache = "", "" slack_packages, slack_names = slackware_repository() - print("\nPackages with matching name [ {0}{1}{2} ]\n".format( + print("Packages with matching name [ {0}{1}{2} ]\n".format( self.cyan, ", ".join(self.binary), self.endc)) for pkg in self.binary: for match in find_package("", self.meta.pkg_path): @@ -454,7 +453,8 @@ class PackageManager: for pkg in self.binary: name = GetFromInstalled(pkg).name() ver = GetFromInstalled(pkg).version() - find = find_package(f"{name}{ver}{self.meta.sp}", self.meta.pkg_path) + find = find_package(f"{name}{ver}{self.meta.sp}", + self.meta.pkg_path) if find: package = Utils().read_file( self.meta.pkg_path + "".join(find)) @@ -536,8 +536,8 @@ class PackageManager: packages = "" if repo == "sbo": if (os.path.isfile( - self.meta.lib_path + f"{repo}_repo/SLACKBUILDS.TXT")): - packages = Utils().read_file(self.meta.lib_path + f"{repo}_repo/SLACKBUILDS.TXT") + self.meta.lib_path + "sbo_repo/SLACKBUILDS.TXT")): + packages = Utils().read_file(self.meta.lib_path + "sbo_repo/SLACKBUILDS.TXT") else: if (os.path.isfile( self.meta.lib_path + f"{repo}_repo/PACKAGES.TXT")): From 46aaaa8debf28f96ce40e363b3a4f9403f8f2d1c Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 14 Feb 2020 19:08:58 +0100 Subject: [PATCH 25/29] Updated queue list Signed-off-by: Dimitris Zlatanidis --- slpkg/pkg_find.py | 5 +++-- slpkg/sbo/queue.py | 44 +++++++++++++++++--------------------------- 2 files changed, 20 insertions(+), 29 deletions(-) diff --git a/slpkg/pkg_find.py b/slpkg/pkg_find.py index afe5d0bb..2188dd86 100644 --- a/slpkg/pkg_find.py +++ b/slpkg/pkg_find.py @@ -38,6 +38,7 @@ class FindFromRepos: self.count_pkg = 0 self.count_repo = 0 self.meta = _meta_ + self.msg = Msg() self.cyan = self.meta.color["CYAN"] self.grey = self.meta.color["GREY"] self.endc = self.meta.color["ENDC"] @@ -46,9 +47,9 @@ class FindFromRepos: """Start to find packages and print """ print(f"Packages with name matching [ {self.cyan}{', '.join(pkg)}{self.endc} ]\n") - Msg().template(78) + self.msg.template(78) print(f"| Repository Package {' ' * 54}Size") - Msg().template(78) + self.msg.template(78) for repo in _meta_.repositories: PACKAGES_TXT = PackageManager(pkg).list_lib(repo) packages, sizes = PackageManager(pkg).list_greps(repo, diff --git a/slpkg/sbo/queue.py b/slpkg/sbo/queue.py index 7cfe8f8e..44b90249 100644 --- a/slpkg/sbo/queue.py +++ b/slpkg/sbo/queue.py @@ -44,19 +44,22 @@ class QueuePkgs: installation """ def __init__(self): - queue_file = [ - "# In this file you can create a list of\n", - "# packages you want to build or install.\n", - "#\n" - ] self.meta = _meta_ self.green = _meta_.color["GREEN"] self.red = _meta_.color["RED"] self.endc = _meta_.color["ENDC"] - self.quit = False self.queue = self.meta.lib_path + "queue/" self.queue_list = self.queue + "queue_list" self._SOURCES = self.meta.SBo_SOURCES + self.touch() + + def touch(self): + """Creating the directories and the queue file + """ + queue_file = [ + "# In this file you can create a list of\n", + "# packages you want to build or install.\n", + "#\n"] if not os.path.exists(self.meta.lib_path): os.mkdir(self.meta.lib_path) if not os.path.exists(self.queue): @@ -71,61 +74,48 @@ class QueuePkgs: """Return queue list from /var/lib/queue/queue_list file. """ - queue_list = [] for read in self.queued.splitlines(): read = read.lstrip() if not read.startswith("#"): - queue_list.append(read.replace("\n", "")) - return queue_list + yield read.replace("\n", "") def listed(self): """Print packages from queue """ - print("\nPackages in the queue:\n") + print("Packages in the queue:\n") for pkg in self.packages(): - if pkg: - print(f"{self.green}{pkg}{self.endc}") - self.quit = True - if self.quit: - print() # new line at exit + print(f"{self.green}{pkg}{self.endc}") def add(self, pkgs): """Add packages in queue if not exist """ - queue_list = self.packages() + queue_list = list(self.packages()) pkgs = list(OrderedDict.fromkeys(pkgs)) - print("\nAdd packages in the queue:\n") + print("Add packages in the queue:\n") with open(self.queue_list, "a") as queue: for pkg in pkgs: find = sbo_search_pkg(pkg) if pkg not in queue_list and find is not None: print(f"{self.green}{pkg}{self.endc}") queue.write(pkg + "\n") - self.quit = True else: print(f"{self.red}{pkg}{self.endc}") - self.quit = True - if self.quit: - print() # new line at exit def remove(self, pkgs): """Remove packages from queue """ - print("\nRemove packages from the queue:\n") + print("Remove packages from the queue:\n") with open(self.queue_list, "w") as queue: for line in self.queued.splitlines(): if line not in pkgs: queue.write(line + "\n") else: print(f"{self.red}{line}{self.endc}") - self.quit = True - if self.quit: - print() # new line at exit def build(self): """Build packages from queue """ - packages = self.packages() + packages = list(self.packages()) if packages: for pkg in packages: if not os.path.exists(self.meta.build_path): @@ -152,7 +142,7 @@ class QueuePkgs: def install(self): """Install packages from queue """ - packages = self.packages() + packages = list(self.packages()) if packages: print() # new line at start for pkg in packages: From d72283008815b182862893547640a6bedd4585f6 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 14 Feb 2020 19:23:52 +0100 Subject: [PATCH 26/29] Updated self call Signed-off-by: Dimitris Zlatanidis --- slpkg/arguments.py | 2 +- slpkg/binary/dependency.py | 12 ++++++++---- slpkg/slack/slack_version.py | 1 - 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/slpkg/arguments.py b/slpkg/arguments.py index ede7b131..427524b4 100644 --- a/slpkg/arguments.py +++ b/slpkg/arguments.py @@ -30,7 +30,7 @@ from slpkg.slack.slack_version import slack_ver def header(): """help header message""" - print(f"\nslpkg - version {_meta_.__version__} | Slackware release: {_meta_.slack_rel} - {slack_ver()}\n") + print(f"slpkg - version {_meta_.__version__} | Slackware release: {_meta_.slack_rel} - {slack_ver()}\n") def options(): diff --git a/slpkg/binary/dependency.py b/slpkg/binary/dependency.py index 2203dc81..6863c0db 100644 --- a/slpkg/binary/dependency.py +++ b/slpkg/binary/dependency.py @@ -49,10 +49,14 @@ class Dependencies: for req in requires: if req and req not in self.black: dependencies.append(req) - if dependencies: - self.dep_results.append(dependencies) - for dep in dependencies: - self.binary(dep, flag) + self.deep_check(dependencies, flag) return self.dep_results else: return [] + + def deep_check(self, dependencies, flag): + """Checking if dependencies are finnished + """ + if dependencies: + self.dep_results.append(dependencies) + [self.binary(dep, flag) for dep in dependencies] diff --git a/slpkg/slack/slack_version.py b/slpkg/slack/slack_version.py index d3163ca4..5148dcb7 100644 --- a/slpkg/slack/slack_version.py +++ b/slpkg/slack/slack_version.py @@ -32,7 +32,6 @@ def slack_ver(): """ Open file and read Slackware version """ - if _meta_.slackware_version in ["off", "OFF"]: sv = Utils().read_file("/etc/slackware-version") version = re.findall(r"\d+", sv) From 9f1b0920ca6b65b525dad220808f9b7556fdda3e Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 14 Feb 2020 19:44:08 +0100 Subject: [PATCH 27/29] Fixed typo Signed-off-by: Dimitris Zlatanidis --- ChangeLog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 06f10479..1b7935f3 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -5,7 +5,7 @@ Fixed: Updated: - Removed status progress bar - Setup and installing -- Managed blacklit in the simple way +- Managed blacklist in the simple way 3.8.0 - 05/02/2020 Added: From e5eb0e7b0da907c788c51e65775197445e71a1ba Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 14 Feb 2020 22:01:39 +0100 Subject: [PATCH 28/29] Replace exec() to getattr() Signed-off-by: Dimitris Zlatanidis --- slpkg/binary/repo_init.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slpkg/binary/repo_init.py b/slpkg/binary/repo_init.py index 7fba70f9..be2b263d 100644 --- a/slpkg/binary/repo_init.py +++ b/slpkg/binary/repo_init.py @@ -41,9 +41,9 @@ class RepoInit: def fetch(self): if self.repo in self.meta.default_repositories: - exec(f"self._init_{self.repo}()") + getattr(self, f"_init_{self.repo}")() else: - exec("self._init_custom()") + self._init_custom() self.lib = self.meta.lib_path + f"{self.repo}_repo/PACKAGES.TXT" PACKAGES_TXT = Utils().read_file(self.lib) return PACKAGES_TXT, self.mirror From ac622537182c72a9adbd44a62c33bfa6e00986c8 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 14 Feb 2020 22:12:11 +0100 Subject: [PATCH 29/29] Updated to version 3.8.1 Signed-off-by: Dimitris Zlatanidis --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b72c5db1..56ea6be5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# slpkg 3.8.0 +# slpkg 3.8.1 Slpkg is a powerful software package manager that installs, updates, and removes packages on [Slackware](http://www.slackware.com/) based systems. It automatically computes dependencies and