From 102e5c1013a951b4216680a5f35987b60c8172c2 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sat, 23 Apr 2022 20:34:44 +0300
Subject: [PATCH 01/65] Fixed PEP E501
Signed-off-by: Dimitris Zlatanidis
---
slpkg/graph.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/slpkg/graph.py b/slpkg/graph.py
index d819558e..0c435270 100644
--- a/slpkg/graph.py
+++ b/slpkg/graph.py
@@ -52,10 +52,13 @@ class Graph:
try:
import pygraphviz as pgv
except ImportError:
- if self.image == "ascii" and not os.path.isfile("/usr/bin/graph-easy"):
- print("Require 'grap_easy': Install with 'slpkg -s sbo graph-easy'")
+ if (self.image == "ascii"
+ and not os.path.isfile("/usr/bin/graph-easy")):
+ print("Require 'grap_easy': "
+ "Install with 'slpkg -s sbo graph-easy'")
else:
- print("Require 'pygraphviz: Install with 'slpkg -s sbo pygraphviz'")
+ print("Require 'pygraphviz: "
+ "Install with 'slpkg -s sbo pygraphviz'")
raise SystemExit()
if self.image != "ascii":
self.check_file()
From d8f1b6701b9a47fd3058c5afd12110cbef6f25eb Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sat, 23 Apr 2022 20:38:50 +0300
Subject: [PATCH 02/65] Fixed PEP E501
Signed-off-by: Dimitris Zlatanidis
---
slpkg/messages.py | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/slpkg/messages.py b/slpkg/messages.py
index 48fc2e97..3332a6fe 100644
--- a/slpkg/messages.py
+++ b/slpkg/messages.py
@@ -56,9 +56,11 @@ class Msg:
"""Print error message if build failed
"""
self.template(78)
- print(f"| Some error on the package {prgnam} [ {self.red}FAILED{self.endc} ]")
+ print(f"| Some error on the package {prgnam} "
+ f"[ {self.red}FAILED{self.endc} ]")
self.template(78)
- print(f"| See the log file in '{self.cyan}/var/log/slpkg/sbo/build_logs{self.endc}' "
+ print(f"| See the log file in '{self.cyan}"
+ f"/var/log/slpkg/sbo/build_logs{self.endc}' "
f"directory or read the README file")
self.template(78)
print() # new line at end
@@ -76,12 +78,14 @@ class Msg:
def reading(self):
"""Message reading
"""
- print(f"{self.grey}Reading package lists...{self.endc} ", end="", flush=True)
+ print(f"{self.grey}Reading package lists...{self.endc} ",
+ end="", flush=True)
def resolving(self):
"""Message resolving
"""
- print(f"{self.grey}Resolving dependencies...{self.endc} ", end="", flush=True)
+ print(f"{self.grey}Resolving dependencies...{self.endc} ",
+ end="", flush=True)
def done(self):
"""Message done
@@ -157,5 +161,6 @@ class Msg:
def matching(self, packages):
"""Message for matching packages
"""
- print(f"\nNot found package with the name [ {self.cyan}{''.join(packages)}{self.endc} ]. "
- "Matching packages:\nNOTE: Not dependencies are resolved\n")
\ No newline at end of file
+ print(f"\nNot found package with the name "
+ f"[ {self.cyan}{''.join(packages)}{self.endc} ]. "
+ "Matching packages:\nNOTE: Not dependencies are resolved\n")
From f02af7747d695d3ace2849bd56abadd9e34299fe Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sat, 23 Apr 2022 20:49:48 +0300
Subject: [PATCH 03/65] Fixed indentation pkg view
Signed-off-by: Dimitris Zlatanidis
---
slpkg/pkg_find.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/slpkg/pkg_find.py b/slpkg/pkg_find.py
index 93ef36ce..54b692db 100644
--- a/slpkg/pkg_find.py
+++ b/slpkg/pkg_find.py
@@ -46,7 +46,8 @@ class FindFromRepos:
def find(self, pkg, flag):
"""Start to find packages and print
"""
- print(f"Packages with name matching [ {self.cyan}{', '.join(pkg)}{self.endc} ]\n")
+ print(f"Packages with name matching [ {self.cyan}"
+ f"{', '.join(pkg)}{self.endc} ]\n")
self.msg.template(78)
print(f"| Repository Package {' ' * 54}Size")
self.msg.template(78)
@@ -68,8 +69,9 @@ class FindFromRepos:
self.cache = repo
self.count_pkg += 1
ver = self.sbo_version(repo, find)
- print(f" {self.cyan}{repo}{self.endc}{' ' * (12 - len(repo))}{find + ver} "
- f"{' ' * (53 -len(find + ver))}{size:>11}")
+ print(f" {self.cyan}{repo}{self.endc}"
+ f"{' ' * (11 - len(repo))}{find + ver} "
+ f"{' ' * (54 -len(find + ver))}{size:>11}")
print("\nFound summary")
print("=" * 79)
print(f"{self.grey}Total found {self.count_pkg} packages in "
From 0b0d2620fbe5623434b45a38e15fbbdeb5d466de Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sat, 23 Apr 2022 21:00:36 +0300
Subject: [PATCH 04/65] Fixed disable - enabled view
Signed-off-by: Dimitris Zlatanidis
---
slpkg/repoenable.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/slpkg/repoenable.py b/slpkg/repoenable.py
index fc66bc62..17949cfc 100644
--- a/slpkg/repoenable.py
+++ b/slpkg/repoenable.py
@@ -63,7 +63,7 @@ Keys: SPACE select or deselect the highlighted repositories,
TAB move focus
ENTER press the focused button
- Disabled <-------- REPOSITORIES -------> Enabled"""
+ Disabled <---------------- REPOSITORIES ----------------> Enabled"""
self.read_enabled()
self.read_disabled()
text, title, backtitle, status = keys, " Repositories ", "", False
@@ -104,7 +104,8 @@ Keys: SPACE select or deselect the highlighted repositories,
"""Update repositories.conf file with enabled or disabled
repositories
"""
- with open(f"{self.meta.conf_path}{self.repositories_conf}", "w") as new_conf:
+ with open(f"{self.meta.conf_path}"
+ f"{self.repositories_conf}", "w") as new_conf:
for line in self.conf.splitlines():
line = line.lstrip()
if self.tag in line:
@@ -139,5 +140,6 @@ Keys: SPACE select or deselect the highlighted repositories,
self.msg.template(78)
print(f"| {total_enabled}")
self.msg.template(78)
- print(f"{self.grey}Total {len(self.selected)}/{len(self.enabled + self.disabled)} "
- f"repositories enabled.{self.endc}\n")
\ No newline at end of file
+ print(f"{self.grey}Total {len(self.selected)}/"
+ f"{len(self.enabled + self.disabled)} "
+ f"repositories enabled.{self.endc}\n")
From 62ad95cc8357a0710d343a0fecca67c8b8ea630b Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sun, 24 Apr 2022 09:47:34 +0300
Subject: [PATCH 05/65] Updated to f format
Signed-off-by: Dimitris Zlatanidis
---
slpkg/repoinfo.py | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/slpkg/repoinfo.py b/slpkg/repoinfo.py
index 00baeee0..15c0c459 100644
--- a/slpkg/repoinfo.py
+++ b/slpkg/repoinfo.py
@@ -67,7 +67,8 @@ class RepoInfo(Utils):
self.form["Default:"] = "yes"
if (repo in self.meta.repositories and
- os.path.isfile(f"{self.meta.lib_path}{repo}_repo/PACKAGES.TXT")):
+ os.path.isfile(f"{self.meta.lib_path}"
+ f"{repo}_repo/PACKAGES.TXT")):
status = f"{self.green}enabled{self.endc}"
if repo != "sbo":
@@ -75,10 +76,8 @@ class RepoInfo(Utils):
size = units(data[1], data[2])
self.form["Repo id:"] = repo
self.form["Repo url:"] = self.all_repos[repo]
- self.form["Total compressed packages:"] = "{0} {1}".format(
- str(size[1][0]), str(size[0][0]))
- self.form["Total uncompressed packages:"] = "{0} {1}".format(
- str(size[1][1]), str(size[0][1]))
+ self.form["Total compressed packages:"] = f"{str(size[1][0])} {str(size[0][0])}"
+ self.form["Total uncompressed packages:"] = f"{str(size[1][1])} {str(size[0][1])}"
self.form["Number of packages:"] = data[0]
self.form["Status:"] = status
self.form["Last updated:"] = data[3]
@@ -130,4 +129,4 @@ class RepoInfo(Utils):
f"{self.meta.log_path}{repo}/ChangeLog.txt")
last_upd = log.split("\n", 1)[0]
- return [sum_pkgs, size, unsize, last_upd]
\ No newline at end of file
+ return [sum_pkgs, size, unsize, last_upd]
From 515d0d3b47ddbdf2175ac497590ae5a75262cbda Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sun, 24 Apr 2022 09:50:32 +0300
Subject: [PATCH 06/65] Updated bar view
Signed-off-by: Dimitris Zlatanidis
---
slpkg/repolist.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/slpkg/repolist.py b/slpkg/repolist.py
index 449fd383..e9c98f85 100644
--- a/slpkg/repolist.py
+++ b/slpkg/repolist.py
@@ -47,8 +47,8 @@ class RepoList:
def_cnt, cus_cnt = 0, 0
self.msg.template(78)
print("{0}{1}{2}{3}{4}{5}{6}".format(
- "| Repo id", " " * 2,
- "Repo URL", " " * 44,
+ "| Repo_id", " " * 2,
+ "Repo_URL", " " * 44,
"Default", " " * 3,
"Status"))
self.msg.template(78)
From 055786a6a0efc4c591060e3b01b426023a30b6e5 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sun, 24 Apr 2022 20:03:25 +0300
Subject: [PATCH 07/65] Switch to unittest
Signed-off-by: Dimitris Zlatanidis
---
tests/test_file_size.py | 25 ++++++++++++++++---------
tests/test_md5sum.py | 26 ++++++++++++++++----------
tests/test_units.py | 20 ++++++++++++++++----
tests/test_utils.py | 30 ++++++++++++++++++------------
4 files changed, 66 insertions(+), 35 deletions(-)
diff --git a/tests/test_file_size.py b/tests/test_file_size.py
index a40d08dc..b3ebe1d0 100644
--- a/tests/test_file_size.py
+++ b/tests/test_file_size.py
@@ -1,12 +1,19 @@
+import unittest
from slpkg.file_size import FileSize
-def test_FileSize():
- """Testing the remote and local servers
- """
- 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
+class TestFileSize(unittest.TestCase):
+
+ def test_FileSize(self):
+ """Testing the remote and local servers
+ """
+ url = "https://mirrors.slackware.com/slackware/slackware64-14.2/ChangeLog.txt"
+ lc = "test_units.py"
+ fs1 = FileSize(url)
+ fs2 = FileSize(lc)
+ self.assertIsNotNone(fs1.server())
+ self.assertIsNotNone(fs2.local())
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/tests/test_md5sum.py b/tests/test_md5sum.py
index cf1590ff..fbb5fd92 100644
--- a/tests/test_md5sum.py
+++ b/tests/test_md5sum.py
@@ -1,15 +1,21 @@
+import unittest
from slpkg.md5sum import md5
-def test_md5_superuser():
- """Testing checksum for superuser.py file
- """
- result = md5('slpkg/superuser.py')
- assert result == "c6a3576c247bda199c75b43540bfc3d7"
+class TestMd5(unittest.TestCase):
+
+ def test_md5_superuser(self):
+ """Testing checksum for superuser.py file
+ """
+ result = md5('test_file_size.py')
+ self.assertEqual(result, "e3e7b72be80efc922b0e1f1cd409a417")
+
+ def test_md5_security(self):
+ """Testing checksum for security.py file
+ """
+ result = md5('test_units.py')
+ self.assertEqual(result, "0f6bb6ac5282498db65a791e28f207fe")
-def test_md5_security():
- """Testing checksum for security.py file
- """
- result = md5('slpkg/security.py')
- assert result == "eb8dbea4dec6d72353d30475670389f0"
+if __name__ == "__main__":
+ unittest.main()
diff --git a/tests/test_units.py b/tests/test_units.py
index d1f0ef53..096aa786 100644
--- a/tests/test_units.py
+++ b/tests/test_units.py
@@ -1,7 +1,19 @@
+import unittest
from slpkg.sizes import units
-def test_units():
- """Testing the units metrics
- """
- assert ["Kb", "Kb"], ["100", "100"] == units(['100', ['100']])
\ No newline at end of file
+class TetsUnits(unittest.TestCase):
+
+ def test_units(self):
+ """Testing the units metrics
+ """
+ self.assertCountEqual((["Kb", "Kb"], [100, 100]),
+ units(["100"], ["100"]))
+ self.assertCountEqual((["Mb", "Mb"], [1000, 1000]),
+ units(["1024000"], ["1024000"]))
+ self.assertCountEqual((["Gb", "Gb"], [976.56, 976.56]),
+ units(["1024000000"], ["1024000000"]))
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 540d578e..fea4f2f3 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -1,17 +1,23 @@
+import unittest
from slpkg.utils import Utils
-def test_dimensional_list():
- """Testing dimesional list util
- """
- lists = [[1, 2, 3, 4, 5]]
- utils = Utils()
- assert [1, 2, 3, 4, 5] == utils.dimensional_list(lists)
+class TestUtils(unittest.TestCase):
+
+ def test_dimensional_list(self):
+ """Testing dimesional list util
+ """
+ lists = [[1, 2, 3, 4, 5]]
+ utils = Utils()
+ self.assertEqual([1, 2, 3, 4, 5], utils.dimensional_list(lists))
+
+ def test_remove_dbs(self):
+ """Testing removing doubles item from list
+ """
+ lists = [1, 2, 3, 3, 4, 5, 2, 1]
+ utils = Utils()
+ self.assertEqual([1, 2, 3, 4, 5], utils.remove_dbs(lists))
-def test_remove_dbs():
- """Testing removing doubles item from list
- """
- lists = [1, 2, 3, 3, 4, 5, 2, 1]
- utils = Utils()
- assert [1, 2, 3, 4, 5] == utils.remove_dbs(lists)
\ No newline at end of file
+if __name__ == "__main__":
+ unittest.main()
From 406f61e6882ad9439d5262231289f6d81d93a2a2 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sun, 24 Apr 2022 20:59:47 +0300
Subject: [PATCH 08/65] Switch to unittest
Signed-off-by: Dimitris Zlatanidis
---
tests/test_search_package.py | 35 +++++++++++++++++++----------------
1 file changed, 19 insertions(+), 16 deletions(-)
diff --git a/tests/test_search_package.py b/tests/test_search_package.py
index 2798e28f..52ca9798 100644
--- a/tests/test_search_package.py
+++ b/tests/test_search_package.py
@@ -1,22 +1,25 @@
-import pytest
+import unittest
from slpkg.binary.search import search_pkg
from slpkg.sbo.search import sbo_search_pkg
-@pytest.mark.skip(reason="no way of currently testing in Gitlab")
-def test_search():
- """Testing found the name from binaries repos
- """
- name = "vlc"
- repo = "alien"
- test = search_pkg(name, repo)
- assert name == test
+class TestFindPkg(unittest.TestCase):
+
+ def test_search(self):
+ """Testing found the name from binaries repos
+ """
+ name = "vlc"
+ repo = "alien"
+ test = search_pkg(name, repo)
+ self.assertEqual(name, test)
+
+ def test_sbo_search(self):
+ """Testing found the name from binaries repos
+ """
+ name = "slpkg"
+ test = sbo_search_pkg(name).split("/")[-2]
+ self.assertEqual(name, test)
-@pytest.mark.skip(reason="no way of currently testing in Gtilab")
-def test_sbo_search():
- """Testing found the name from binaries repos
- """
- name = "slpkg"
- test = sbo_search_pkg(name).split("/")[-2]
- assert name == test
\ No newline at end of file
+if __name__ == "__main__":
+ unittest.main()
From c95a6c0cdfa6af8786829baa75d6396d677d3721 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sun, 24 Apr 2022 21:01:10 +0300
Subject: [PATCH 09/65] Removed pytest
Signed-off-by: Dimitris Zlatanidis
---
pytest.ini | 4 ----
requirements.txt | 1 -
setup.py | 4 +---
3 files changed, 1 insertion(+), 8 deletions(-)
delete mode 100644 pytest.ini
diff --git a/pytest.ini b/pytest.ini
deleted file mode 100644
index c085b4c5..00000000
--- a/pytest.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[pytest]
-python_files = test_*
-python_classes = *Tests
-python_functions = test_*
diff --git a/requirements.txt b/requirements.txt
index 74db8801..9fb8bd88 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -11,4 +11,3 @@
# perl 5 language and graph-easy >= 0.75 (drawing dependencies ascii diagram)
# python3-pythondialog >= 3.5.0 (Python interface to the UNIX dialog utility)
# flake8 >= 3.5.0
-# pytest >= 5.3.2
diff --git a/setup.py b/setup.py
index 445e1ccb..40e068d0 100755
--- a/setup.py
+++ b/setup.py
@@ -32,9 +32,7 @@ except ImportError:
from distutils.core import setup
docs_requires = []
-tests_requires = [
- "pytest>=5.3.2"
-]
+tests_requires = []
install_requires = []
optional_requires = [
"pythondialog>=3.5.1",
From ca3b4afe5674bbb6e61dc5d51d4edd45240ebab6 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sun, 24 Apr 2022 21:58:17 +0300
Subject: [PATCH 10/65] Added tests
Signed-off-by: Dimitris Zlatanidis
---
tests/test_utils.py | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/tests/test_utils.py b/tests/test_utils.py
index fea4f2f3..dfd5c1cc 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -4,19 +4,30 @@ from slpkg.utils import Utils
class TestUtils(unittest.TestCase):
+ def setUp(self):
+ self.utils = Utils()
+
def test_dimensional_list(self):
"""Testing dimesional list util
"""
lists = [[1, 2, 3, 4, 5]]
- utils = Utils()
- self.assertEqual([1, 2, 3, 4, 5], utils.dimensional_list(lists))
+ self.assertListEqual([1, 2, 3, 4, 5],
+ self.utils.dimensional_list(lists))
def test_remove_dbs(self):
"""Testing removing doubles item from list
"""
lists = [1, 2, 3, 3, 4, 5, 2, 1]
- utils = Utils()
- self.assertEqual([1, 2, 3, 4, 5], utils.remove_dbs(lists))
+ self.assertListEqual([1, 2, 3, 4, 5], self.utils.remove_dbs(lists))
+
+ def test_case_sensitive(self):
+ """Testing create one dimensional list
+ """
+ lists = ['Vlc', 'OpenOffice', 'APScheduler']
+ dictionary = {'vlc': 'Vlc',
+ 'openoffice': 'OpenOffice',
+ 'apscheduler': 'APScheduler'}
+ self.assertDictEqual(dictionary, self.utils.case_sensitive(lists))
if __name__ == "__main__":
From ce04039ea175e85d68767a19c3740557fc190536 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sun, 24 Apr 2022 22:01:50 +0300
Subject: [PATCH 11/65] Updated md5sum
Signed-off-by: Dimitris Zlatanidis
---
tests/test_md5sum.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/test_md5sum.py b/tests/test_md5sum.py
index fbb5fd92..a8d1080d 100644
--- a/tests/test_md5sum.py
+++ b/tests/test_md5sum.py
@@ -14,7 +14,7 @@ class TestMd5(unittest.TestCase):
"""Testing checksum for security.py file
"""
result = md5('test_units.py')
- self.assertEqual(result, "0f6bb6ac5282498db65a791e28f207fe")
+ self.assertEqual(result, "58a694171449e923414e3e3339a0097e")
if __name__ == "__main__":
From cb2216b79eb54c332439ae3ed4211ec525dd12ac Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Mon, 25 Apr 2022 11:55:06 +0300
Subject: [PATCH 12/65] Added slack version test
Signed-off-by: Dimitris Zlatanidis
---
tests/test_slack_version.py | 13 +++++++++++++
1 file changed, 13 insertions(+)
create mode 100644 tests/test_slack_version.py
diff --git a/tests/test_slack_version.py b/tests/test_slack_version.py
new file mode 100644
index 00000000..fba97972
--- /dev/null
+++ b/tests/test_slack_version.py
@@ -0,0 +1,13 @@
+import unittest
+from slpkg.slack.slack_version import slack_ver
+
+
+class TestSlackVersion(unittest.TestCase):
+
+ def test_slack_version(self):
+ ver = '15.0'
+ self.assertEqual(ver, slack_ver())
+
+
+if __name__ == "__main__":
+ unittest.main()
From b55d66cbfc9bcb0f69577e87135292c89cdd8966 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Mon, 25 Apr 2022 12:18:57 +0300
Subject: [PATCH 13/65] Added installed test
Signed-off-by: Dimitris Zlatanidis
---
tests/test_installed.py | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 tests/test_installed.py
diff --git a/tests/test_installed.py b/tests/test_installed.py
new file mode 100644
index 00000000..cf22918a
--- /dev/null
+++ b/tests/test_installed.py
@@ -0,0 +1,20 @@
+import unittest
+from slpkg.pkg.installed import GetFromInstalled
+
+
+class TestPkgInstalled(unittest.TestCase):
+
+ def setUp(self):
+ self.pkg_name = 'aaa_base'
+ self.pkg_ver = '15.0'
+ self.installed = GetFromInstalled('aaa_base')
+
+ def test_pkg_name(self):
+ self.assertEqual(self.pkg_name, self.installed.name())
+
+ def test_pkg_version(self):
+ self.assertEqual(self.pkg_ver, self.installed.version())
+
+
+if __name__ == "__main__":
+ unittest.main()
From f41b395d1feed98361d83b614b43b00689e69e0a Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Mon, 25 Apr 2022 12:21:27 +0300
Subject: [PATCH 14/65] Added some comments
Signed-off-by: Dimitris Zlatanidis
---
tests/test_installed.py | 3 +++
tests/test_slack_version.py | 2 ++
2 files changed, 5 insertions(+)
diff --git a/tests/test_installed.py b/tests/test_installed.py
index cf22918a..150f0cef 100644
--- a/tests/test_installed.py
+++ b/tests/test_installed.py
@@ -10,9 +10,12 @@ class TestPkgInstalled(unittest.TestCase):
self.installed = GetFromInstalled('aaa_base')
def test_pkg_name(self):
+ """Testing the installed package name
+ """
self.assertEqual(self.pkg_name, self.installed.name())
def test_pkg_version(self):
+ """Testing the version of installed package"""
self.assertEqual(self.pkg_ver, self.installed.version())
diff --git a/tests/test_slack_version.py b/tests/test_slack_version.py
index fba97972..6d693fb6 100644
--- a/tests/test_slack_version.py
+++ b/tests/test_slack_version.py
@@ -5,6 +5,8 @@ from slpkg.slack.slack_version import slack_ver
class TestSlackVersion(unittest.TestCase):
def test_slack_version(self):
+ """Testing the current Slackware version
+ """
ver = '15.0'
self.assertEqual(ver, slack_ver())
From 4c12b784be3b7199b1c5375080315064d7a41299 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Mon, 25 Apr 2022 22:29:02 +0300
Subject: [PATCH 15/65] Fixed stderr error output
Signed-off-by: Dimitris Zlatanidis
---
slpkg/arguments.py | 4 +-
slpkg/main.py | 92 ++++++++++++++++++++++------------------------
2 files changed, 47 insertions(+), 49 deletions(-)
diff --git a/slpkg/arguments.py b/slpkg/arguments.py
index a69218c6..d4323289 100644
--- a/slpkg/arguments.py
+++ b/slpkg/arguments.py
@@ -171,7 +171,7 @@ Homepage: https://dslackw.gitlab.io/slpkg/
print(options.__doc__)
-def usage(repo):
+def usage(repo, stderr):
"""Usage: slpkg [COMMANDS|OPTIONS] {repository|package...}
Commands:
@@ -229,3 +229,5 @@ def usage(repo):
raise SystemExit(1)
print(usage.__doc__)
print("For more information try 'slpkg -h, --help' or view manpage\n")
+ if stderr == 1:
+ raise SystemExit(stderr)
diff --git a/slpkg/main.py b/slpkg/main.py
index bce8cd12..8e6451e4 100644
--- a/slpkg/main.py
+++ b/slpkg/main.py
@@ -105,7 +105,7 @@ class ArgParse(BlackList):
print("\n Please update the packages lists. Run 'slpkg update'.\n"
" This command should be used to synchronize the packages\n"
" lists from the repositories that are enabled.\n")
- raise SystemExit()
+ raise SystemExit(1)
def help_version(self):
"""Help and version info
@@ -117,7 +117,7 @@ class ArgParse(BlackList):
self.args[1:] == []):
prog_version()
else:
- usage("")
+ usage("", 1)
def command_update(self):
"""Update package lists repositories
@@ -133,7 +133,7 @@ class ArgParse(BlackList):
repos.remove(rp)
update.run(repos)
else:
- usage("")
+ usage("", 1)
def command_upgrade(self):
"""Recreate repositories package lists
@@ -149,7 +149,7 @@ class ArgParse(BlackList):
repos.remove(rp)
upgrade.run(repos)
else:
- usage("")
+ usage("", 1)
def command_update_slpkg(self):
"""Slpkg it self update
@@ -157,7 +157,7 @@ class ArgParse(BlackList):
if len(self.args) == 2 and self.args[0] == "update-slpkg":
it_self_update()
else:
- usage("")
+ usage("", 1)
def command_repo_enable(self):
"""Repositories enable/disable
@@ -166,7 +166,7 @@ class ArgParse(BlackList):
if len(self.args) == 1 and self.args[0] == "repo-enable":
RepoEnable().choose()
else:
- usage("")
+ usage("", 1)
def command_repo_list(self):
"""Repositories list
@@ -174,7 +174,7 @@ class ArgParse(BlackList):
if len(self.args) == 1 and self.args[0] == "repo-list":
RepoList().repos()
else:
- usage("")
+ usage("", 1)
def command_repo_add(self):
"""Add custom repositories
@@ -182,7 +182,7 @@ class ArgParse(BlackList):
if len(self.args) == 3 and self.args[0] == "repo-add":
Repo().add(self.args[1], self.args[2])
else:
- usage("")
+ usage("", 1)
def command_repo_remove(self):
"""Remove custom repositories
@@ -190,7 +190,7 @@ class ArgParse(BlackList):
if len(self.args) == 2 and self.args[0] == "repo-remove":
Repo().remove(self.args[1])
else:
- usage("")
+ usage("", 1)
def command_repo_info(self):
"""Repositories informations
@@ -201,9 +201,9 @@ class ArgParse(BlackList):
RepoInfo().view(self.args[1])
elif (len(self.args) > 1 and self.args[0] == "repo-info" and
self.args[1] not in RepoList().all_repos):
- usage(self.args[1])
+ usage(self.args[1], 1)
else:
- usage("")
+ usage("", 1)
def command_health(self):
"""Check package health
@@ -214,7 +214,7 @@ class ArgParse(BlackList):
self.args[1] == "--silent"):
PackageHealth(mode=self.args[1]).test()
else:
- usage("")
+ usage("", 1)
def command_deps_status(self):
"""Print dependencies status
@@ -234,7 +234,7 @@ class ArgParse(BlackList):
"--tree" in self.args and image):
DependenciesStatus(image).tree()
else:
- usage("")
+ usage("", 1)
def command_new_config(self):
"""Manage .new configuration files
@@ -242,14 +242,14 @@ class ArgParse(BlackList):
if len(self.args) == 1 and self.args[0] == "new-config":
NewConfig().run()
else:
- usage("")
+ usage("", 1)
def command_clean_tmp(self):
"""Clean all downloaded packages and sources"""
if len(self.args) == 1 and self.args[0] == "clean-tmp":
clean_tmp()
else:
- usage("")
+ usage("", 1)
def auto_build(self):
"""Auto built tool
@@ -261,7 +261,7 @@ class ArgParse(BlackList):
if len(self.args) >= 3 and self.args[0] in options:
AutoBuild(self.args[1], self.args[2:], self.meta.path).run()
else:
- usage("")
+ usage("", 1)
def pkg_list(self):
"""List of packages by repository
@@ -280,8 +280,7 @@ class ArgParse(BlackList):
if flag[2] == arg:
name = True
if arg not in flag:
- usage("")
- raise SystemExit()
+ usage("", 1)
if (len(self.args) > 1 and len(self.args) <= 5 and
self.args[0] in options):
if self.args[1] in self.meta.repositories:
@@ -290,9 +289,9 @@ class ArgParse(BlackList):
INDEX,
installed)
else:
- usage(self.args[1])
+ usage(self.args[1], 1)
else:
- usage("")
+ usage("", 1)
def pkg_upgrade(self):
"""Check and upgrade packages by repository
@@ -327,16 +326,16 @@ class ArgParse(BlackList):
SBoInstall(sbo_upgrade(skip, flag), flag).start(
is_upgrade=True)
else:
- usage(self.args[1])
+ usage(self.args[1], 1)
elif len(self.args) == 1 and self.args[0] in options:
Updates(repo="").ALL()
elif len(self.args) == 2 and self.args[0] in options:
Updates(self.args[1]).run()
elif (len(self.args) >= 2 and self.args[0] in options and
self.args[1] not in self.meta.repositories):
- usage(self.args[1])
+ usage(self.args[1], 1)
else:
- usage("")
+ usage("", 1)
def __pkg_upgrade_flags(self, flags):
"""Manage flags for package upgrade option
@@ -344,8 +343,7 @@ class ArgParse(BlackList):
# Check for typos or unssuported flags
for arg in self.args[2:]:
if arg not in flags:
- usage("")
- raise SystemExit()
+ usage("", 1)
flag, skip = [], ""
if flags[0] in self.args:
@@ -397,9 +395,9 @@ class ArgParse(BlackList):
self.args[1] in self.meta.repositories):
SBoInstall(self.args[2:], flag).start(is_upgrade=False)
else:
- usage(self.args[1])
+ usage(self.args[1], 1)
else:
- usage("")
+ usage("", 1)
def pkg_tracking(self):
"""Tracking package dependencies
@@ -428,17 +426,16 @@ class ArgParse(BlackList):
for arg in self.args:
if arg.startswith("--"):
if arg not in additional_options:
- usage("")
- raise SystemExit()
+ usage("", 1)
if (len(self.args) >= 3 and len(self.args) <= 3 and
self.args[0] in options and
self.args[1] in self.meta.repositories):
TrackingDeps(self.args[2], self.args[1], flag).run()
elif (len(self.args) >= 2 and
self.args[1] not in self.meta.repositories):
- usage(self.args[1])
+ usage(self.args[1], 1)
else:
- usage("")
+ usage("", 1)
def sbo_network(self):
"""View slackbuilds packages
@@ -466,7 +463,7 @@ class ArgParse(BlackList):
additional_options[0] in flag):
SBoNetwork("", flag).view()
else:
- usage("sbo")
+ usage("sbo", 1)
def pkg_blacklist(self):
"""Manage blacklist packages
@@ -496,7 +493,7 @@ class ArgParse(BlackList):
self.args.remove(flag[1])
self.black_remove(self.args[1:])
else:
- usage("")
+ usage("", 1)
def pkg_queue(self):
"""Manage packages in queue
@@ -542,7 +539,7 @@ class ArgParse(BlackList):
queue.build()
queue.install()
else:
- usage("")
+ usage("", 1)
def bin_install(self):
"""Install Slackware binary packages
@@ -570,7 +567,7 @@ class ArgParse(BlackList):
packages = self.args[2:]
PackageManager(packages).install(flag)
else:
- usage("")
+ usage("", 1)
def bin_upgrade(self):
"""Install-upgrade Slackware binary packages
@@ -593,7 +590,7 @@ class ArgParse(BlackList):
packages = self.args[2:]
PackageManager(packages).upgrade(flag)
else:
- usage("")
+ usage("", 1)
def bin_remove(self):
"""Remove Slackware packages
@@ -637,7 +634,7 @@ class ArgParse(BlackList):
packages = [""]
PackageManager(packages).remove(flag, extra)
else:
- usage("")
+ usage("", 1)
def bin_find(self):
"""Find installed packages
@@ -663,7 +660,7 @@ class ArgParse(BlackList):
elif len(self.args) > 1 and self.args[0] in options:
PackageManager(packages).find(flag)
else:
- usage("")
+ usage("", 1)
def pkg_desc(self):
"""Print slack-desc by repository
@@ -697,9 +694,9 @@ class ArgParse(BlackList):
PkgDesc(self.args[2], self.args[1], paint="").view()
elif (len(self.args) > 1 and self.args[0] in options and
self.args[1] not in self.meta.repositories):
- usage(self.args[1])
+ usage(self.args[1], 1)
else:
- usage("")
+ usage("", 1)
def pkg_find(self):
"""Find packages from all enabled repositories
@@ -718,7 +715,7 @@ class ArgParse(BlackList):
if len(self.args) > 1 and self.args[0] in options:
FindFromRepos().find(packages, flag)
else:
- usage("")
+ usage("", 1)
def pkg_contents(self):
"""Print packages contents
@@ -731,7 +728,7 @@ class ArgParse(BlackList):
if len(self.args) > 1 and self.args[0] in options:
PackageManager(packages).display()
else:
- usage("")
+ usage("", 1)
def congiguration(self):
"""Manage slpkg configuration file
@@ -756,7 +753,7 @@ class ArgParse(BlackList):
self.args[1] == (command[2])):
conf.reset()
else:
- usage("")
+ usage("", 1)
def auto_detect(self, args):
"""Check for already Slackware binary packages exist
@@ -781,7 +778,7 @@ class ArgParse(BlackList):
if not_found:
for ntf in not_found:
self.msg.pkg_not_found("", ntf, "Not installed", "")
- raise SystemExit()
+ raise SystemExit(1)
def if_checklist(self):
try:
@@ -789,7 +786,7 @@ class ArgParse(BlackList):
except ImportError:
print("Require 'pythondialog': Install with 'slpkg -s sbo "
"python3-pythondialog'")
- raise SystemExit()
+ raise SystemExit(1)
def main():
@@ -800,8 +797,7 @@ def main():
argparse = ArgParse(args)
if len(args) == 0:
- usage("")
- raise SystemExit()
+ usage("", 1)
argparse.auto_detect(args)
@@ -861,7 +857,7 @@ def main():
try:
arguments[args[0]]()
except KeyError:
- usage("")
+ usage("", 1)
if __name__ == "__main__":
From fd6ce3d8654de4785466641bf0294749d0ac39d3 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Tue, 26 Apr 2022 16:42:27 +0300
Subject: [PATCH 16/65] Updated for version 3.9.7
Signed-off-by: Dimitris Zlatanidis
---
ChangeLog.txt | 6 +++++-
README.md | 2 +-
slpkg/__metadata__.py | 2 +-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 584f5a56..21683542 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,4 +1,8 @@
-3.9.5 - 02/04/2022
+3.9.7 - 02/04/2022
+Fixed:
+- Stderr error output
+
+3.9.6 - 02/04/2022
Updated:
- Compared packages version when distribution upgrade
diff --git a/README.md b/README.md
index 9a5573ee..d3efcf67 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# slpkg 3.9.6
+# slpkg 3.9.7
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
diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py
index 0c11ee7c..493ce239 100644
--- a/slpkg/__metadata__.py
+++ b/slpkg/__metadata__.py
@@ -76,7 +76,7 @@ class MetaData:
__all__ = "slpkg"
__author__ = "dslackw"
- __version_info__ = (3, 9, 6)
+ __version_info__ = (3, 9, 7)
__version__ = "{0}.{1}.{2}".format(*__version_info__)
__license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com"
From 0d2bc8856500807bd4f610a08ec5752958359629 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Tue, 26 Apr 2022 16:44:47 +0300
Subject: [PATCH 17/65] Fixed E501 PEP error
Signed-off-by: Dimitris Zlatanidis
---
slpkg/auto_pkg.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/slpkg/auto_pkg.py b/slpkg/auto_pkg.py
index dbbcb9e7..cf2c884a 100644
--- a/slpkg/auto_pkg.py
+++ b/slpkg/auto_pkg.py
@@ -55,7 +55,8 @@ class Auto:
print("| Choose a Slackware command:")
self.msg.template(78)
for com in sorted(self.commands):
- print(f"| {self.red}{com}{self.endc}) {self.green}{self.commands[com]}{self.endc}")
+ print(f"| {self.red}{com}{self.endc}) {self.green}"
+ f"{self.commands[com]}{self.endc}")
self.msg.template(78)
try:
self.choice = input(" > ")
@@ -63,7 +64,8 @@ class Auto:
print()
raise SystemExit()
if self.choice in self.commands.keys():
- print(f" \x1b[1A{self.cyan}{self.commands[self.choice]}{self.endc}", end="\n\n")
+ print(f" \x1b[1A{self.cyan}{self.commands[self.choice]}"
+ f"{self.endc}", end="\n\n")
print(end="", flush=True)
self.execute()
From 672736c84064517797c2f51be381da2fe96df58c Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Tue, 26 Apr 2022 17:16:48 +0300
Subject: [PATCH 18/65] Added split package unittest
Signed-off-by: Dimitris Zlatanidis
---
tests/test_split_package.py | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
create mode 100644 tests/test_split_package.py
diff --git a/tests/test_split_package.py b/tests/test_split_package.py
new file mode 100644
index 00000000..aac0aa4d
--- /dev/null
+++ b/tests/test_split_package.py
@@ -0,0 +1,26 @@
+import unittest
+from slpkg.splitting import split_package
+from slpkg.pkg.find import searching
+
+
+class TestSplitting(unittest.TestCase):
+
+ def test_split_pkg(self):
+ path = '/var/log/packages/'
+ pkg_1 = ''.join(list(searching('slpkg', path)))
+ pkg_2 = ''.join(list(searching('akonadi-mime', path)))
+ pkg_3 = ''.join(list(searching('autoconf-archive', path)))
+ pkg_4 = ''.join(list(searching('bind', path)))
+
+ self.assertListEqual(['slpkg', '3.9.6', 'x86_64', '1'],
+ split_package(pkg_1))
+ self.assertListEqual(['akonadi-mime', '21.12.1', 'x86_64', '1'],
+ split_package(pkg_2))
+ self.assertListEqual(['autoconf-archive', '2021.02.19', 'noarch', '1'],
+ split_package(pkg_3))
+ self.assertListEqual(['bind', '9.16.27', 'x86_64', '1'],
+ split_package(pkg_4))
+
+
+if __name__ == "__main__":
+ unittest.main()
From e6d49f7f04087e8ea9e8de3115958a385578214d Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Wed, 27 Apr 2022 20:03:36 +0300
Subject: [PATCH 19/65] Added sbo greps test
Signed-off-by: Dimitris Zlatanidis
---
tests/test_sbo_grep.py | 49 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100644 tests/test_sbo_grep.py
diff --git a/tests/test_sbo_grep.py b/tests/test_sbo_grep.py
new file mode 100644
index 00000000..b160862e
--- /dev/null
+++ b/tests/test_sbo_grep.py
@@ -0,0 +1,49 @@
+import unittest
+from slpkg.sbo.greps import SBoGrep
+
+
+class TestSBoGreps(unittest.TestCase):
+
+ def setUp(self):
+ self.grep = SBoGrep('Flask')
+
+ def test_source(self):
+ """Test package source
+ """
+ source = self.grep.source()
+ flask_source = ('https://files.pythonhosted.org/packages/4e/0b/'
+ 'cb02268c90e67545a0e3a37ea1ca3d45de3aca43ceb7dbf'
+ '1712fb5127d5d/Flask-1.1.2.tar.gz')
+ self.assertEqual(source, flask_source)
+
+ def test_requires(self):
+ """Test package requires
+ """
+ requires = self.grep.requires()
+ flask_dep = ['werkzeug', 'python3-itsdangerous', 'click']
+ self.assertListEqual(requires, flask_dep)
+
+ def test_version(self):
+ """Test package version
+ """
+ version = self.grep.version()
+ flask_ver = '1.1.2'
+ self.assertEqual(version, flask_ver)
+
+ def test_checksum(self):
+ """Test package checksum
+ """
+ checksum = self.grep.checksum()
+ flask_md5 = ['0da4145d172993cd28a6c619630cc19c']
+ self.assertListEqual(checksum, flask_md5)
+
+ def test_description(self):
+ """Test package description
+ """
+ desc = self.grep.description()
+ flask_desc = 'Flask (Microframework for Python)'
+ self.assertEqual(desc, flask_desc)
+
+
+if __name__ == "__main__":
+ unittest.main()
From 94ec37691236f96b7fe6377748589f5b3ced74bf Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Wed, 27 Apr 2022 20:52:55 +0300
Subject: [PATCH 20/65] Update comments
Signed-off-by: Dimitris Zlatanidis
---
tests/test_utils.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/test_utils.py b/tests/test_utils.py
index dfd5c1cc..f176f213 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -21,7 +21,7 @@ class TestUtils(unittest.TestCase):
self.assertListEqual([1, 2, 3, 4, 5], self.utils.remove_dbs(lists))
def test_case_sensitive(self):
- """Testing create one dimensional list
+ """Testing case sensitive
"""
lists = ['Vlc', 'OpenOffice', 'APScheduler']
dictionary = {'vlc': 'Vlc',
From 77ba2cf63ab1b7abcc87c65c5ab3af2e50189de3 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Thu, 28 Apr 2022 20:44:11 +0300
Subject: [PATCH 21/65] Update class
Signed-off-by: Dimitris Zlatanidis
---
slpkg/pkg/installed.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/slpkg/pkg/installed.py b/slpkg/pkg/installed.py
index 31c18dc4..5a3cd845 100644
--- a/slpkg/pkg/installed.py
+++ b/slpkg/pkg/installed.py
@@ -46,11 +46,11 @@ class GetFromInstalled:
"""
if self.find:
return split_package(self.find)[1]
- return ""
+ return self.find
def name(self):
"""Return installed package name
"""
if self.find:
return self.package
- return ""
+ return self.find
From 799bc676ed899d6d3580e5ac2c66b9dfc901d538 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sat, 30 Apr 2022 21:38:13 +0300
Subject: [PATCH 22/65] Updated slackware distribution branches
---
slpkg/__metadata__.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py
index 493ce239..c3ef4e57 100644
--- a/slpkg/__metadata__.py
+++ b/slpkg/__metadata__.py
@@ -24,6 +24,10 @@
import os
+# Slackware distribution branches
+STABLE = "stable"
+CURRENT = "current"
+
def remove_repositories(repositories, default_repositories):
"""
@@ -67,7 +71,7 @@ def select_slack_release(slack_rel):
Warning message if Slackware release not defined or
defined wrong
"""
- if slack_rel not in ["stable", "current"]:
+ if slack_rel not in [STABLE, CURRENT]:
return "FAULT"
return slack_rel
@@ -84,7 +88,7 @@ class MetaData:
__homepage__ = "https://dslackw.gitlab.io/slpkg/"
# Default Slackware release
- slack_rel = "stable"
+ slack_rel = STABLE
# Configuration path
conf_path = f"/etc/{__all__}/"
@@ -95,7 +99,7 @@ class MetaData:
# Default configuration values
_conf_slpkg = {
- "RELEASE": "stable",
+ "RELEASE": STABLE,
"SLACKWARE_VERSION": "off",
"COMP_ARCH": "off",
"REPOSITORIES": ["slack", "sbo", "rlw", "alien",
From 7ab3150123d02b65ed3577bcf7886bdd79784040 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sat, 30 Apr 2022 21:40:26 +0300
Subject: [PATCH 23/65] Fix spaces
---
slpkg/__metadata__.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py
index c3ef4e57..3ba3f081 100644
--- a/slpkg/__metadata__.py
+++ b/slpkg/__metadata__.py
@@ -24,6 +24,7 @@
import os
+
# Slackware distribution branches
STABLE = "stable"
CURRENT = "current"
From 23796c499c3eeb2bea131561f435a248062cdf7f Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sat, 30 Apr 2022 21:45:37 +0300
Subject: [PATCH 24/65] Updated color to green
---
slpkg/init.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/slpkg/init.py b/slpkg/init.py
index 572c5243..17e757f1 100644
--- a/slpkg/init.py
+++ b/slpkg/init.py
@@ -746,10 +746,11 @@ class Update:
def __init__(self):
self.meta = _meta_
self.grey = _meta_.color["GREY"]
+ self.green = _meta_.color["GREEN"]
self.red = _meta_.color["RED"]
self.cyan = _meta_.color["CYAN"]
self.endc = _meta_.color["ENDC"]
- self.done = f"{self.grey}Done{self.endc}\n"
+ self.done = f"{self.green}Done{self.endc}\n"
self.error = f"{self.red}Error{self.endc}\n"
def run(self, repos):
From c4318433346d23b4add002185fff09585bac8263 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sat, 30 Apr 2022 22:12:31 +0300
Subject: [PATCH 25/65] Fixed stderr error output
Signed-off-by: Dimitris Zlatanidis
---
slpkg/health.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/slpkg/health.py b/slpkg/health.py
index a1356931..ce314669 100644
--- a/slpkg/health.py
+++ b/slpkg/health.py
@@ -65,7 +65,7 @@ class PackageHealth:
print(line)
except IOError:
print()
- raise SystemExit()
+ raise SystemExit(1)
def test(self):
"""Get started test each package and read file list
@@ -102,4 +102,4 @@ class PackageHealth:
print(f"| Total files{' ' * 7}Not installed{' ' * 40}Health")
self.msg.template(78)
print(f"| {self.cf}{' ' * (18-len(str(self.cf)))}{self.cn}{' ' * (55-len(str(self.cn)))}{health:>4}")
- self.msg.template(78)
\ No newline at end of file
+ self.msg.template(78)
From 5f720dc082eca1b4a220c2251f8a53d74aef3313 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sun, 1 May 2022 12:09:32 +0300
Subject: [PATCH 26/65] Fixed PEP E501
Signed-off-by: Dimitris Zlatanidis
---
slpkg/init.py | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/slpkg/init.py b/slpkg/init.py
index 17e757f1..ae5ff7a3 100644
--- a/slpkg/init.py
+++ b/slpkg/init.py
@@ -403,10 +403,13 @@ class Initialization(Utils):
if arch == "x86_64":
ar = "64"
version = self.meta.slacke_sub_repo[1:-1]
- PACKAGES_TXT = f"{repo}slacke{version}/slackware{ar}-{slack_ver()}/{lib_file}"
+ PACKAGES_TXT = (f"{repo}slacke{version}/slackware{ar}-"
+ f"{slack_ver()}/{lib_file}")
FILELIST_TXT = ""
- CHECKSUMS_MD5 = f"{repo}slacke{version}/slackware{ar}-{slack_ver()}/{md5_file}"
- ChangeLog_txt = f"{repo}slacke{version}/slackware{ar}-{slack_ver()}/{log_file}"
+ CHECKSUMS_MD5 = (f"{repo}slacke{version}/slackware{ar}-"
+ f"{slack_ver()}/{md5_file}")
+ ChangeLog_txt = (f"{repo}slacke{version}/slackware{ar}-"
+ f"{slack_ver()}/{log_file}")
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, PACKAGES_TXT, repo_name)
@@ -767,7 +770,9 @@ class Update:
for repo in enabled:
if check_for_local_repos(repo) is True:
continue
- print(f"{self.grey}Check repository [{self.cyan}{repo}{self.grey}] ... {self.endc}", end="", flush=True)
+ print(f"{self.grey}Check repository "
+ f"[{self.cyan}{repo}{self.grey}] ... "
+ f"{self.endc}", end="", flush=True)
if repo in default:
getattr(Initialization(False), repo)()
print(self.done, end="")
From 3b2b857df3fd1656af76d88c08c39666ac18e1fc Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Mon, 2 May 2022 22:41:36 +0300
Subject: [PATCH 27/65] Fixed PEP E501
Signed-off-by: Dimitris Zlatanidis
---
slpkg/slpkg_update.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/slpkg/slpkg_update.py b/slpkg/slpkg_update.py
index 60745e1b..cbb2dea8 100644
--- a/slpkg/slpkg_update.py
+++ b/slpkg/slpkg_update.py
@@ -96,5 +96,6 @@ def it_self_update():
subprocess.call("sh install.sh", shell=True)
else:
- print(f"\n{_meta_.__all__}: There is no new version, already used the last!\n")
- raise SystemExit()
\ No newline at end of file
+ print(f"\n{_meta_.__all__}: There is no new version, "
+ "already used the last!\n")
+ raise SystemExit()
From b322f0796dc0e1ee683e789dfb11ae32414a4e10 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Mon, 2 May 2022 22:43:21 +0300
Subject: [PATCH 28/65] Fixed PEP E501
Signed-off-by: Dimitris Zlatanidis
---
slpkg/url_read.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/slpkg/url_read.py b/slpkg/url_read.py
index 385774bf..07841984 100644
--- a/slpkg/url_read.py
+++ b/slpkg/url_read.py
@@ -47,5 +47,6 @@ class URL:
f = self.http.request('GET', self.link)
return f.data.decode("utf-8", "ignore")
except urllib3.exceptions.NewConnectionError:
- print(f"\n{self.red}Can't read the file '{self.link.split('/')[-1]}'{self.endc}")
+ print(f"\n{self.red}Can't read the file "
+ f"'{self.link.split('/')[-1]}'{self.endc}")
return " "
From 67c3f08b626645133de293c3152a0be255e04bd1 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Mon, 2 May 2022 22:56:25 +0300
Subject: [PATCH 29/65] Fixed stderr error output
Signed-off-by: Dimitris Zlatanidis
---
slpkg/pkg/manager.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/slpkg/pkg/manager.py b/slpkg/pkg/manager.py
index 150dc2db..4bd1d7be 100644
--- a/slpkg/pkg/manager.py
+++ b/slpkg/pkg/manager.py
@@ -297,7 +297,7 @@ class PackageManager(Utils):
os.remove(self.dep_path + package) # remove log
except subprocess.CalledProcessError as er:
print(er)
- raise SystemExit()
+ raise SystemExit(1)
def _rmv_deps(self, dependencies, package):
"""Remove dependencies
From 405237cbd5f08379f1f7f8588838f553e367589c Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Tue, 3 May 2022 18:34:15 +0300
Subject: [PATCH 30/65] Added cache to improve speed
Signed-off-by: Dimitris Zlatanidis
---
slpkg/sbo/dependency.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/slpkg/sbo/dependency.py b/slpkg/sbo/dependency.py
index b8c51138..ce666319 100644
--- a/slpkg/sbo/dependency.py
+++ b/slpkg/sbo/dependency.py
@@ -23,6 +23,7 @@
import sys
+from functools import lru_cache
from slpkg.blacklist import BlackList
from slpkg.__metadata__ import MetaData as _meta_
@@ -41,6 +42,7 @@ class Requires(BlackList):
self.blacklist = list(self.get_black())
self.dep_results = []
+ @lru_cache
def sbo(self, name):
"""Build all dependencies of a package
"""
@@ -55,14 +57,15 @@ class Requires(BlackList):
# if require in blacklist
if "%README%" not in req and req not in self.blacklist:
dependencies.append(req)
- self.deep_check(dependencies)
+ self.deep_check(tuple(dependencies))
return self.dep_results
else:
return []
+ @lru_cache
def deep_check(self, dependencies):
"""Checking if dependencies are finnished
"""
if dependencies:
self.dep_results.append(dependencies)
- [self.sbo(dep) for dep in dependencies]
\ No newline at end of file
+ [self.sbo(dep) for dep in dependencies]
From 8831c8cf7ea85da39e8ab18c7d46bfce033fc85d Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Tue, 3 May 2022 18:54:10 +0300
Subject: [PATCH 31/65] Added cache to improve speed
Signed-off-by: Dimitris Zlatanidis
---
ChangeLog.txt | 2 ++
slpkg/binary/dependency.py | 4 +++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 21683542..3517fb12 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,6 +1,8 @@
3.9.7 - 02/04/2022
Fixed:
- Stderr error output
+Updated:
+- Improve dependencies resolve speed
3.9.6 - 02/04/2022
Updated:
diff --git a/slpkg/binary/dependency.py b/slpkg/binary/dependency.py
index 1f179af0..f22416b6 100644
--- a/slpkg/binary/dependency.py
+++ b/slpkg/binary/dependency.py
@@ -23,6 +23,7 @@
import sys
+from functools import lru_cache
from slpkg.__metadata__ import MetaData as _meta_
@@ -49,11 +50,12 @@ class Dependencies:
for req in requires:
if req and req not in self.black:
dependencies.append(req)
- self.deep_check(dependencies, flag)
+ self.deep_check(tuple(dependencies), tuple(flag))
return self.dep_results
else:
return []
+ @lru_cache
def deep_check(self, dependencies, flag):
"""Checking if dependencies are finnished
"""
From 62f5e31671416e758bdad71df3eea6f919ef5353 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Tue, 3 May 2022 19:01:07 +0300
Subject: [PATCH 32/65] Added cache to improve speed
Signed-off-by: Dimitris Zlatanidis
---
slpkg/binary/greps.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/slpkg/binary/greps.py b/slpkg/binary/greps.py
index c58664c4..8a9c7739 100644
--- a/slpkg/binary/greps.py
+++ b/slpkg/binary/greps.py
@@ -22,6 +22,7 @@
# along with this program. If not, see .
+from functools import lru_cache
from slpkg.utils import Utils
from slpkg.splitting import split_package
from slpkg.__metadata__ import MetaData as _meta_
@@ -202,9 +203,10 @@ class Requires:
if line[18:].strip():
return self._req_fix(line)
+ @lru_cache
def _req_fix(self, line):
- """Fix slacky and salix requirements because many dependencies splitting
- with "," and others with "|"
+ """Fix slacky and salix requirements because many dependencies
+ splitting with "," and others with "|"
"""
deps = []
for dep in line[18:].strip().split(","):
From ab6030db70ceef9f5e128438352a117d24c7aa39 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Wed, 4 May 2022 20:30:35 +0300
Subject: [PATCH 33/65] Fixed PEP E501
Signed-off-by: Dimitris Zlatanidis
---
slpkg/binary/install.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/slpkg/binary/install.py b/slpkg/binary/install.py
index 9ffd79f8..72309c19 100644
--- a/slpkg/binary/install.py
+++ b/slpkg/binary/install.py
@@ -139,11 +139,12 @@ class BinaryInstall(BlackList, Utils):
print("\nInstalling summary")
print("=" * 79)
print(f"{self.grey}Total {sums[0]} {self.msg.pkg(sums[0])}.")
- print(f"{sums[3]} {self.msg.pkg(sums[3])} will be installed, {sums[2]} will be upgraded and "
+ print(f"{sums[3]} {self.msg.pkg(sums[3])} will be installed, "
+ f"{sums[2]} will be upgraded and "
f"{sums[1]} will be reinstalled.")
print(f"Need to get {size[0]} {unit[0]} of archives.")
- print(f"After this process, {size[1]} {unit[1]} of additional disk "
- f"space will be used.{self.endc}")
+ print(f"After this process, {size[1]} {unit[1]} of additional "
+ f"disk space will be used.{self.endc}")
print()
self.if_all_installed()
if self.msg.answer() in ["y", "Y"]:
@@ -314,7 +315,8 @@ class BinaryInstall(BlackList, Utils):
"""Print packages status bar
"""
self.msg.template(78)
- print(f"| Package{' ' * 17}New Version{' ' * 8}Arch{' ' * 4}Build{' ' * 2}Repos{' ' * 10}Size")
+ print(f"| Package{' ' * 17}New Version{' ' * 8}Arch{' ' * 4}"
+ f"Build{' ' * 2}Repos{' ' * 10}Size")
self.msg.template(78)
def store(self, packages):
From 83e5653e583d5cd3e3d8654a05c9dfcccd819b17 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Wed, 4 May 2022 21:35:21 +0300
Subject: [PATCH 34/65] Added .idea folder
---
.gitignore | 1 +
.idea/.gitignore | 3 +++
.idea/inspectionProfiles/profiles_settings.xml | 6 ++++++
.idea/modules.xml | 8 ++++++++
.idea/slpkg.iml | 12 ++++++++++++
.idea/vcs.xml | 6 ++++++
6 files changed, 36 insertions(+)
create mode 100644 .idea/.gitignore
create mode 100644 .idea/inspectionProfiles/profiles_settings.xml
create mode 100644 .idea/modules.xml
create mode 100644 .idea/slpkg.iml
create mode 100644 .idea/vcs.xml
diff --git a/.gitignore b/.gitignore
index 38df1be4..2450cb8a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@
*.pyc
__pycache__
.pipy
+.idea
*.egg-info/
/slpkg_Build
.ropeproject/
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 00000000..26d33521
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 00000000..105ce2da
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 00000000..6a8bd6fa
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/slpkg.iml b/.idea/slpkg.iml
new file mode 100644
index 00000000..8b8c3954
--- /dev/null
+++ b/.idea/slpkg.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 00000000..94a25f7f
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
From 9b2257fa78f1c36251a6d26b72b8aee7ce42c4e7 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Wed, 4 May 2022 21:37:30 +0300
Subject: [PATCH 35/65] Change color Done to green
---
slpkg/messages.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/slpkg/messages.py b/slpkg/messages.py
index 3332a6fe..836f5b06 100644
--- a/slpkg/messages.py
+++ b/slpkg/messages.py
@@ -32,6 +32,7 @@ class Msg:
"""
def __init__(self):
self.meta = _meta_
+ self.green = _meta_.color["GREEN"]
self.grey = _meta_.color["GREY"]
self.red = _meta_.color["RED"]
self.cyan = _meta_.color["CYAN"]
@@ -90,7 +91,7 @@ class Msg:
def done(self):
"""Message done
"""
- print(f"\b{self.grey}Done{self.endc}\n", end="")
+ print(f"\b{self.green}Done{self.endc}\n", end="")
def pkg(self, count):
"""Print singular plural
From a5d55d5c4b29e7abc5f5e34d9d4279a424f5ff1f Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Wed, 4 May 2022 21:38:07 +0300
Subject: [PATCH 36/65] Removed .idea folder
---
.idea/.gitignore | 3 ---
.idea/inspectionProfiles/profiles_settings.xml | 6 ------
.idea/modules.xml | 8 --------
.idea/slpkg.iml | 12 ------------
.idea/vcs.xml | 6 ------
5 files changed, 35 deletions(-)
delete mode 100644 .idea/.gitignore
delete mode 100644 .idea/inspectionProfiles/profiles_settings.xml
delete mode 100644 .idea/modules.xml
delete mode 100644 .idea/slpkg.iml
delete mode 100644 .idea/vcs.xml
diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index 26d33521..00000000
--- a/.idea/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
deleted file mode 100644
index 105ce2da..00000000
--- a/.idea/inspectionProfiles/profiles_settings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 6a8bd6fa..00000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/slpkg.iml b/.idea/slpkg.iml
deleted file mode 100644
index 8b8c3954..00000000
--- a/.idea/slpkg.iml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 94a25f7f..00000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
From a8be1a852a1eb46c01bc1ee7d908d0b0410ea62a Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Wed, 4 May 2022 22:06:32 +0300
Subject: [PATCH 37/65] Fixed PEP E501
Signed-off-by: Dimitris Zlatanidis
---
slpkg/sbo/slackbuild.py | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/slpkg/sbo/slackbuild.py b/slpkg/sbo/slackbuild.py
index 6b38314a..e21571a8 100644
--- a/slpkg/sbo/slackbuild.py
+++ b/slpkg/sbo/slackbuild.py
@@ -157,8 +157,10 @@ class SBoInstall(BlackList, Utils):
raise SystemExit(1)
print("\nInstalling summary")
print("=" * 79)
- print(f"{self.grey}Total {count_total} {self.msg.pkg(count_total)}.")
- print(f"{self.count_uni} {self.msg.pkg(self.count_uni)} will be installed, "
+ print(f"{self.grey}Total {count_total} "
+ f"{self.msg.pkg(count_total)}.")
+ print(f"{self.count_uni} {self.msg.pkg(self.count_uni)} "
+ f"will be installed, "
f"{self.count_ins} already installed and "
f"{self.count_upg} {self.msg.pkg(self.count_upg)}")
print(f"will be upgraded.{self.endc}\n")
@@ -338,14 +340,16 @@ class SBoInstall(BlackList, Utils):
self.msg.template(78)
elif self.unst[0] in src_link or self.unst[1] in src_link:
self.msg.template(78)
- print(f"| Package {prgnam} {self.red}{''.join(src_link)}{self.endc}")
+ print(f"| Package {prgnam} {self.red}"
+ f"{''.join(src_link)}{self.endc}")
self.msg.template(78)
else:
sbo_url = sbo_search_pkg(pkg)
sbo_link = SBoLink(sbo_url).tar_gz()
script = sbo_link.split("/")[-1]
if self.meta.sbosrcarch in ["on", "ON"]:
- src_link = list(self.sbosrcarsh(prgnam, sbo_link, src_link))
+ src_link = list(self.sbosrcarsh(prgnam, sbo_link,
+ src_link))
Download(self.build_folder, sbo_link.split(),
repo="sbo").start()
Download(self._SOURCES, src_link, repo="sbo").start()
@@ -357,10 +361,12 @@ class SBoInstall(BlackList, Utils):
binary = slack_package(prgnam)
if os.path.isfile("".join(binary)):
if GetFromInstalled(pkg).name() == pkg:
- print(f"[ {self.yellow}Upgrading{self.endc} ] --> {prgnam}")
+ print(f"[ {self.yellow}Upgrading{self.endc} ] --> "
+ f"{prgnam}")
upgraded.append(prgnam)
else:
- print(f"[ {self.green}Installing{self.endc} ] --> {prgnam}")
+ print(f"[ {self.green}Installing{self.endc} ] --> "
+ f"{prgnam}")
installs.append(prgnam)
if ("--rebuild" in self.flag and
GetFromInstalled(pkg).name() == pkg):
From 09cd73e2ad9bfea048f833e5d6c0888d9c0004b4 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Thu, 5 May 2022 22:29:13 +0300
Subject: [PATCH 38/65] Fixed stderr error output
Signed-off-by: Dimitris Zlatanidis
---
slpkg/sbo/autobuild.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/slpkg/sbo/autobuild.py b/slpkg/sbo/autobuild.py
index 250c8656..d2a70f05 100644
--- a/slpkg/sbo/autobuild.py
+++ b/slpkg/sbo/autobuild.py
@@ -65,8 +65,8 @@ class AutoBuild:
"""
if not os.path.isfile(self.path + self.script):
print("\nslpkg: Error: SlackBuild archive.tar.gz not found\n")
- raise SystemExit()
+ raise SystemExit(1)
for src in self.sources:
if not os.path.isfile(self.path + src):
print(f"\nslpkg: Error: Source file '{src}' not found\n")
- raise SystemExit()
+ raise SystemExit(1)
From 71f547e60da5345c5b05c40252169866fedc1a50 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Thu, 5 May 2022 22:31:10 +0300
Subject: [PATCH 39/65] Fixed PEP E501
Signed-off-by: Dimitris Zlatanidis
---
slpkg/sbo/build_num.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/slpkg/sbo/build_num.py b/slpkg/sbo/build_num.py
index 94ba9fc5..07d6fb4b 100644
--- a/slpkg/sbo/build_num.py
+++ b/slpkg/sbo/build_num.py
@@ -42,7 +42,8 @@ class BuildNumber(Utils):
if self.sbo_url:
SlackBuild = URL(f"{self.sbo_url}{self.pkg}.SlackBuild").reading()
else:
- SlackBuild = self.read_file(f"{self.meta.build_path}{self.pkg}/{self.pkg}.SlackBuild")
+ SlackBuild = self.read_file(f"{self.meta.build_path}{self.pkg}/"
+ f"{self.pkg}.SlackBuild")
for line in SlackBuild.splitlines():
line = line.lstrip()
if line.startswith("BUILD="):
From a3528832e7d8f5bae146f63f9868ead4ebec191a Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Fri, 6 May 2022 22:19:01 +0300
Subject: [PATCH 40/65] Removed unnecessary 'else'
Signed-off-by: Dimitris Zlatanidis
---
slpkg/slack/slack_version.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/slpkg/slack/slack_version.py b/slpkg/slack/slack_version.py
index dc3e7ea3..23940232 100644
--- a/slpkg/slack/slack_version.py
+++ b/slpkg/slack/slack_version.py
@@ -40,5 +40,4 @@ def slack_ver():
return (".".join(version[:2]))
else:
return (".".join(version))
- else:
- return _meta_.slackware_version
+ return _meta_.slackware_version
From 7b80aafa13b45f132267b156225c98c698859483 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sat, 7 May 2022 00:03:27 +0300
Subject: [PATCH 41/65] Fixed PEP E501
Signed-off-by: Dimitris Zlatanidis
---
slpkg/sbo/queue.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/slpkg/sbo/queue.py b/slpkg/sbo/queue.py
index 0bd3cf60..843fefa9 100644
--- a/slpkg/sbo/queue.py
+++ b/slpkg/sbo/queue.py
@@ -152,8 +152,8 @@ class QueuePkgs(Utils):
binary = slack_package(prgnam)
PackageManager(binary).upgrade(flag="--install-new")
else:
- print(f"\nPackage {prgnam} not found in the {self.meta.output} for "
- f"installation\n")
+ print(f"\nPackage {prgnam} not found in the "
+ f"{self.meta.output} for installation\n")
else:
print("\nPackages not found in the queue for installation\n")
raise SystemExit(1)
From 95ff953f53595e7ef7ed9c539541d9d2e6e83861 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sat, 7 May 2022 12:48:33 +0300
Subject: [PATCH 42/65] Updated code style
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 60dfad35..7bd33dd7 100644
--- a/slpkg/slack/patches.py
+++ b/slpkg/slack/patches.py
@@ -68,11 +68,11 @@ class Patches(BlackList, Utils):
self.msg = Msg()
self.version = self.meta.slack_rel
self.patch_path = self.meta.slpkg_tmp_patches
+ self.count_added = 0
+ self.count_upg = 0
self.pkg_for_upgrade = []
self.dwn_links = []
self.upgrade_all = []
- self.count_added = 0
- self.count_upg = 0
self.upgraded = []
self.installed = []
self.comp_sum = []
From c18eccfa94bc6121e3294bd0018c6183c3988016 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sun, 8 May 2022 00:01:11 +0300
Subject: [PATCH 43/65] Bugfix update custom repositories
Signed-off-by: Dimitris Zlatanidis
---
ChangeLog.txt | 5 ++++-
slpkg/init.py | 3 ++-
slpkg/main.py | 2 +-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 3517fb12..ce3656c4 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,8 +1,11 @@
-3.9.7 - 02/04/2022
+3.9.7 - 08/05/2022
Fixed:
- Stderr error output
Updated:
- Improve dependencies resolve speed
+Bugfix:
+- Update custom repositories
+- Passing repositories manual
3.9.6 - 02/04/2022
Updated:
diff --git a/slpkg/init.py b/slpkg/init.py
index ae5ff7a3..03c2ef87 100644
--- a/slpkg/init.py
+++ b/slpkg/init.py
@@ -762,6 +762,7 @@ class Update:
print("\nCheck and update repositories:\n")
default = self.meta.default_repositories
enabled = self.meta.repositories
+ custom = Repo().custom_repository()
# Replace the enabled repositories from user defined
if repos:
@@ -776,7 +777,7 @@ class Update:
if repo in default:
getattr(Initialization(False), repo)()
print(self.done, end="")
- elif repo in enabled:
+ elif repo in custom:
Initialization(False).custom(repo)
print(self.done, end="")
else:
diff --git a/slpkg/main.py b/slpkg/main.py
index 8e6451e4..4196c2ea 100644
--- a/slpkg/main.py
+++ b/slpkg/main.py
@@ -130,7 +130,7 @@ class ArgParse(BlackList):
repos = self.args[1].split("=")[-1].split(",")
for rp in repos:
if rp not in self.meta.repositories:
- repos.remove(rp)
+ usage(rp, 1)
update.run(repos)
else:
usage("", 1)
From 280e072e5a820148ceabf5c7aa9cb9912563457d Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sun, 8 May 2022 16:39:42 +0300
Subject: [PATCH 44/65] Bugfix check repositories
Signed-off-by: Dimitris Zlatanidis
---
slpkg/main.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/slpkg/main.py b/slpkg/main.py
index 4196c2ea..c2dbacd2 100644
--- a/slpkg/main.py
+++ b/slpkg/main.py
@@ -146,7 +146,7 @@ class ArgParse(BlackList):
repos = self.args[1].split("=")[-1].split(",")
for rp in repos:
if rp not in self.meta.repositories:
- repos.remove(rp)
+ usage(rp, 1)
upgrade.run(repos)
else:
usage("", 1)
From 3dc08566eb8ddadbcd5e9c034cc9f6167739e319 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sun, 8 May 2022 16:55:06 +0300
Subject: [PATCH 45/65] Added message_done method
Signed-off-by: Dimitris Zlatanidis
---
slpkg/init.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/slpkg/init.py b/slpkg/init.py
index 03c2ef87..34353f52 100644
--- a/slpkg/init.py
+++ b/slpkg/init.py
@@ -771,9 +771,7 @@ class Update:
for repo in enabled:
if check_for_local_repos(repo) is True:
continue
- print(f"{self.grey}Check repository "
- f"[{self.cyan}{repo}{self.grey}] ... "
- f"{self.endc}", end="", flush=True)
+ self.done_msg(repo)
if repo in default:
getattr(Initialization(False), repo)()
print(self.done, end="")
@@ -785,6 +783,13 @@ class Update:
print() # new line at end
raise SystemExit()
+ def done_msg(self, repo):
+ """Printing done message
+ """
+ print(f"{self.grey}Check repository "
+ f"[{self.cyan}{repo}{self.grey}] ... "
+ f"{self.endc}", end="", flush=True)
+
def check_exists_repositories(repo):
"""Checking if repositories exists by PACKAGES.TXT file
From 1447c6c2f1658a8999fe887d04063b9fee7a1895 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sun, 8 May 2022 17:14:41 +0300
Subject: [PATCH 46/65] Updated check exists repos
Signed-off-by: Dimitris Zlatanidis
---
slpkg/init.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/slpkg/init.py b/slpkg/init.py
index 34353f52..f14994f2 100644
--- a/slpkg/init.py
+++ b/slpkg/init.py
@@ -794,15 +794,13 @@ class Update:
def check_exists_repositories(repo):
"""Checking if repositories exists by PACKAGES.TXT file
"""
- pkg_list = "PACKAGES.TXT"
+ pkg_list = ""
if repo == "sbo":
pkg_list = "SLACKBUILDS.TXT"
if check_for_local_repos(repo) is True:
pkg_list = "PACKAGES.TXT"
- return ""
if not os.path.isfile(f"{_meta_.lib_path}{repo}_repo/{pkg_list}"):
return repo
- return ""
def check_for_local_repos(repo):
From d972a665fd20f81a2273c9dc76b8b8279a795af4 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sun, 8 May 2022 17:38:02 +0300
Subject: [PATCH 47/65] Updated check repositories
Signed-off-by: Dimitris Zlatanidis
---
slpkg/init.py | 6 +++---
slpkg/main.py | 16 ++++++++++------
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/slpkg/init.py b/slpkg/init.py
index f14994f2..93557574 100644
--- a/slpkg/init.py
+++ b/slpkg/init.py
@@ -794,13 +794,13 @@ class Update:
def check_exists_repositories(repo):
"""Checking if repositories exists by PACKAGES.TXT file
"""
- pkg_list = ""
+ pkg_list = "PACKAGES.TXT"
if repo == "sbo":
pkg_list = "SLACKBUILDS.TXT"
- if check_for_local_repos(repo) is True:
+ elif check_for_local_repos(repo) is True:
pkg_list = "PACKAGES.TXT"
if not os.path.isfile(f"{_meta_.lib_path}{repo}_repo/{pkg_list}"):
- return repo
+ return False
def check_for_local_repos(repo):
diff --git a/slpkg/main.py b/slpkg/main.py
index c2dbacd2..af803b51 100644
--- a/slpkg/main.py
+++ b/slpkg/main.py
@@ -88,11 +88,7 @@ class ArgParse(BlackList):
"clean"
]
- # checking if repositories exists
- enabled_repos = _meta_.repositories
- if len(self.args) > 1:
- repo = check_exists_repositories(args[1])
- if len(self.args) > 1 and self.args[0] in [
+ options = [
"-c", "--check",
"-l", "--list",
"-c", "--check",
@@ -101,7 +97,15 @@ class ArgParse(BlackList):
"-p", "--desc",
"-F", "--FIND",
"-f", "--find"
- ] and self.args[1] == repo and repo in enabled_repos:
+ ]
+
+ # checking if repositories exists
+ enabled_repos = _meta_.repositories
+ if len(self.args) > 1:
+ repo = self.args[1]
+ check = check_exists_repositories(repo)
+ if (len(self.args) > 1 and self.args[0] in options
+ and check is False and repo in enabled_repos):
print("\n Please update the packages lists. Run 'slpkg update'.\n"
" This command should be used to synchronize the packages\n"
" lists from the repositories that are enabled.\n")
From c3e169682a45a541746b1ef12ba210385bf90850 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sun, 8 May 2022 17:44:03 +0300
Subject: [PATCH 48/65] Bugfix stderr output
Signed-off-by: Dimitris Zlatanidis
---
slpkg/checks.py | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/slpkg/checks.py b/slpkg/checks.py
index 71cd862d..3b475eb8 100644
--- a/slpkg/checks.py
+++ b/slpkg/checks.py
@@ -35,7 +35,6 @@ class Updates:
self.repo = repo
self.meta = _meta_
self.green = _meta_.color["GREEN"]
- self.grey = _meta_.color["GREY"]
self.endc = _meta_.color["ENDC"]
self.msg = Msg()
self.check = 2
@@ -78,13 +77,11 @@ class Updates:
try:
self.check = self.all_repos[self.repo]()
except OSError:
- usage(self.repo)
- raise SystemExit()
+ usage(self.repo, 1)
elif self.repo in self.meta.repositories:
self.check = self._init.custom(self.repo)
else:
- usage(self.repo)
- raise SystemExit()
+ usage(self.repo, 1)
self.status_bar()
self.status()
self.print_status(self.repo)
@@ -99,8 +96,7 @@ class Updates:
try:
self.check = self.all_repos[repo]()
except OSError:
- usage(self.repo)
- raise SystemExit()
+ usage(self.repo, 1)
elif repo in self.meta.repositories:
self.check = self._init.custom(repo)
self.status()
@@ -132,5 +128,5 @@ class Updates:
cmd = "Repository is updated."
if self.count_news > 0:
cmd = "Run the command 'slpkg update'."
- print(f"{self.grey}From {self.count_repo} repositories need"
- f" {self.count_news} updating. {cmd}{self.endc}", end="\n")
+ print(f"From {self.count_repo} repositories need"
+ f" {self.count_news} updating. {cmd}", end="\n")
From 33ab8b93c59569a59b7113afe50eb30cacef8f93 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sun, 8 May 2022 18:04:38 +0300
Subject: [PATCH 49/65] Removed comments
Signed-off-by: Dimitris Zlatanidis
---
slpkg/init.py | 2 --
1 file changed, 2 deletions(-)
diff --git a/slpkg/init.py b/slpkg/init.py
index 93557574..96fae866 100644
--- a/slpkg/init.py
+++ b/slpkg/init.py
@@ -784,8 +784,6 @@ class Update:
raise SystemExit()
def done_msg(self, repo):
- """Printing done message
- """
print(f"{self.grey}Check repository "
f"[{self.cyan}{repo}{self.grey}] ... "
f"{self.endc}", end="", flush=True)
From 738aaa416e5f9c8006f1c0f676b9d33fd9a7d056 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sun, 8 May 2022 18:36:11 +0300
Subject: [PATCH 50/65] Updated create paths
Signed-off-by: Dimitris Zlatanidis
---
slpkg/init.py | 132 +++++++++++++++++---------------------------------
1 file changed, 44 insertions(+), 88 deletions(-)
diff --git a/slpkg/init.py b/slpkg/init.py
index 96fae866..113f3d79 100644
--- a/slpkg/init.py
+++ b/slpkg/init.py
@@ -56,22 +56,32 @@ class Initialization(Utils):
def constructing(self):
"""Creating the all necessary directories
"""
- if not os.path.exists(self.conf_path):
- os.mkdir(self.conf_path)
- if not os.path.exists(self.log_path):
- os.mkdir(self.log_path)
- if not os.path.exists(self.lib_path):
- os.mkdir(self.lib_path)
- if not os.path.exists(self.tmp_path):
- os.mkdir(self.tmp_path)
- if not os.path.exists(self.build_path):
- os.makedirs(self.build_path)
- if not os.path.exists(self._SOURCES):
- os.makedirs(self._SOURCES)
- if not os.path.exists(self.slpkg_tmp_packages):
- os.makedirs(self.slpkg_tmp_packages)
- if not os.path.exists(self.slpkg_tmp_patches):
- os.makedirs(self.slpkg_tmp_patches)
+ paths_basic = [
+ self.conf_path,
+ self.log_path,
+ self.lib_path,
+ self.tmp_path
+ ]
+
+ paths_extra = [
+ self.build_path,
+ self._SOURCES,
+ self.slpkg_tmp_packages,
+ self.slpkg_tmp_patches
+ ]
+
+ self.mkdir(paths_basic)
+ self.mkdirs(paths_extra)
+
+ def mkdir(self, path: list):
+ for p in path:
+ if not os.path.exists(p):
+ os.mkdir(p)
+
+ def mkdirs(self, path: list):
+ for p in path:
+ if not os.path.exists(p):
+ os.makedirs(p)
def custom(self, name):
"""Creating user select repository local library
@@ -84,10 +94,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- if not os.path.exists(log):
- os.mkdir(log)
- if not os.path.exists(lib):
- os.mkdir(lib)
+ self.mkdir([log, lib])
PACKAGES_TXT = f"{repo}/{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}{md5_file}"
@@ -110,10 +117,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- if not os.path.exists(log):
- os.mkdir(log)
- if not os.path.exists(lib):
- os.mkdir(lib)
+ self.mkdir([log, lib])
dirs = ["core/", "extra/", "patches/"]
for d in dirs:
if not os.path.exists(lib + d):
@@ -155,10 +159,7 @@ class Initialization(Utils):
# lst_file = ""
# md5_file = ""
log_file = "ChangeLog.txt"
- if not os.path.exists(log):
- os.mkdir(log)
- if not os.path.exists(lib):
- os.mkdir(lib)
+ self.mkdir([log, lib])
SLACKBUILDS_TXT = f"{repo}{slack_ver()}/{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = ""
@@ -181,10 +182,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- if not os.path.exists(log):
- os.mkdir(log)
- if not os.path.exists(lib):
- os.mkdir(lib)
+ self.mkdir([log, lib])
PACKAGES_TXT = f"{repo}{slack_ver()}/{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}{slack_ver()}/{md5_file}"
@@ -211,10 +209,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- if not os.path.exists(log):
- os.mkdir(log)
- if not os.path.exists(lib):
- os.mkdir(lib)
+ self.mkdir([log, lib])
if arch == "x86_64":
ar = arch
if self.meta.slack_rel == "current":
@@ -244,10 +239,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- if not os.path.exists(log):
- os.mkdir(log)
- if not os.path.exists(lib):
- os.mkdir(lib)
+ self.mkdir([log, lib])
if arch == "x86_64":
ar = "64"
PACKAGES_TXT = f"{repo}slackware{ar}-{slack_ver()}/{lib_file}"
@@ -274,10 +266,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- if not os.path.exists(log):
- os.mkdir(log)
- if not os.path.exists(lib):
- os.mkdir(lib)
+ self.mkdir([log, lib])
PACKAGES_TXT = f"{repo}{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}{md5_file}"
@@ -304,10 +293,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- if not os.path.exists(log):
- os.mkdir(log)
- if not os.path.exists(lib):
- os.mkdir(lib)
+ self.mkdir([log, lib])
if arch == "x86_64":
ar = f"{ver}-x86_64"
if self.meta.slack_rel == "current":
@@ -337,10 +323,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- if not os.path.exists(log):
- os.mkdir(log)
- if not os.path.exists(lib):
- os.mkdir(lib)
+ self.mkdir([log, lib])
PACKAGES_TXT = f"{repo}{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}{md5_file}"
@@ -365,10 +348,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- if not os.path.exists(log):
- os.mkdir(log)
- if not os.path.exists(lib):
- os.mkdir(lib)
+ self.mkdir([log, lib])
if self.meta.slack_rel == "current":
ver = self.meta.slack_rel
PACKAGES_TXT = f"{repo}{ver}/{lib_file}"
@@ -396,10 +376,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- if not os.path.exists(log):
- os.mkdir(log)
- if not os.path.exists(lib):
- os.mkdir(lib)
+ self.mkdir([log, lib])
if arch == "x86_64":
ar = "64"
version = self.meta.slacke_sub_repo[1:-1]
@@ -431,10 +408,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- if not os.path.exists(log):
- os.mkdir(log)
- if not os.path.exists(lib):
- os.mkdir(lib)
+ self.mkdir([log, lib])
if arch == "x86_64":
ar = "x86_64"
PACKAGES_TXT = f"{repo}{ar}/{slack_ver()}/{lib_file}"
@@ -462,10 +436,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- if not os.path.exists(log):
- os.mkdir(log)
- if not os.path.exists(lib):
- os.mkdir(lib)
+ self.mkdir([log, lib])
if arch == "x86_64":
ar = "x86_64"
PACKAGES_TXT = f"{repo}{ar}/current/{lib_file}"
@@ -491,10 +462,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- if not os.path.exists(log):
- os.mkdir(log)
- if not os.path.exists(lib):
- os.mkdir(lib)
+ self.mkdir([log, lib])
PACKAGES_TXT = f"{repo}{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}{md5_file}"
@@ -521,10 +489,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- if not os.path.exists(log):
- os.mkdir(log)
- if not os.path.exists(lib):
- os.mkdir(lib)
+ self.mkdir([log, lib])
if arch == "x86_64":
ar = "x86_64"
version = self.meta.msb_sub_repo[1:-1]
@@ -556,10 +521,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- if not os.path.exists(log):
- os.mkdir(log)
- if not os.path.exists(lib):
- os.mkdir(lib)
+ self.mkdir([log, lib])
if arch == "x86_64":
ar = "x86_64"
if self.meta.slack_rel == "current":
@@ -590,10 +552,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- if not os.path.exists(log):
- os.mkdir(log)
- if not os.path.exists(lib):
- os.mkdir(lib)
+ self.mkdir([log, lib])
if arch == "x86_64":
ar = "64"
PACKAGES_TXT = f"{repo}{nickname}{ar}-{slack_ver()}/{lib_file}"
@@ -621,10 +580,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- if not os.path.exists(log):
- os.mkdir(log)
- if not os.path.exists(lib):
- os.mkdir(lib)
+ self.mkdir([log, lib])
if arch == "x86_64":
ar = "64"
version = self.meta.mles_sub_repo[1:-1]
From de681e547c7b55b41234ba8bf687245f01a0b810 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sun, 8 May 2022 18:39:28 +0300
Subject: [PATCH 51/65] Updated method name
Signed-off-by: Dimitris Zlatanidis
---
slpkg/init.py | 48 ++++++++++++++++++++++++------------------------
1 file changed, 24 insertions(+), 24 deletions(-)
diff --git a/slpkg/init.py b/slpkg/init.py
index 113f3d79..f3986b11 100644
--- a/slpkg/init.py
+++ b/slpkg/init.py
@@ -70,15 +70,15 @@ class Initialization(Utils):
self.slpkg_tmp_patches
]
- self.mkdir(paths_basic)
- self.mkdirs(paths_extra)
+ self.make_dir(paths_basic)
+ self.make_dirs(paths_extra)
- def mkdir(self, path: list):
+ def make_dir(self, path: list):
for p in path:
if not os.path.exists(p):
- os.mkdir(p)
+ os.make_dir(p)
- def mkdirs(self, path: list):
+ def make_dirs(self, path: list):
for p in path:
if not os.path.exists(p):
os.makedirs(p)
@@ -94,7 +94,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- self.mkdir([log, lib])
+ self.make_dir([log, lib])
PACKAGES_TXT = f"{repo}/{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}{md5_file}"
@@ -117,11 +117,11 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- self.mkdir([log, lib])
+ self.make_dir([log, lib])
dirs = ["core/", "extra/", "patches/"]
for d in dirs:
if not os.path.exists(lib + d):
- os.mkdir(lib + d)
+ os.make_dir(lib + d)
PACKAGES_TXT = mirrors(lib_file, "")
FILELIST_TXT = ""
CHECKSUMS_MD5 = mirrors(md5_file, "")
@@ -159,7 +159,7 @@ class Initialization(Utils):
# lst_file = ""
# md5_file = ""
log_file = "ChangeLog.txt"
- self.mkdir([log, lib])
+ self.make_dir([log, lib])
SLACKBUILDS_TXT = f"{repo}{slack_ver()}/{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = ""
@@ -182,7 +182,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- self.mkdir([log, lib])
+ self.make_dir([log, lib])
PACKAGES_TXT = f"{repo}{slack_ver()}/{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}{slack_ver()}/{md5_file}"
@@ -209,7 +209,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- self.mkdir([log, lib])
+ self.make_dir([log, lib])
if arch == "x86_64":
ar = arch
if self.meta.slack_rel == "current":
@@ -239,7 +239,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- self.mkdir([log, lib])
+ self.make_dir([log, lib])
if arch == "x86_64":
ar = "64"
PACKAGES_TXT = f"{repo}slackware{ar}-{slack_ver()}/{lib_file}"
@@ -266,7 +266,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- self.mkdir([log, lib])
+ self.make_dir([log, lib])
PACKAGES_TXT = f"{repo}{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}{md5_file}"
@@ -293,7 +293,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- self.mkdir([log, lib])
+ self.make_dir([log, lib])
if arch == "x86_64":
ar = f"{ver}-x86_64"
if self.meta.slack_rel == "current":
@@ -323,7 +323,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- self.mkdir([log, lib])
+ self.make_dir([log, lib])
PACKAGES_TXT = f"{repo}{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}{md5_file}"
@@ -348,7 +348,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- self.mkdir([log, lib])
+ self.make_dir([log, lib])
if self.meta.slack_rel == "current":
ver = self.meta.slack_rel
PACKAGES_TXT = f"{repo}{ver}/{lib_file}"
@@ -376,7 +376,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- self.mkdir([log, lib])
+ self.make_dir([log, lib])
if arch == "x86_64":
ar = "64"
version = self.meta.slacke_sub_repo[1:-1]
@@ -408,7 +408,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- self.mkdir([log, lib])
+ self.make_dir([log, lib])
if arch == "x86_64":
ar = "x86_64"
PACKAGES_TXT = f"{repo}{ar}/{slack_ver()}/{lib_file}"
@@ -436,7 +436,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- self.mkdir([log, lib])
+ self.make_dir([log, lib])
if arch == "x86_64":
ar = "x86_64"
PACKAGES_TXT = f"{repo}{ar}/current/{lib_file}"
@@ -462,7 +462,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- self.mkdir([log, lib])
+ self.make_dir([log, lib])
PACKAGES_TXT = f"{repo}{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}{md5_file}"
@@ -489,7 +489,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- self.mkdir([log, lib])
+ self.make_dir([log, lib])
if arch == "x86_64":
ar = "x86_64"
version = self.meta.msb_sub_repo[1:-1]
@@ -521,7 +521,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- self.mkdir([log, lib])
+ self.make_dir([log, lib])
if arch == "x86_64":
ar = "x86_64"
if self.meta.slack_rel == "current":
@@ -552,7 +552,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- self.mkdir([log, lib])
+ self.make_dir([log, lib])
if arch == "x86_64":
ar = "64"
PACKAGES_TXT = f"{repo}{nickname}{ar}-{slack_ver()}/{lib_file}"
@@ -580,7 +580,7 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- self.mkdir([log, lib])
+ self.make_dir([log, lib])
if arch == "x86_64":
ar = "64"
version = self.meta.mles_sub_repo[1:-1]
From 2bbdda0ec5affc6cba0131026aaa5409678d655f Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sun, 8 May 2022 18:43:44 +0300
Subject: [PATCH 52/65] Fixed AttributError: module 'os'
Signed-off-by: Dimitris Zlatanidis
---
slpkg/init.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/slpkg/init.py b/slpkg/init.py
index f3986b11..de437b03 100644
--- a/slpkg/init.py
+++ b/slpkg/init.py
@@ -76,7 +76,7 @@ class Initialization(Utils):
def make_dir(self, path: list):
for p in path:
if not os.path.exists(p):
- os.make_dir(p)
+ os.mkdir(p)
def make_dirs(self, path: list):
for p in path:
From 4d38b3df0ca9e4dd732f49b746230e5d507a260b Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sun, 8 May 2022 19:26:35 +0300
Subject: [PATCH 53/65] Fixed stderr error output
Signed-off-by: Dimitris Zlatanidis
---
slpkg/binary/install.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/slpkg/binary/install.py b/slpkg/binary/install.py
index 72309c19..5cc2143c 100644
--- a/slpkg/binary/install.py
+++ b/slpkg/binary/install.py
@@ -135,7 +135,7 @@ class BinaryInstall(BlackList, Utils):
print("\nMatching summary")
print("=" * 79)
print(f"Total {sums[0]} matching packages\n")
- raise SystemExit(1)
+ raise SystemExit()
print("\nInstalling summary")
print("=" * 79)
print(f"{self.grey}Total {sums[0]} {self.msg.pkg(sums[0])}.")
From a5af3006abd882be1a655b0fbd28dd5b49b28852 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sun, 8 May 2022 22:41:46 +0300
Subject: [PATCH 54/65] Fixed update slack repository
Signed-off-by: Dimitris Zlatanidis
---
slpkg/init.py | 8 ++++----
slpkg/slack/slackware_repo.py | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/slpkg/init.py b/slpkg/init.py
index de437b03..e1b09400 100644
--- a/slpkg/init.py
+++ b/slpkg/init.py
@@ -117,11 +117,11 @@ class Initialization(Utils):
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
- self.make_dir([log, lib])
dirs = ["core/", "extra/", "patches/"]
- for d in dirs:
- if not os.path.exists(lib + d):
- os.make_dir(lib + d)
+ self.make_dir([log, lib])
+ self.make_dir([f"{lib}{dirs[0]}",
+ f"{lib}{dirs[1]}",
+ f"{lib}{dirs[2]}"])
PACKAGES_TXT = mirrors(lib_file, "")
FILELIST_TXT = ""
CHECKSUMS_MD5 = mirrors(md5_file, "")
diff --git a/slpkg/slack/slackware_repo.py b/slpkg/slack/slackware_repo.py
index 4c27820b..639e3c94 100644
--- a/slpkg/slack/slackware_repo.py
+++ b/slpkg/slack/slackware_repo.py
@@ -39,4 +39,4 @@ def slackware_repository():
for pkg in slack_repo[0]:
names.append(split_package(pkg)[0])
packages.append(pkg[:-4])
- return packages, names
\ No newline at end of file
+ return packages, names
From f9a2a983a90fd0f9ae5edbea657c5dd05dabc33e Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Sun, 8 May 2022 23:53:59 +0300
Subject: [PATCH 55/65] Renamed url attribute
Signed-off-by: Dimitris Zlatanidis
---
slpkg/grep_md5.py | 6 +++---
slpkg/sbo/build_num.py | 3 ++-
slpkg/sbo/read.py | 8 ++++----
slpkg/slack/patches.py | 6 +++---
slpkg/slpkg_update.py | 2 +-
slpkg/url_read.py | 2 +-
6 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/slpkg/grep_md5.py b/slpkg/grep_md5.py
index 9f387b30..f701a83f 100644
--- a/slpkg/grep_md5.py
+++ b/slpkg/grep_md5.py
@@ -33,11 +33,11 @@ def pkg_checksum(binary, repo):
"""
md5 = "None"
if repo == "slack_patches" and _meta_.slack_rel == "stable":
- CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "patches/")).reading()
+ CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "patches/")).get_request()
elif repo == "slack_patches" and _meta_.slack_rel == "current":
- CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "")).reading()
+ CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "")).get_request()
elif repo == "slpkg":
- CHECKSUMS_md5 = URL(_meta_.CHECKSUMS_link).reading()
+ CHECKSUMS_md5 = URL(_meta_.CHECKSUMS_link).get_request()
else:
lib = f"{_meta_.lib_path}{repo}_repo/CHECKSUMS.md5"
f = open(lib, "r")
diff --git a/slpkg/sbo/build_num.py b/slpkg/sbo/build_num.py
index 07d6fb4b..bbc8c08e 100644
--- a/slpkg/sbo/build_num.py
+++ b/slpkg/sbo/build_num.py
@@ -40,7 +40,8 @@ class BuildNumber(Utils):
def get(self):
num = "NO_BUILD"
if self.sbo_url:
- SlackBuild = URL(f"{self.sbo_url}{self.pkg}.SlackBuild").reading()
+ SlackBuild = URL(f"{self.sbo_url}"
+ f"{self.pkg}.SlackBuild").get_request()
else:
SlackBuild = self.read_file(f"{self.meta.build_path}{self.pkg}/"
f"{self.pkg}.SlackBuild")
diff --git a/slpkg/sbo/read.py b/slpkg/sbo/read.py
index 9109e699..9ca0e38e 100644
--- a/slpkg/sbo/read.py
+++ b/slpkg/sbo/read.py
@@ -34,19 +34,19 @@ class ReadSBo:
def readme(self, sbo_readme):
"""Read SlackBuild README file
"""
- return URL(self.sbo_url + sbo_readme).reading()
+ return URL(self.sbo_url + sbo_readme).get_request()
def info(self, name, sbo_file):
"""Read info file
"""
- return URL(self.sbo_url + name + sbo_file).reading()
+ return URL(self.sbo_url + name + sbo_file).get_request()
def slackbuild(self, name, sbo_file):
"""Read SlackBuild file
"""
- return URL(self.sbo_url + name + sbo_file).reading()
+ return URL(self.sbo_url + name + sbo_file).get_request()
def doinst(self, doinst_sh):
"""Read SlackBuild doinst.sh
"""
- return URL(self.sbo_url + doinst_sh).reading()
+ return URL(self.sbo_url + doinst_sh).get_request()
diff --git a/slpkg/slack/patches.py b/slpkg/slack/patches.py
index 7bd33dd7..00ffeab0 100644
--- a/slpkg/slack/patches.py
+++ b/slpkg/slack/patches.py
@@ -80,9 +80,9 @@ class Patches(BlackList, Utils):
self.msg.checking()
if self.version == "stable":
self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT",
- "patches/")).reading()
+ "patches/")).get_request()
else:
- self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "")).reading()
+ self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "")).get_request()
def start(self):
"""Install new patches from official Slackware mirrors
@@ -268,7 +268,7 @@ class Patches(BlackList, Utils):
"""This replace slackpkg ChangeLog.txt file with new
from Slackware official mirrors after update distribution.
"""
- NEW_ChangeLog_txt = URL(mirrors("ChangeLog.txt", "")).reading()
+ NEW_ChangeLog_txt = URL(mirrors("ChangeLog.txt", "")).get_request()
if os.path.isfile(f"{self.meta.slackpkg_lib_path}ChangeLog.txt.old"):
os.remove(f"{self.meta.slackpkg_lib_path}ChangeLog.txt.old")
if os.path.isfile(f"{self.meta.slackpkg_lib_path}ChangeLog.txt"):
diff --git a/slpkg/slpkg_update.py b/slpkg/slpkg_update.py
index cbb2dea8..f80b8a9d 100644
--- a/slpkg/slpkg_update.py
+++ b/slpkg/slpkg_update.py
@@ -47,7 +47,7 @@ def it_self_update():
_meta_.__all__,
branch,
_meta_.__all__))
- version_data = URL(ver_link).reading()
+ version_data = URL(ver_link).get_request()
for line in version_data.splitlines():
line = line.strip()
diff --git a/slpkg/url_read.py b/slpkg/url_read.py
index 07841984..18fc8c33 100644
--- a/slpkg/url_read.py
+++ b/slpkg/url_read.py
@@ -40,7 +40,7 @@ class URL:
else:
self.http = urllib3.PoolManager()
- def reading(self):
+ def get_request(self):
"""Open url and read
"""
try:
From 7f68aafe3931a0369cbff92b1efd0481cf6510c1 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Mon, 9 May 2022 00:01:41 +0300
Subject: [PATCH 56/65] Renamed to --repos flag
Signed-off-by: Dimitris Zlatanidis
---
ChangeLog.txt | 3 ++-
slpkg/arguments.py | 8 ++++----
slpkg/main.py | 4 ++--
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/ChangeLog.txt b/ChangeLog.txt
index ce3656c4..4116600a 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,8 +1,9 @@
-3.9.7 - 08/05/2022
+3.9.7 - 09/05/2022
Fixed:
- Stderr error output
Updated:
- Improve dependencies resolve speed
+- Renamed --repositories to --repos flag
Bugfix:
- Update custom repositories
- Passing repositories manual
diff --git a/slpkg/arguments.py b/slpkg/arguments.py
index d4323289..a67f7a58 100644
--- a/slpkg/arguments.py
+++ b/slpkg/arguments.py
@@ -48,10 +48,10 @@ Usage: slpkg [COMMANDS|OPTIONS] {repository|package...}
_Slackware package manager_______
Commands:
- update, --repositories=[...] Run this command to update all
+ update, --repos=[...] Run this command to update all
the packages lists.
- upgrade, --repositories=[...] Delete and recreate all packages
+ upgrade, --repos=[...] Delete and recreate all packages
lists.
repo-add [repository name] [URL] Add custom repository.
@@ -175,8 +175,8 @@ def usage(repo, stderr):
"""Usage: slpkg [COMMANDS|OPTIONS] {repository|package...}
Commands:
- [update, --repositories=[...]]
- [upgrade, --repositories=[...]]
+ [update, --repos=[...]]
+ [upgrade, --repos=[...]]
[repo-add [repository name] [URL]]
[repo-remove [repository]]
[repo-enable]
diff --git a/slpkg/main.py b/slpkg/main.py
index af803b51..2867ba57 100644
--- a/slpkg/main.py
+++ b/slpkg/main.py
@@ -130,7 +130,7 @@ class ArgParse(BlackList):
if len(self.args) == 1 and self.args[0] == "update":
update.run(repos="")
elif (len(self.args) == 2 and self.args[0] == "update" and
- self.args[1].startswith("--repositories=")):
+ self.args[1].startswith("--repos=")):
repos = self.args[1].split("=")[-1].split(",")
for rp in repos:
if rp not in self.meta.repositories:
@@ -146,7 +146,7 @@ class ArgParse(BlackList):
if len(self.args) == 1 and self.args[0] == "upgrade":
upgrade.run(repos="")
elif (len(self.args) == 2 and self.args[0] == "upgrade" and
- self.args[1].startswith("--repositories=")):
+ self.args[1].startswith("--repos=")):
repos = self.args[1].split("=")[-1].split(",")
for rp in repos:
if rp not in self.meta.repositories:
From 209760156197d589a8194bcc27cffd819c012a4e Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Mon, 9 May 2022 00:29:12 +0300
Subject: [PATCH 57/65] Fixed PEP E501
Signed-off-by: Dimitris Zlatanidis
---
slpkg/binary/greps.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/slpkg/binary/greps.py b/slpkg/binary/greps.py
index 8a9c7739..b1404e78 100644
--- a/slpkg/binary/greps.py
+++ b/slpkg/binary/greps.py
@@ -194,7 +194,8 @@ class Requires:
else:
return ""
else:
- PACKAGES_TXT = Utils().read_file(f"{_meta_.lib_path}{self.repo}_repo/PACKAGES.TXT")
+ PACKAGES_TXT = Utils().read_file(f"{_meta_.lib_path}"
+ f"{self.repo}_repo/PACKAGES.TXT")
for line in PACKAGES_TXT.splitlines():
if line.startswith("PACKAGE NAME:"):
pkg_name = split_package(line[14:].strip())[0]
From d4de0e458769d2d89baa6b71528dac8d0298e88a Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Mon, 9 May 2022 08:34:11 +0300
Subject: [PATCH 58/65] Pass arch to self
Signed-off-by: Dimitris Zlatanidis
---
slpkg/init.py | 35 +++++++++++++----------------------
1 file changed, 13 insertions(+), 22 deletions(-)
diff --git a/slpkg/init.py b/slpkg/init.py
index e1b09400..2249d82b 100644
--- a/slpkg/init.py
+++ b/slpkg/init.py
@@ -42,6 +42,7 @@ class Initialization(Utils):
def __init__(self, check):
self.check = check
self.meta = _meta_
+ self.arch = _meta_.arch
self.def_repos_dict = Repo().default_repository()
self.conf_path = self.meta.conf_path
self.log_path = self.meta.log_path
@@ -200,7 +201,6 @@ class Initialization(Utils):
"""
ar = "x86"
ver = slack_ver()
- arch = self.meta.arch
repo = self.def_repos_dict["alien"]
log = self.log_path + "alien/"
lib = self.lib_path + "alien_repo/"
@@ -210,8 +210,8 @@ class Initialization(Utils):
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
- if arch == "x86_64":
- ar = arch
+ if self.arch == "x86_64":
+ ar = self.arch
if self.meta.slack_rel == "current":
ver = self.meta.slack_rel
PACKAGES_TXT = f"{repo}/{ver}/{ar}/{lib_file}"
@@ -230,7 +230,6 @@ class Initialization(Utils):
"""Creating slacky.eu local library
"""
ar = ""
- arch = self.meta.arch
repo = self.def_repos_dict["slacky"]
log = self.log_path + "slacky/"
lib = self.lib_path + "slacky_repo/"
@@ -240,7 +239,7 @@ class Initialization(Utils):
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
- if arch == "x86_64":
+ if self.arch == "x86_64":
ar = "64"
PACKAGES_TXT = f"{repo}slackware{ar}-{slack_ver()}/{lib_file}"
FILELIST_TXT = ""
@@ -284,7 +283,6 @@ class Initialization(Utils):
"""
ver = slack_ver()
ar = f"{ver}-x86"
- arch = self.meta.arch
repo = self.def_repos_dict["slonly"]
log = self.log_path + "slonly/"
lib = self.lib_path + "slonly_repo/"
@@ -294,11 +292,11 @@ class Initialization(Utils):
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
- if arch == "x86_64":
+ if self.arch == "x86_64":
ar = f"{ver}-x86_64"
if self.meta.slack_rel == "current":
ar = f"{self.meta.slack_rel}-x86"
- if self.meta.slack_rel == "current" and arch == "x86_64":
+ if self.meta.slack_rel == "current" and self.arch == "x86_64":
ar = f"{self.meta.slack_rel}-x86_64"
PACKAGES_TXT = f"{repo}{ar}/{lib_file}"
FILELIST_TXT = ""
@@ -367,7 +365,6 @@ class Initialization(Utils):
"""Creating Slacke local library
"""
ar = ""
- arch = self.meta.arch
repo = self.def_repos_dict["slacke"]
log = self.log_path + "slacke/"
lib = self.lib_path + "slacke_repo/"
@@ -377,7 +374,7 @@ class Initialization(Utils):
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
- if arch == "x86_64":
+ if self.arch == "x86_64":
ar = "64"
version = self.meta.slacke_sub_repo[1:-1]
PACKAGES_TXT = (f"{repo}slacke{version}/slackware{ar}-"
@@ -399,7 +396,6 @@ class Initialization(Utils):
"""Creating SalixOS local library
"""
ar = "i486"
- arch = self.meta.arch
repo = self.def_repos_dict["salix"]
log = self.log_path + "salix/"
lib = self.lib_path + "salix_repo/"
@@ -409,7 +405,7 @@ class Initialization(Utils):
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
- if arch == "x86_64":
+ if self.arch == "x86_64":
ar = "x86_64"
PACKAGES_TXT = f"{repo}{ar}/{slack_ver()}/{lib_file}"
FILELIST_TXT = ""
@@ -427,7 +423,6 @@ class Initialization(Utils):
"""Creating slackel.gr local library
"""
ar = "i486"
- arch = self.meta.arch
repo = self.def_repos_dict["slackl"]
log = self.log_path + "slackl/"
lib = self.lib_path + "slackl_repo/"
@@ -437,7 +432,7 @@ class Initialization(Utils):
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
- if arch == "x86_64":
+ if self.arch == "x86_64":
ar = "x86_64"
PACKAGES_TXT = f"{repo}{ar}/current/{lib_file}"
FILELIST_TXT = ""
@@ -480,7 +475,6 @@ class Initialization(Utils):
"""
ar = "x86"
ver_slack = slack_ver()
- arch = self.meta.arch
repo = self.def_repos_dict["msb"]
log = self.log_path + "msb/"
lib = self.lib_path + "msb_repo/"
@@ -490,7 +484,7 @@ class Initialization(Utils):
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
- if arch == "x86_64":
+ if self.arch == "x86_64":
ar = "x86_64"
version = self.meta.msb_sub_repo[1:-1]
if self.meta.slack_rel == "current":
@@ -512,7 +506,6 @@ class Initialization(Utils):
"""
ar = "x86"
ver_slack = slack_ver()
- arch = self.meta.arch
repo = self.def_repos_dict["csb"]
log = self.log_path + "csb/"
lib = self.lib_path + "csb_repo/"
@@ -522,7 +515,7 @@ class Initialization(Utils):
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
- if arch == "x86_64":
+ if self.arch == "x86_64":
ar = "x86_64"
if self.meta.slack_rel == "current":
ver_slack = self.meta.slack_rel
@@ -543,7 +536,6 @@ class Initialization(Utils):
"""
nickname = "slack-n-free"
ar = ""
- arch = self.meta.arch
repo = self.def_repos_dict["connos"]
log = self.log_path + "connos/"
lib = self.lib_path + "connos_repo/"
@@ -553,7 +545,7 @@ class Initialization(Utils):
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
- if arch == "x86_64":
+ if self.arch == "x86_64":
ar = "64"
PACKAGES_TXT = f"{repo}{nickname}{ar}-{slack_ver()}/{lib_file}"
FILELIST_TXT = ""
@@ -571,7 +563,6 @@ class Initialization(Utils):
"""Creating Microlinux local library
"""
ar = "32"
- arch = self.meta.arch
repo = self.def_repos_dict["mles"]
log = self.log_path + "mles/"
lib = self.lib_path + "mles_repo/"
@@ -581,7 +572,7 @@ class Initialization(Utils):
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
- if arch == "x86_64":
+ if self.arch == "x86_64":
ar = "64"
version = self.meta.mles_sub_repo[1:-1]
PACKAGES_TXT = f"{repo}{version}-{slack_ver()}-{ar}bit/{lib_file}"
From b6ffa5dde49c7dc873b3eb22d395929a2ee4f29a Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Mon, 9 May 2022 08:46:57 +0300
Subject: [PATCH 59/65] Pass slack version to self
Signed-off-by: Dimitris Zlatanidis
---
slpkg/init.py | 54 +++++++++++++++++++++++++--------------------------
1 file changed, 27 insertions(+), 27 deletions(-)
diff --git a/slpkg/init.py b/slpkg/init.py
index 2249d82b..fc6666ba 100644
--- a/slpkg/init.py
+++ b/slpkg/init.py
@@ -43,6 +43,7 @@ class Initialization(Utils):
self.check = check
self.meta = _meta_
self.arch = _meta_.arch
+ self.slack_ver = slack_ver()
self.def_repos_dict = Repo().default_repository()
self.conf_path = self.meta.conf_path
self.log_path = self.meta.log_path
@@ -161,10 +162,10 @@ class Initialization(Utils):
# md5_file = ""
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
- SLACKBUILDS_TXT = f"{repo}{slack_ver()}/{lib_file}"
+ SLACKBUILDS_TXT = f"{repo}{self.slack_ver}/{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = ""
- ChangeLog_txt = f"{repo}{slack_ver()}/{log_file}"
+ ChangeLog_txt = f"{repo}{self.slack_ver}/{log_file}"
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, SLACKBUILDS_TXT, repo_name)
@@ -184,10 +185,10 @@ class Initialization(Utils):
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
- PACKAGES_TXT = f"{repo}{slack_ver()}/{lib_file}"
+ PACKAGES_TXT = f"{repo}{self.slack_ver}/{lib_file}"
FILELIST_TXT = ""
- CHECKSUMS_MD5 = f"{repo}{slack_ver()}/{md5_file}"
- ChangeLog_txt = f"{repo}{slack_ver()}/{log_file}"
+ CHECKSUMS_MD5 = f"{repo}{self.slack_ver}/{md5_file}"
+ ChangeLog_txt = f"{repo}{self.slack_ver}/{log_file}"
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, PACKAGES_TXT, repo_name)
@@ -200,7 +201,7 @@ class Initialization(Utils):
"""Creating alien local library
"""
ar = "x86"
- ver = slack_ver()
+ ver = self.slack_ver
repo = self.def_repos_dict["alien"]
log = self.log_path + "alien/"
lib = self.lib_path + "alien_repo/"
@@ -241,11 +242,11 @@ class Initialization(Utils):
self.make_dir([log, lib])
if self.arch == "x86_64":
ar = "64"
- PACKAGES_TXT = f"{repo}slackware{ar}-{slack_ver()}/{lib_file}"
+ PACKAGES_TXT = f"{repo}slackware{ar}-{self.slack_ver}/{lib_file}"
FILELIST_TXT = ""
- CHECKSUMS_MD5 = f"{repo}slackware{ar}-{slack_ver()}/{md5_file}"
+ CHECKSUMS_MD5 = f"{repo}slackware{ar}-{self.slack_ver}/{md5_file}"
- ChangeLog_txt = f"{repo}slackware{ar}-{slack_ver()}/{log_file}"
+ ChangeLog_txt = f"{repo}slackware{ar}-{self.slack_ver}/{log_file}"
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, PACKAGES_TXT, repo_name)
@@ -281,8 +282,7 @@ class Initialization(Utils):
def slonly(self):
"""Creating slackers local library
"""
- ver = slack_ver()
- ar = f"{ver}-x86"
+ ar = f"{self.slack_ver}-x86"
repo = self.def_repos_dict["slonly"]
log = self.log_path + "slonly/"
lib = self.lib_path + "slonly_repo/"
@@ -293,7 +293,7 @@ class Initialization(Utils):
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
if self.arch == "x86_64":
- ar = f"{ver}-x86_64"
+ ar = f"{self.slack_ver}-x86_64"
if self.meta.slack_rel == "current":
ar = f"{self.meta.slack_rel}-x86"
if self.meta.slack_rel == "current" and self.arch == "x86_64":
@@ -337,7 +337,7 @@ class Initialization(Utils):
def multi(self):
"""Creating alien multilib local library
"""
- ver = slack_ver()
+ ver = self.slack_ver
repo = self.def_repos_dict["multi"]
log = self.log_path + "multi/"
lib = self.lib_path + "multi_repo/"
@@ -378,12 +378,12 @@ class Initialization(Utils):
ar = "64"
version = self.meta.slacke_sub_repo[1:-1]
PACKAGES_TXT = (f"{repo}slacke{version}/slackware{ar}-"
- f"{slack_ver()}/{lib_file}")
+ f"{self.slack_ver}/{lib_file}")
FILELIST_TXT = ""
CHECKSUMS_MD5 = (f"{repo}slacke{version}/slackware{ar}-"
- f"{slack_ver()}/{md5_file}")
+ f"{self.slack_ver}/{md5_file}")
ChangeLog_txt = (f"{repo}slacke{version}/slackware{ar}-"
- f"{slack_ver()}/{log_file}")
+ f"{self.slack_ver}/{log_file}")
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, PACKAGES_TXT, repo_name)
@@ -407,10 +407,10 @@ class Initialization(Utils):
self.make_dir([log, lib])
if self.arch == "x86_64":
ar = "x86_64"
- PACKAGES_TXT = f"{repo}{ar}/{slack_ver()}/{lib_file}"
+ PACKAGES_TXT = f"{repo}{ar}/{self.slack_ver}/{lib_file}"
FILELIST_TXT = ""
- CHECKSUMS_MD5 = f"{repo}{ar}/{slack_ver()}/{md5_file}"
- ChangeLog_txt = f"{repo}{ar}/{slack_ver()}/{log_file}"
+ CHECKSUMS_MD5 = f"{repo}{ar}/{self.slack_ver}/{md5_file}"
+ ChangeLog_txt = f"{repo}{ar}/{self.slack_ver}/{log_file}"
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, PACKAGES_TXT, repo_name)
@@ -474,7 +474,7 @@ class Initialization(Utils):
"""Creating MATE local library
"""
ar = "x86"
- ver_slack = slack_ver()
+ ver_slack = self.slack_ver
repo = self.def_repos_dict["msb"]
log = self.log_path + "msb/"
lib = self.lib_path + "msb_repo/"
@@ -505,7 +505,7 @@ class Initialization(Utils):
"""Creating Cinnamon local library
"""
ar = "x86"
- ver_slack = slack_ver()
+ ver_slack = self.slack_ver
repo = self.def_repos_dict["csb"]
log = self.log_path + "csb/"
lib = self.lib_path + "csb_repo/"
@@ -547,10 +547,10 @@ class Initialization(Utils):
self.make_dir([log, lib])
if self.arch == "x86_64":
ar = "64"
- PACKAGES_TXT = f"{repo}{nickname}{ar}-{slack_ver()}/{lib_file}"
+ PACKAGES_TXT = f"{repo}{nickname}{ar}-{self.slack_ver}/{lib_file}"
FILELIST_TXT = ""
- CHECKSUMS_MD5 = f"{repo}{nickname}{ar}-{slack_ver()}/{md5_file}"
- ChangeLog_txt = f"{repo}{nickname}{ar}-{slack_ver()}/{log_file}"
+ CHECKSUMS_MD5 = f"{repo}{nickname}{ar}-{self.slack_ver}/{md5_file}"
+ ChangeLog_txt = f"{repo}{nickname}{ar}-{self.slack_ver}/{log_file}"
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, PACKAGES_TXT, repo_name)
@@ -575,10 +575,10 @@ class Initialization(Utils):
if self.arch == "x86_64":
ar = "64"
version = self.meta.mles_sub_repo[1:-1]
- PACKAGES_TXT = f"{repo}{version}-{slack_ver()}-{ar}bit/{lib_file}"
+ PACKAGES_TXT = f"{repo}{version}-{self.slack_ver}-{ar}bit/{lib_file}"
FILELIST_TXT = ""
- CHECKSUMS_MD5 = f"{repo}{version}-{slack_ver()}-{ar}bit/{md5_file}"
- ChangeLog_txt = f"{repo}{version}-{slack_ver()}-{ar}bit/{log_file}"
+ CHECKSUMS_MD5 = f"{repo}{version}-{self.slack_ver}-{ar}bit/{md5_file}"
+ ChangeLog_txt = f"{repo}{version}-{self.slack_ver}-{ar}bit/{log_file}"
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, PACKAGES_TXT, repo_name)
From 6803c5aeb154a759f06a383ffa0ab719485a3555 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Wed, 11 May 2022 10:27:16 +0300
Subject: [PATCH 60/65] Fixed stderr error output
Signed-off-by: Dimitris Zlatanidis
---
slpkg/main.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/slpkg/main.py b/slpkg/main.py
index 2867ba57..758faeaf 100644
--- a/slpkg/main.py
+++ b/slpkg/main.py
@@ -689,7 +689,7 @@ class ArgParse(BlackList):
break
if tag and tag not in colors:
print(f"\nslpkg: Error: Available colors {colors}\n")
- raise SystemExit()
+ raise SystemExit(1)
if (len(self.args) == 3 and self.args[0] in options and
self.args[1] in self.meta.repositories and tag in colors):
PkgDesc(self.args[2], self.args[1], tag).view()
From 45fc74ee847c1635722c56b7d3f63f62b7256ad7 Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Wed, 11 May 2022 10:33:25 +0300
Subject: [PATCH 61/65] Fixed PEP E501
Signed-off-by: Dimitris Zlatanidis
---
slpkg/binary/repo_init.py | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/slpkg/binary/repo_init.py b/slpkg/binary/repo_init.py
index 1e15ac0e..241615c8 100644
--- a/slpkg/binary/repo_init.py
+++ b/slpkg/binary/repo_init.py
@@ -102,7 +102,8 @@ class RepoInit(Utils):
if self.meta.arch == "x86_64":
arch = "64"
self.mirror = (f"{self.def_repo_dict['slacke']}"
- f"slacke{self.meta.slacke_sub_repo[1:-1]}/slackware{arch}-{slack_ver()}/")
+ f"slacke{self.meta.slacke_sub_repo[1:-1]}/slackware"
+ f"{arch}-{slack_ver()}/")
def _init_salix(self):
arch = "i486"
@@ -123,7 +124,8 @@ class RepoInit(Utils):
arch = "x86"
if self.meta.arch == "x86_64":
arch = "x86_64"
- self.mirror = f"{self.def_repo_dict['msb']}{slack_ver()}/{self.meta.msb_sub_repo[1:-1]}/{arch}/"
+ self.mirror = (f"{self.def_repo_dict['msb']}{slack_ver()}/"
+ f"{self.meta.msb_sub_repo[1:-1]}/{arch}/")
def _init_csb(self):
arch = "x86"
@@ -135,10 +137,13 @@ class RepoInit(Utils):
arch = ""
if self.meta.arch == "x86_64":
arch = "64"
- self.mirror = f"{self.def_repo_dict['connos']}slack-n-free{arch}-{slack_ver()}/"
+ self.mirror = (f"{self.def_repo_dict['connos']}slack-n-free"
+ f"{arch}-{slack_ver()}/")
def _init_mles(self):
arch = "32"
if self.meta.arch == "x86_64":
arch = "64"
- self.mirror = f"{self.def_repo_dict['mles']}{self.meta.mles_sub_repo[1:-1]}-{slack_ver()}-{arch}bit/"
+ self.mirror = (f"{self.def_repo_dict['mles']}"
+ f"{self.meta.mles_sub_repo[1:-1]}-"
+ f"{slack_ver()}-{arch}bit/")
From 8e0fb1dd2afe09708e70547c00b95d7c33e185ce Mon Sep 17 00:00:00 2001
From: Dimitris Zlatanidis
Date: Wed, 11 May 2022 22:59:47 +0300
Subject: [PATCH 62/65] Updated man pages
Signed-off-by: Dimitris Zlatanidis
---
man/slpkg.8 | 12 ++++++------
man/slpkg.html | 12 ++++++------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/man/slpkg.8 b/man/slpkg.8
index 69a224ed..be37a854 100644
--- a/man/slpkg.8
+++ b/man/slpkg.8
@@ -11,7 +11,7 @@
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
-.TH Slpkg "14" "01" 2019" "slpkg"
+.TH Slpkg "11" "05" 2022" "slpkg"
.SH NAME
Slpkg is a user-friendly package manager for Slackware installations
.SH SYNOPSIS
@@ -34,24 +34,24 @@ Print the version of program and exit.
The following commands are available.
.SS update, create and update packages list
-\fBslpkg\fP \fBupdate\fP, \fB--repositories=[repositories...]\fP
+\fBslpkg\fP \fBupdate\fP, \fB--repos=[repositories...]\fP
.PP
Used to re-synchronize the package lists and create some important files.
This command must run every new repository is added or new updates is available.
.PP
Additional options:
.PP
-\fB--repositories=[repositories...]\fP : Update at specifically repositories separate by comma.
+\fB--repos=[repositories...]\fP : Update at specifically repositories separate by comma.
.SS upgrade, recreate packages list
-\fBslpkg\fP \fBupgrade\fP, \fB--repositories=[repositories...]\fP
+\fBslpkg\fP \fBupgrade\fP, \fB--repos=[repositories...]\fP
.PP
It is sometimes useful to create all of the base file from the beginning so this
command delete all the package lists and recreated.
.PP
Additional options:
.PP
-\fB--repositories=[repositories...]\fP : Update at specifically repositories separate by comma.
+\fB--repos=[repositories...]\fP : Update at specifically repositories separate by comma.
.SS repo-add, add custom repository
\fBslpkg\fP \fBrepo-add\fP <\fIrepository name\fP> <\fIURL\fP>
@@ -404,7 +404,7 @@ Dimitris Zlatanidis
.SH HOMEPAGE
https://dslackw.gitlab.io/slpkg/
.SH COPYRIGHT
-Copyright \(co 2014-2019 Dimitris Zlatanidis
+Copyright \(co 2014-2022 Dimitris Zlatanidis
.SH SEE ALSO
installpkg(8), upgradepkg(8), removepkg(8), pkgtool(8), slackpkg(8), explodepkg(8),
diff --git a/man/slpkg.html b/man/slpkg.html
index 8b76d2fa..57d26c63 100644
--- a/man/slpkg.html
+++ b/man/slpkg.html
@@ -1,5 +1,5 @@
-
+
@@ -93,7 +93,7 @@ commands are available.
update,
create and update packages list
slpkg update,
---repositories=[repositories...]
+--repos=[repositories...]
Used to
re-synchronize the package lists and create some important
@@ -104,13 +104,13 @@ or new updates is available.
options:
-
--repositories=[repositories...]
+
--repos=[repositories...]
: Update at specifically repositories separate by comma.
upgrade,
recreate packages list
slpkg upgrade,
---repositories=[repositories...]
+--repos=[repositories...]
It is sometimes
useful to create all of the base file from the beginning so
@@ -120,7 +120,7 @@ this command delete all the package lists and recreated.
options:
-
--repositories=[repositories...]
+
--repos=[repositories...]
: Update at specifically repositories separate by comma.