Fix arguments

This commit is contained in:
Dimitris Zlatanidis 2015-06-13 16:23:17 +03:00
parent 7821261bd0
commit 927df05697
2 changed files with 18 additions and 18 deletions

View file

@ -191,33 +191,32 @@ 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 = "" skip = flag = ""
options = ["-c", "--check"] options = ["-c", "--check"]
flag = ["--upgrade", "--skip=", "--resolve-off"] flags = ["--upgrade", "--skip=", "--resolve-off"]
if flag[2] in self.args: if flags[2] in self.args:
resolve = flag[2] flag = flags[2]
index = self.args.index(flag[2]) index = self.args.index(flags[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
self.args[2] == flag[0] and self.args[2] == flags[0] and
self.args[3].startswith(flag[1])): self.args[3].startswith(flags[1])):
skip = "".join(self.args[3].split("=")[1:]).split(",") skip = "".join(self.args[3].split("=")[1:]).split(",")
self.args.pop(3) self.args.pop(3)
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[2] == flag[0]): self.args[2] == flags[0] and
if (self.args[1] in self.meta.repositories and self.args[1] in self.meta.repositories):
self.args[1] not in ["slack", "sbo"]): if self.args[1] not in ["slack", "sbo"]:
BinaryInstall(pkg_upgrade(self.args[1], skip), BinaryInstall(pkg_upgrade(self.args[1], skip),
self.args[1], resolve).start(if_upgrade=True) self.args[1], flag).start(if_upgrade=True)
elif self.args[1] == "slack": elif self.args[1] == "slack":
if self.meta.only_installed in ["on", "ON"]: if self.meta.only_installed in ["on", "ON"]:
BinaryInstall(pkg_upgrade("slack", skip), BinaryInstall(pkg_upgrade("slack", skip),
"slack", resolve).start(if_upgrade=True) "slack", flag).start(if_upgrade=True)
else: else:
Patches(skip).start() Patches(skip, flag).start()
elif (self.args[1] == "sbo" and elif self.args[1] == "sbo":
self.args[1] in self.meta.repositories): SBoInstall(sbo_upgrade(skip), flag).start(if_upgrade=True)
SBoInstall(sbo_upgrade(skip), resolve).start(if_upgrade=True)
else: else:
usage(self.args[1]) usage(self.args[1])
else: else:

View file

@ -51,8 +51,9 @@ from slack_version import slack_ver
class Patches(object): class Patches(object):
def __init__(self, skip): def __init__(self, skip, flag):
self.skip = skip self.skip = skip
self.flag = flag
self.meta = _meta_ self.meta = _meta_
self.version = self.meta.slack_rel self.version = self.meta.slack_rel
self.patch_path = self.meta.slpkg_tmp_patches self.patch_path = self.meta.slpkg_tmp_patches
@ -133,7 +134,7 @@ class Patches(object):
""" """
Store and return packages for upgrading Store and return packages for upgrading
""" """
data = repo_data(self.PACKAGES_TXT, self.step, "slack", flag="") data = repo_data(self.PACKAGES_TXT, self.step, "slack", self.flag)
black = BlackList().packages() black = BlackList().packages()
for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]): for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]):
repo_pkg_name = split_package(name)[0] repo_pkg_name = split_package(name)[0]