update source code

This commit is contained in:
Dimitris Zlatanidis 2015-02-04 01:35:48 +02:00
parent 3dcf34afdf
commit cb194c08e5
9 changed files with 48 additions and 26 deletions

View file

@ -47,7 +47,7 @@ def pkg_upgrade(repo):
# location = data[1]
# size = data[2]
# unsize = data[3]
data = repo_data(PACKAGES_TXT, 2000, repo, slack_ver)
data = repo_data(PACKAGES_TXT, 2000, repo)
index, toolbar_width = 0, 1000
for pkg in installed():
index += 1

View file

@ -31,7 +31,7 @@ from slpkg.__metadata__ import MetaData as _m
from slpkg.slack.slack_version import slack_ver
def repo_data(PACKAGES_TXT, step, repo, version):
def repo_data(PACKAGES_TXT, step, repo):
'''
Grap data packages
'''
@ -63,19 +63,19 @@ def repo_data(PACKAGES_TXT, step, repo, version):
rlocation,
rsize,
runsize
) = alien_filter(name, location, size, unsize, version)
) = alien_filter(name, location, size, unsize)
elif repo == "ktown":
(rname,
rlocation,
rsize,
runsize
) = ktown_filter(name, location, size, unsize, version)
) = ktown_filter(name, location, size, unsize)
elif repo == "multi":
(rname,
rlocation,
rsize,
runsize
) = multi_filter(name, location, size, unsize, version)
) = multi_filter(name, location, size, unsize)
else:
rname, rlocation, rsize, runsize = name, location, size, unsize
return [rname, rlocation, rsize, runsize]
@ -99,12 +99,12 @@ def rlw_filter(name, location, size, unsize):
return [fname, flocation, fsize, funsize]
def alien_filter(name, location, size, unsize, version):
def alien_filter(name, location, size, unsize):
'''
Filter Alien's repository data
'''
ver = slack_ver()
if version == "current":
if _m.slack_rel == "current":
ver = "current"
path_pkg = "pkg"
if os.uname()[4] == "x86_64":
@ -119,12 +119,12 @@ def alien_filter(name, location, size, unsize, version):
return [fname, flocation, fsize, funsize]
def ktown_filter(name, location, size, unsize, version):
def ktown_filter(name, location, size, unsize):
'''
Filter Alien's ktown repository data
'''
ver = slack_ver()
if version == "current":
if _m.slack_rel == "current":
ver = "current"
path_pkg = "x86"
if os.uname()[4] == "x86_64":
@ -139,12 +139,12 @@ def ktown_filter(name, location, size, unsize, version):
return [fname, flocation, fsize, funsize]
def multi_filter(name, location, size, unsize, version):
def multi_filter(name, location, size, unsize):
'''
Filter Alien's multilib repository data
'''
ver = slack_ver()
if version == "current":
if _m.slack_rel == "current":
ver = "current"
(fname, flocation, fsize, funsize) = ([] for i in range(4))
for n, l, s, u in zip(name, location, size, unsize):

View file

@ -49,10 +49,10 @@ from dependency import Dependencies
class BinaryInstall(object):
def __init__(self, packages, repo, version):
def __init__(self, packages, repo):
self.packages = packages
self.repo = repo
self.version = version
self.version = _m.slack_rel
self.tmp_path = _m.slpkg_tmp_packages
self.dwn, self.dep_dwn = [], []
self.install, self.dep_install = [], []
@ -114,7 +114,7 @@ class BinaryInstall(object):
print("After this process, {0} {1} of additional disk "
"space will be used.{2}".format(size[1], unit[1],
_m.color['ENDC']))
print('')
print("")
if Msg().answer() in ['y', 'Y']:
self.install.reverse()
Download(self.tmp_path, (self.dep_dwn + self.dwn)).start()
@ -237,7 +237,7 @@ class BinaryInstall(object):
self.pkg_ver = [''] * len(install)
for pkg, ver, comp in zip(install, self.pkg_ver, comp_sum):
pkg_split = split_package(pkg[:-4])
if find_package(pkg_split[0] + "-" + pkg_split[1], _m.pkg_path):
if find_package(pkg[:-4], _m.pkg_path):
pkg_sum += 1
COLOR = _m.color['GREEN']
elif find_package(pkg_split[0] + "-", _m.pkg_path):
@ -276,7 +276,7 @@ class BinaryInstall(object):
# location = data[1]
# size = data[2]
# unsize = data[3]
data = repo_data(self.PACKAGES_TXT, self.step, self.repo, self.version)
data = repo_data(self.PACKAGES_TXT, self.step, self.repo)
for pkg in packages:
for name, loc, comp, uncomp in zip(data[0], data[1], data[2],
data[3]):

