Updated queues

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2022-05-12 20:02:52 +03:00
parent ba8193b90a
commit 6255a13030

View file

@ -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(),