From 6255a130305ca3fae49a836afb2ca741b61323b0 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 12 May 2022 20:02:52 +0300 Subject: [PATCH] Updated queues Signed-off-by: Dimitris Zlatanidis --- slpkg/sbo/queue.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/slpkg/sbo/queue.py b/slpkg/sbo/queue.py index b7caf30e..433be96a 100644 --- a/slpkg/sbo/queue.py +++ b/slpkg/sbo/queue.py @@ -82,16 +82,17 @@ class QueuePkgs(Utils): def listed(self): """Print packages from queue """ - print("Packages in the queue:\n") + print("Packages in the queue:") for pkg in self.packages(): print(f"{self.green}{pkg}{self.endc}") + print() def add(self, pkgs): """Add packages in queue if not exist """ queue_list = list(self.packages()) pkgs = list(OrderedDict.fromkeys(pkgs)) - print("Add packages in the queue:\n") + print("Add packages in the queue:") with open(self.queue_list, "a") as queue: for pkg in pkgs: find = sbo_search_pkg(pkg) @@ -100,24 +101,30 @@ class QueuePkgs(Utils): queue.write(pkg + "\n") else: print(f"{self.red}{pkg}{self.endc}") + print() def remove(self, pkgs): """Remove packages from queue """ - print("Remove packages from the queue:\n") + print("Remove packages from the queue:") with open(self.queue_list, "w") as queue: for line in self.queued.splitlines(): if line not in pkgs: queue.write(line + "\n") else: print(f"{self.red}{line}{self.endc}") + print() def build(self): """Build packages from queue """ + sources = [] packages = list(self.packages()) if packages: for pkg in packages: + if pkg not in SBoGrep(pkg).names(): + raise SystemExit(f"\nPackage '{pkg}' was not found in " + f"the SBo repository\n") if not os.path.exists(self.meta.build_path): os.mkdir(self.meta.build_path) if not os.path.exists(self._SOURCES): @@ -125,7 +132,6 @@ class QueuePkgs(Utils): sbo_url = sbo_search_pkg(pkg) sbo_dwn = SBoLink(sbo_url).tar_gz() source_dwn = SBoGrep(pkg).source().split() - sources = [] os.chdir(self.meta.build_path) script = sbo_dwn.split("/")[-1] Download(self.meta.build_path, sbo_dwn.split(),