mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-30 20:34:38 +01:00
Update queue for SBo packages
This commit is contained in:
parent
5377261ce7
commit
fc8a022574
2 changed files with 21 additions and 27 deletions
|
@ -32,7 +32,6 @@ from slpkg.messages import Msg
|
||||||
from slpkg.auto_pkg import Auto
|
from slpkg.auto_pkg import Auto
|
||||||
from slpkg.config import Config
|
from slpkg.config import Config
|
||||||
from slpkg.checks import Updates
|
from slpkg.checks import Updates
|
||||||
from slpkg.queue import QueuePkgs
|
|
||||||
from slpkg.repoinfo import RepoInfo
|
from slpkg.repoinfo import RepoInfo
|
||||||
from slpkg.repolist import RepoList
|
from slpkg.repolist import RepoList
|
||||||
from slpkg.repositories import Repo
|
from slpkg.repositories import Repo
|
||||||
|
@ -56,6 +55,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
from slpkg.pkg.manager import PackageManager
|
from slpkg.pkg.manager import PackageManager
|
||||||
|
|
||||||
|
from slpkg.sbo.queue import QueuePkgs
|
||||||
from slpkg.sbo.views import SBoNetwork
|
from slpkg.sbo.views import SBoNetwork
|
||||||
from slpkg.sbo.check import sbo_upgrade
|
from slpkg.sbo.check import sbo_upgrade
|
||||||
from slpkg.sbo.autobuild import AutoBuild
|
from slpkg.sbo.autobuild import AutoBuild
|
||||||
|
|
|
@ -29,18 +29,19 @@ from slpkg.utils import Utils
|
||||||
from slpkg.downloader import Download
|
from slpkg.downloader import Download
|
||||||
from slpkg.__metadata__ import MetaData as _meta_
|
from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
from slpkg.sbo.greps import SBoGrep
|
|
||||||
from slpkg.pkg.find import find_package
|
from slpkg.pkg.find import find_package
|
||||||
from slpkg.pkg.build import BuildPackage
|
from slpkg.pkg.build import BuildPackage
|
||||||
|
from slpkg.pkg.manager import PackageManager
|
||||||
|
|
||||||
|
from slpkg.sbo.greps import SBoGrep
|
||||||
from slpkg.sbo.compressed import SBoLink
|
from slpkg.sbo.compressed import SBoLink
|
||||||
from slpkg.sbo.search import sbo_search_pkg
|
from slpkg.sbo.search import sbo_search_pkg
|
||||||
from slpkg.pkg.manager import PackageManager
|
from slpkg.sbo.build_check import slack_package
|
||||||
|
|
||||||
|
|
||||||
class QueuePkgs(object):
|
class QueuePkgs(object):
|
||||||
"""
|
"""Manage SBo packages, add or remove for building or
|
||||||
Class to list, add or remove packages in queue,
|
installation
|
||||||
also build or install.
|
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
queue_file = [
|
queue_file = [
|
||||||
|
@ -64,8 +65,7 @@ class QueuePkgs(object):
|
||||||
self.queued = Utils().read_file(self.queue_list)
|
self.queued = Utils().read_file(self.queue_list)
|
||||||
|
|
||||||
def packages(self):
|
def packages(self):
|
||||||
"""
|
"""Return queue list from /var/lib/queue/queue_list
|
||||||
Return queue list from /var/lib/queue/queue_list
|
|
||||||
file.
|
file.
|
||||||
"""
|
"""
|
||||||
queue_list = []
|
queue_list = []
|
||||||
|
@ -76,8 +76,7 @@ class QueuePkgs(object):
|
||||||
return queue_list
|
return queue_list
|
||||||
|
|
||||||
def listed(self):
|
def listed(self):
|
||||||
"""
|
"""Print packages from queue
|
||||||
Print packages from queue
|
|
||||||
"""
|
"""
|
||||||
print("\nPackages in queue:\n")
|
print("\nPackages in queue:\n")
|
||||||
for pkg in self.packages():
|
for pkg in self.packages():
|
||||||
|
@ -89,8 +88,7 @@ class QueuePkgs(object):
|
||||||
print("") # new line at exit
|
print("") # new line at exit
|
||||||
|
|
||||||
def add(self, pkgs):
|
def add(self, pkgs):
|
||||||
"""
|
"""Add packages in queue if not exist
|
||||||
Add packages in queue if not exist
|
|
||||||
"""
|
"""
|
||||||
queue_list = self.packages()
|
queue_list = self.packages()
|
||||||
pkgs = list(OrderedDict.fromkeys(pkgs))
|
pkgs = list(OrderedDict.fromkeys(pkgs))
|
||||||
|
@ -112,8 +110,7 @@ class QueuePkgs(object):
|
||||||
print("") # new line at exit
|
print("") # new line at exit
|
||||||
|
|
||||||
def remove(self, pkgs):
|
def remove(self, pkgs):
|
||||||
"""
|
"""Remove packages from queue
|
||||||
Remove packages from queue
|
|
||||||
"""
|
"""
|
||||||
print("\nRemove packages from queue:\n")
|
print("\nRemove packages from queue:\n")
|
||||||
with open(self.queue_list, "w") as queue:
|
with open(self.queue_list, "w") as queue:
|
||||||
|
@ -129,8 +126,7 @@ class QueuePkgs(object):
|
||||||
print("") # new line at exit
|
print("") # new line at exit
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
"""
|
"""Build packages from queue
|
||||||
Build packages from queue
|
|
||||||
"""
|
"""
|
||||||
packages = self.packages()
|
packages = self.packages()
|
||||||
if packages:
|
if packages:
|
||||||
|
@ -154,21 +150,19 @@ class QueuePkgs(object):
|
||||||
print("\nPackages not found in the queue for building\n")
|
print("\nPackages not found in the queue for building\n")
|
||||||
|
|
||||||
def install(self):
|
def install(self):
|
||||||
"""
|
"""Install packages from queue
|
||||||
Install packages from queue
|
|
||||||
"""
|
"""
|
||||||
packages = self.packages()
|
packages = self.packages()
|
||||||
if packages:
|
if packages:
|
||||||
print("") # new line at start
|
print("") # new line at start
|
||||||
for pkg in packages:
|
for pkg in packages:
|
||||||
# check if package exist in /tmp
|
ver = SBoGrep(pkg).version()
|
||||||
find = find_package(pkg + self.meta.sp, self.meta.output)
|
prgnam = "{0}-{1}".format(pkg, ver)
|
||||||
try:
|
if find_package(prgnam + self.meta.sp, self.meta.output):
|
||||||
find = max(find)
|
binary = slack_package(prgnam)
|
||||||
except ValueError:
|
PackageManager(binary).upgrade(flag="--install-new")
|
||||||
print("Package '{0}' not found in /tmp\n".format(pkg))
|
else:
|
||||||
if pkg in find:
|
print("\nPackage {0} not found in the {1} for "
|
||||||
binary = "{0}{1}".format(self.meta.output, find)
|
"installation\n".format(prgnam, self.meta.output))
|
||||||
PackageManager(binary.split()).upgrade(flag="--install-new")
|
|
||||||
else:
|
else:
|
||||||
print("\nPackages not found in the queue for installation\n")
|
print("\nPackages not found in the queue for installation\n")
|
Loading…
Add table
Reference in a new issue