mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-16 03:41:11 +01:00
Fix arguments
This commit is contained in:
parent
2e2a23ba66
commit
4af641b7f5
7 changed files with 49 additions and 48 deletions
|
@ -80,7 +80,7 @@ Optional arguments:
|
||||||
only packages installed on the
|
only packages installed on the
|
||||||
system.
|
system.
|
||||||
-c, --check, [repository] --upgrade, Check, view and install updated
|
-c, --check, [repository] --upgrade, Check, view and install updated
|
||||||
--skip=[] --resolve-off packages from repositories.
|
--skip=[] --resolve--off packages from repositories.
|
||||||
-s, --sync, [repository] [package...], Sync packages. Install packages
|
-s, --sync, [repository] [package...], Sync packages. Install packages
|
||||||
--resolve-off directly from remote repositories
|
--resolve-off directly from remote repositories
|
||||||
with all dependencies.
|
with all dependencies.
|
||||||
|
|
|
@ -44,7 +44,7 @@ class Dependencies(object):
|
||||||
"""
|
"""
|
||||||
Build all dependencies of a package
|
Build all dependencies of a package
|
||||||
"""
|
"""
|
||||||
if self.meta.rsl_deps in ["on", "ON"] and resolve:
|
if self.meta.rsl_deps in ["on", "ON"] and resolve != "--resolve-off":
|
||||||
try:
|
try:
|
||||||
sys.setrecursionlimit(10000)
|
sys.setrecursionlimit(10000)
|
||||||
dependencies = []
|
dependencies = []
|
||||||
|
|
|
@ -40,7 +40,7 @@ def repo_data(PACKAGES_TXT, step, repo, resolve):
|
||||||
rname, rlocation, rsize, runsize) = ([] for i in range(8))
|
rname, rlocation, rsize, runsize) = ([] for i in range(8))
|
||||||
index, toolbar_width = 0, 100
|
index, toolbar_width = 0, 100
|
||||||
for line in PACKAGES_TXT.splitlines():
|
for line in PACKAGES_TXT.splitlines():
|
||||||
if _meta_.rsl_deps in ["on", "ON"] and resolve:
|
if _meta_.rsl_deps in ["on", "ON"] and resolve != "--resolve-off":
|
||||||
index += 1
|
index += 1
|
||||||
toolbar_width = status(index, toolbar_width, step)
|
toolbar_width = status(index, toolbar_width, step)
|
||||||
if line.startswith("PACKAGE NAME:"):
|
if line.startswith("PACKAGE NAME:"):
|
||||||
|
|
|
@ -85,7 +85,8 @@ class BinaryInstall(object):
|
||||||
self.packages = self.clear_masters()
|
self.packages = self.clear_masters()
|
||||||
(self.dwn, self.install, self.comp_sum,
|
(self.dwn, self.install, self.comp_sum,
|
||||||
self.uncomp_sum) = self.store(self.packages)
|
self.uncomp_sum) = self.store(self.packages)
|
||||||
if self.meta.rsl_deps in ["on", "ON"] and self.resolve:
|
if (self.meta.rsl_deps in ["on", "ON"] and
|
||||||
|
self.resolve != "--resolve-off"):
|
||||||
Msg().done()
|
Msg().done()
|
||||||
if self.install:
|
if self.install:
|
||||||
print("\nThe following packages will be automatically "
|
print("\nThe following packages will be automatically "
|
||||||
|
@ -206,7 +207,8 @@ class BinaryInstall(object):
|
||||||
Return package dependencies
|
Return package dependencies
|
||||||
"""
|
"""
|
||||||
requires = []
|
requires = []
|
||||||
if self.meta.rsl_deps in ["on", "ON"] and self.resolve:
|
if (self.meta.rsl_deps in ["on", "ON"] and
|
||||||
|
self.resolve != "--resolve-off"):
|
||||||
Msg().resolving()
|
Msg().resolving()
|
||||||
for dep in self.packages:
|
for dep in self.packages:
|
||||||
dependencies = []
|
dependencies = []
|
||||||
|
|
|
@ -181,11 +181,11 @@ class ArgParse(object):
|
||||||
def pkg_upgrade(self):
|
def pkg_upgrade(self):
|
||||||
"""Check and upgrade packages by repository
|
"""Check and upgrade packages by repository
|
||||||
"""
|
"""
|
||||||
skip, resolve = "", True
|
skip = resolve = ""
|
||||||
options = ["-c", "--check"]
|
options = ["-c", "--check"]
|
||||||
flag = ["--upgrade", "--skip=", "--resolve-off"]
|
flag = ["--upgrade", "--skip=", "--resolve-off"]
|
||||||
if flag[2] in self.args:
|
if flag[2] in self.args:
|
||||||
resolve = False
|
resolve = flag[2]
|
||||||
index = self.args.index(flag[2])
|
index = self.args.index(flag[2])
|
||||||
del self.args[index]
|
del self.args[index]
|
||||||
if (len(self.args) == 4 and self.args[0] in options and
|
if (len(self.args) == 4 and self.args[0] in options and
|
||||||
|
@ -216,20 +216,19 @@ class ArgParse(object):
|
||||||
def pkg_install(self):
|
def pkg_install(self):
|
||||||
"""Install packages by repository
|
"""Install packages by repository
|
||||||
"""
|
"""
|
||||||
packages = self.args[2:]
|
|
||||||
options = ["-s", "--sync"]
|
options = ["-s", "--sync"]
|
||||||
flag = ["--resolve-off"]
|
flag = ""
|
||||||
resolve = True
|
flags = ["--resolve-off"]
|
||||||
if self.args[-1] == flag[0]:
|
if self.args[-1] in flags:
|
||||||
resolve = False
|
flag = self.args[-1]
|
||||||
if len(self.args) >= 3 and self.args[0] in options:
|
if len(self.args) >= 3 and self.args[0] in options:
|
||||||
if (self.args[1] in self.meta.repositories and
|
if (self.args[1] in self.meta.repositories and
|
||||||
self.args[1] not in ["sbo"]):
|
self.args[1] not in ["sbo"]):
|
||||||
BinaryInstall(packages, self.args[1], resolve).start(
|
BinaryInstall(self.args[2:], self.args[1], flag).start(
|
||||||
if_upgrade=False)
|
if_upgrade=False)
|
||||||
elif (self.args[1] == "sbo" and
|
elif (self.args[1] == "sbo" and
|
||||||
self.args[1] in self.meta.repositories):
|
self.args[1] in self.meta.repositories):
|
||||||
SBoInstall(packages, resolve).start(if_upgrade=False)
|
SBoInstall(self.args[2:], flag).start(if_upgrade=False)
|
||||||
else:
|
else:
|
||||||
usage(self.args[1])
|
usage(self.args[1])
|
||||||
else:
|
else:
|
||||||
|
@ -238,11 +237,10 @@ class ArgParse(object):
|
||||||
def pkg_tracking(self):
|
def pkg_tracking(self):
|
||||||
"""Tracking package dependencies
|
"""Tracking package dependencies
|
||||||
"""
|
"""
|
||||||
packages = self.args[2]
|
|
||||||
options = ["-t", "--tracking"]
|
options = ["-t", "--tracking"]
|
||||||
if (len(self.args) == 3 and self.args[0] in options and
|
if (len(self.args) == 3 and self.args[0] in options and
|
||||||
self.args[1] in self.meta.repositories):
|
self.args[1] in self.meta.repositories):
|
||||||
track_dep(packages, self.args[1])
|
track_dep(self.args[2], self.args[1])
|
||||||
elif (len(self.args) > 1 and self.args[0] in options and
|
elif (len(self.args) > 1 and self.args[0] in options and
|
||||||
self.args[1] not in self.meta.repositories):
|
self.args[1] not in self.meta.repositories):
|
||||||
usage(self.args[1])
|
usage(self.args[1])
|
||||||
|
@ -252,18 +250,19 @@ class ArgParse(object):
|
||||||
def sbo_network(self):
|
def sbo_network(self):
|
||||||
"""View slackbuilds packages
|
"""View slackbuilds packages
|
||||||
"""
|
"""
|
||||||
packages = self.args[1]
|
|
||||||
options = ["-n", "--network"]
|
options = ["-n", "--network"]
|
||||||
if (len(self.args) == 2 and self.args[0] in options and
|
if (len(self.args) == 3 and self.args[0] in options and
|
||||||
"sbo" in self.meta.repositories):
|
"sbo" in self.meta.repositories):
|
||||||
SBoNetwork(packages).view()
|
SBoNetwork(self.args[1]).view()
|
||||||
|
elif (len(self.args) == 2 and self.args[0] in options and
|
||||||
|
"sbo" in self.meta.repositories):
|
||||||
|
SBoNetwork(self.args[1]).view()
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
|
||||||
def pkg_blacklist(self):
|
def pkg_blacklist(self):
|
||||||
"""Manage blacklist packages
|
"""Manage blacklist packages
|
||||||
"""
|
"""
|
||||||
packages = self.args[1:]
|
|
||||||
blacklist = BlackList()
|
blacklist = BlackList()
|
||||||
options = ["-b", "--blacklist"]
|
options = ["-b", "--blacklist"]
|
||||||
flag = ["--add", "--remove"]
|
flag = ["--add", "--remove"]
|
||||||
|
@ -273,27 +272,26 @@ class ArgParse(object):
|
||||||
blacklist.listed()
|
blacklist.listed()
|
||||||
elif (len(self.args) > 2 and self.args[0] in options and
|
elif (len(self.args) > 2 and self.args[0] in options and
|
||||||
self.args[-1] == flag[0]):
|
self.args[-1] == flag[0]):
|
||||||
blacklist.add(packages)
|
blacklist.add(self.args[1:])
|
||||||
elif (len(self.args) > 2 and self.args[0] in options and
|
elif (len(self.args) > 2 and self.args[0] in options and
|
||||||
self.args[-1] == flag[1]):
|
self.args[-1] == flag[1]):
|
||||||
blacklist.remove(packages)
|
blacklist.remove(self.args[1:])
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
|
||||||
def pkg_queue(self):
|
def pkg_queue(self):
|
||||||
"""Manage packages in queue
|
"""Manage packages in queue
|
||||||
"""
|
"""
|
||||||
packages = self.args[1:]
|
|
||||||
queue = QueuePkgs()
|
queue = QueuePkgs()
|
||||||
options = ["-q", "--queue"]
|
options = ["-q", "--queue"]
|
||||||
flag = ["--add", "--remove"]
|
flag = ["--add", "--remove"]
|
||||||
command = ["list", "build", "install", "build-install"]
|
command = ["list", "build", "install", "build-install"]
|
||||||
if (len(self.args) > 2 and self.args[0] in options and
|
if (len(self.args) > 2 and self.args[0] in options and
|
||||||
self.args[-1] == flag[0]):
|
self.args[-1] == flag[0]):
|
||||||
queue.add(packages)
|
queue.add(self.args[1:])
|
||||||
elif (len(self.args) > 2 and self.args[0] in options and
|
elif (len(self.args) > 2 and self.args[0] in options and
|
||||||
self.args[-1] == flag[1]):
|
self.args[-1] == flag[1]):
|
||||||
queue.remove(packages)
|
queue.remove(self.args[1:])
|
||||||
elif (len(self.args) == 2 and self.args[0] in options and
|
elif (len(self.args) == 2 and self.args[0] in options and
|
||||||
self.args[1] == command[0]):
|
self.args[1] == command[0]):
|
||||||
queue.listed()
|
queue.listed()
|
||||||
|
@ -327,10 +325,10 @@ class ArgParse(object):
|
||||||
"--priority",
|
"--priority",
|
||||||
"--tagfile"
|
"--tagfile"
|
||||||
]
|
]
|
||||||
|
if len(self.args) > 1 and self.args[0] in options:
|
||||||
if self.args[1] in flags:
|
if self.args[1] in flags:
|
||||||
flag = self.args[1]
|
flag = self.args[1]
|
||||||
packages = self.args[2:]
|
packages = self.args[2:]
|
||||||
if len(self.args) > 1 and self.args[0] in options:
|
|
||||||
PackageManager(packages).install(flag)
|
PackageManager(packages).install(flag)
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
@ -347,10 +345,10 @@ class ArgParse(object):
|
||||||
"--reinstall",
|
"--reinstall",
|
||||||
"--verbose"
|
"--verbose"
|
||||||
]
|
]
|
||||||
|
if len(self.args) > 1 and self.args[0] in options:
|
||||||
if self.args[1] in flags:
|
if self.args[1] in flags:
|
||||||
flag = self.args[1]
|
flag = self.args[1]
|
||||||
packages = self.args[2:]
|
packages = self.args[2:]
|
||||||
if len(self.args) > 1 and self.args[0] in options:
|
|
||||||
PackageManager(packages).upgrade(flag)
|
PackageManager(packages).upgrade(flag)
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
@ -368,13 +366,13 @@ class ArgParse(object):
|
||||||
"-copy",
|
"-copy",
|
||||||
"-keep"
|
"-keep"
|
||||||
]
|
]
|
||||||
|
if len(self.args) > 1 and self.args[0] in options:
|
||||||
if self.args[-1] == additional_options[0]:
|
if self.args[-1] == additional_options[0]:
|
||||||
extra = additional_options[0]
|
extra = additional_options[0]
|
||||||
packages = self.args[1:-1]
|
packages = self.args[1:-1]
|
||||||
if self.args[1] in flags:
|
if self.args[1] in flags:
|
||||||
flag = self.args[1]
|
flag = self.args[1]
|
||||||
packages = self.args[2:]
|
packages = self.args[2:]
|
||||||
if len(self.args) > 1 and self.args[0] in options:
|
|
||||||
PackageManager(packages).remove(flag, extra)
|
PackageManager(packages).remove(flag, extra)
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
@ -392,18 +390,17 @@ class ArgParse(object):
|
||||||
def pkg_desc(self):
|
def pkg_desc(self):
|
||||||
"""Print slack-desc by repository
|
"""Print slack-desc by repository
|
||||||
"""
|
"""
|
||||||
packages = self.args[2]
|
|
||||||
options = ["-p", "--print"]
|
options = ["-p", "--print"]
|
||||||
flag = ["--color="]
|
flag = ["--color="]
|
||||||
colors = ["red", "green", "yellow", "cyan", "grey"]
|
colors = ["red", "green", "yellow", "cyan", "grey"]
|
||||||
if (len(self.args) == 3 and self.args[0] in options and
|
if (len(self.args) == 3 and self.args[0] in options and
|
||||||
self.args[1] in self.meta.repositories):
|
self.args[1] in self.meta.repositories):
|
||||||
PkgDesc(packages, self.args[1], "").view()
|
PkgDesc(self.args[2], self.args[1], "").view()
|
||||||
elif (len(self.args) == 4 and self.args[0] in options and
|
elif (len(self.args) == 4 and self.args[0] in options and
|
||||||
self.args[3].startswith(flag[0])):
|
self.args[3].startswith(flag[0])):
|
||||||
tag = self.args[3][len(flag[0]):]
|
tag = self.args[3][len(flag[0]):]
|
||||||
if self.args[1] in self.meta.repositories and tag in colors:
|
if self.args[1] in self.meta.repositories and tag in colors:
|
||||||
PkgDesc(packages, self.args[1], tag).view()
|
PkgDesc(self.args[2], self.args[1], tag).view()
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
elif (len(self.args) > 1 and self.args[0] in options and
|
elif (len(self.args) > 1 and self.args[0] in options and
|
||||||
|
|
|
@ -33,8 +33,8 @@ from greps import SBoGrep
|
||||||
|
|
||||||
class Requires(object):
|
class Requires(object):
|
||||||
|
|
||||||
def __init__(self, resolve):
|
def __init__(self, flag):
|
||||||
self.resolve = resolve
|
self.flag = flag
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
self.dep_results = []
|
self.dep_results = []
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class Requires(object):
|
||||||
"""
|
"""
|
||||||
Build all dependencies of a package
|
Build all dependencies of a package
|
||||||
"""
|
"""
|
||||||
if self.meta.rsl_deps in ["on", "ON"] and self.resolve:
|
if self.meta.rsl_deps in ["on", "ON"] and self.flag != "--resolve-off":
|
||||||
try:
|
try:
|
||||||
sys.setrecursionlimit(10000)
|
sys.setrecursionlimit(10000)
|
||||||
dependencies = []
|
dependencies = []
|
||||||
|
|
|
@ -48,9 +48,9 @@ from search import sbo_search_pkg
|
||||||
|
|
||||||
class SBoInstall(object):
|
class SBoInstall(object):
|
||||||
|
|
||||||
def __init__(self, slackbuilds, resolve):
|
def __init__(self, slackbuilds, flag):
|
||||||
self.slackbuilds = slackbuilds
|
self.slackbuilds = slackbuilds
|
||||||
self.resolve = resolve
|
self.flag = flag
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
self.build_folder = self.meta.build_path
|
self.build_folder = self.meta.build_path
|
||||||
self.unst = ["UNSUPPORTED", "UNTESTED"]
|
self.unst = ["UNSUPPORTED", "UNTESTED"]
|
||||||
|
@ -74,7 +74,7 @@ class SBoInstall(object):
|
||||||
self.index += 1
|
self.index += 1
|
||||||
self.toolbar_width = status(self.index, self.toolbar_width, 4)
|
self.toolbar_width = status(self.index, self.toolbar_width, 4)
|
||||||
if sbo_search_pkg(_sbo):
|
if sbo_search_pkg(_sbo):
|
||||||
sbo_deps = Requires(self.resolve).sbo(_sbo)
|
sbo_deps = Requires(self.flag).sbo(_sbo)
|
||||||
self.deps += sbo_deps
|
self.deps += sbo_deps
|
||||||
self.deps_dict[_sbo] = self.one_for_all(sbo_deps)
|
self.deps_dict[_sbo] = self.one_for_all(sbo_deps)
|
||||||
self.package_found.append(_sbo)
|
self.package_found.append(_sbo)
|
||||||
|
@ -86,11 +86,13 @@ class SBoInstall(object):
|
||||||
self.master_packages, mas_src = self.sbo_version_source(
|
self.master_packages, mas_src = self.sbo_version_source(
|
||||||
self.package_found)
|
self.package_found)
|
||||||
Msg().done()
|
Msg().done()
|
||||||
if self.meta.rsl_deps in ["on", "ON"] and self.resolve:
|
if (self.meta.rsl_deps in ["on", "ON"] and
|
||||||
|
self.flag != "--resolve-off"):
|
||||||
Msg().resolving()
|
Msg().resolving()
|
||||||
self.dependencies, dep_src = self.sbo_version_source(
|
self.dependencies, dep_src = self.sbo_version_source(
|
||||||
self.one_for_all(self.deps))
|
self.one_for_all(self.deps))
|
||||||
if self.meta.rsl_deps in ["on", "ON"] and self.resolve:
|
if (self.meta.rsl_deps in ["on", "ON"] and
|
||||||
|
self.flag != "--resolve-off"):
|
||||||
Msg().done()
|
Msg().done()
|
||||||
self.clear_masters()
|
self.clear_masters()
|
||||||
if self.package_found:
|
if self.package_found:
|
||||||
|
|
Loading…
Reference in a new issue