View file

@ -59,22 +59,21 @@ class Case(object):
def __init__(self, package):
self.package = package
self.release = _m.slack_rel
def sbo_install(self):
SBoInstall(self.package).start(False)
def binary_install(self, repo):
BinaryInstall(self.package, repo, self.release).start(False)
BinaryInstall(self.package, repo).start(False)
def sbo_upgrade(self):
SBoInstall(sbo_upgrade()).start(True)
def slack_upgrade(self):
Patches(self.release).start()
Patches().start()
def binary_upgrade(self, repo):
BinaryInstall(pkg_upgrade(repo), repo, self.release).start(True)
BinaryInstall(pkg_upgrade(repo), repo).start(True)
def main():

View file

@ -79,21 +79,33 @@ class Msg(object):
print("+" + "=" * max_len)
def checking(self):
'''
Message checking
'''
sys.stdout.write("{0}Checking ...{1}".format(_m.color['GREY'],
_m.color['ENDC']))
sys.stdout.flush()
def reading(self):
'''
Message reading
'''
sys.stdout.write("{0}Reading package lists ...{1}".format(
_m.color['GREY'], _m.color['ENDC']))
sys.stdout.flush()
def resolving(self):
'''
Message resolving
'''
sys.stdout.write("{0}Resolving dependencies ...{1}".format(
_m.color['GREY'], _m.color['ENDC']))
sys.stdout.flush()
def done(self):
'''
Message done
'''
sys.stdout.write("{0}Done{1}\n".format(_m.color['GREY'],
_m.color['ENDC']))
@ -107,18 +119,27 @@ class Msg(object):
return message
def not_found(self, if_upgrade):
'''
Message not found packages
'''
if if_upgrade:
print('\nNot found packages for upgrade\n')
else:
print('\nNot found packages for installation\n')
def upg_inst(self, if_upgrade):
'''
Message installing or upgrading
'''
if not if_upgrade:
print("Installing:")
else:
print("Upgrading:")
def answer(self):
'''
Message answer
'''
if _m.default_answer == "y":
answer = _m.default_answer
else:

View file

@ -76,7 +76,7 @@ class BuildPackage(object):
# change permissions
subprocess.call("chmod +x {0}.SlackBuild".format(self.prgnam),
shell=True)
pass_var = self.pass_variable()
pass_var = self._pass_variable()
if _m.sbo_build_log == "on":
if os.path.isfile(self.build_logs + self.log_file):
os.remove(self.build_logs + self.log_file)
@ -102,7 +102,7 @@ class BuildPackage(object):
print("") # new line at exit
sys.exit(0)
def pass_variable(self):
def _pass_variable(self):
'''
Grep slpkg bash variable
'''

View file

@ -78,8 +78,7 @@ class PackageManager(object):
except subprocess.CalledProcessError:
self.not_found("Can't reinstall", self.binary, pkg)
@staticmethod
def not_found(message, binary, pkg):
def _not_found(self, message, binary, pkg):
if len(binary) > 1:
bol = eol = ""
else:

View file

@ -30,6 +30,9 @@ from __metadata__ import MetaData as _m
class RepoList(object):
'''
List of repositories
'''
def __init__(self):
self.all_repos = {

View file

@ -48,8 +48,8 @@ from slack_version import slack_ver
class Patches(object):
def __init__(self, version):
self.version = version
def __init__(self):
self.version = _m.slack_rel
self.patch_path = _m.slpkg_tmp_patches
Msg().reading()
if self.version == "stable":