update commits

This commit is contained in:
Dimitris Zlatanidis 2014-09-06 08:38:11 +03:00
parent eec329d923
commit cc4eacef15

View file

@ -47,15 +47,18 @@ def sbo_check():
repository. repository.
NOTE: This functions check packages by version not by build NOTE: This functions check packages by version not by build
tag because build tag not reported the SLACKBUILDS.TXT file. tag because build tag not reported the SLACKBUILDS.TXT file.
But install the package with maximum build tag if find the
some version in /tmp directory.
''' '''
try: try:
sys.stdout.write("Reading package lists ...") sys.stdout.write("Reading package lists ...")
sys.stdout.flush() sys.stdout.flush()
initialization() initialization()
index, toolbar_width = 0, 3 index, toolbar_width = 0, 3
GREEN, RED, ENDC = colors.GREEN, colors.RED, colors.ENDC dependencies, dependencies_list = [], []
sbo_list, dependencies_list, requires, upgrade = [], [], [], [] requires, upgrade, sbo_list = [], [], []
upg_name, pkg_for_upg, upg_ver, upg_arch = [], [], [], [] upg_name, pkg_for_upg, upg_ver, upg_arch = [], [], [], []
GREEN, RED, ENDC = colors.GREEN, colors.RED, colors.ENDC
for pkg in os.listdir(pkg_path): for pkg in os.listdir(pkg_path):
if pkg.endswith("_SBo"): if pkg.endswith("_SBo"):
sbo_list.append(pkg) sbo_list.append(pkg)
@ -85,67 +88,74 @@ def sbo_check():
if find_package(sbo_package, pkg_path) == []: if find_package(sbo_package, pkg_path) == []:
upg_name.append(name) upg_name.append(name)
sys.stdout.write("Done\n") sys.stdout.write("Done\n")
sys.stdout.write("Resolving dependencies ...") if upg_name:
sys.stdout.flush() sys.stdout.write("Resolving dependencies ...")
''' sys.stdout.flush()
Create list with all dependencies '''
''' Of the packages found to need upgrading,
for upg in upg_name: stored in a series such as reading from the
dependencies = sbo_dependencies_pkg(upg) file .info.
''' '''
Create one dimensional list with for upg in upg_name:
all dependencies dependencies = sbo_dependencies_pkg(upg)
''' '''
for dep in dependencies: Because there are dependencies that depend on other
requires += dep dependencies are created lists into other lists.
requires.reverse() Thus creating this loop create one-dimensional list.
''' '''
Remove double dependencies for dep in dependencies:
''' requires += dep
for duplicate in requires: requires.reverse() # Inverting the list brings the
if duplicate not in dependencies_list: # dependencies in order to be installed.
dependencies_list.append(duplicate) '''
''' Because many packages use the same dependencies, in this loop
Add master packages to end of list creates a new list by removing duplicate dependencies but
for install after dependencies. without spoiling the line must be installed.
''' '''
for upg in upg_name: for duplicate in requires:
if upg not in dependencies_list: if duplicate not in dependencies_list:
dependencies_list.append(upg) dependencies_list.append(duplicate)
''' '''
Add packages is not installed to a final list. Last and after the list is created with the correct number
''' of dependencies that must be installed, and add the particular
for pkg in dependencies_list: packages that need to be upgraded if they are not already on
if "-x86_64-" in pkg: the list.
arch = "x86_64" '''
elif "-i486-" in pkg: for upg in upg_name:
arch = "i486" if upg not in dependencies_list:
elif "-arm-" in pkg: dependencies_list.append(upg)
arch = "arm" '''
elif "-noarch-" in pkg: In the end lest a check of the packages that are on the list
arch = "noarch" are already installed.
else: '''
arch = os.uname()[4] for pkg in dependencies_list:
ver = sbo_version_pkg(pkg) ver = sbo_version_pkg(pkg)
prgnam = ("{0}-{1}".format(pkg, ver)) prgnam = ("{0}-{1}".format(pkg, ver))
pkg_version = ver # if package not installed pkg_version = ver # if package not installed
# take version from repository # take version from repository
if find_package(prgnam, pkg_path) == []: if find_package(prgnam, pkg_path) == []:
for sbo in os.listdir(pkg_path): for sbo in os.listdir(pkg_path):
if sbo.startswith(pkg + "-") and sbo.endswith("_SBo"): if sbo.startswith(pkg + "-") and sbo.endswith("_SBo"):
# search if packages installed # search if packages installed
# if yes grab package name and version # if yes grab package name,
name = sbo[:-(len(arch) + len("_SBo") + 3)] # version and arch
pkg_version = get_file(name, "-")[1:] if "-x86_64-" in sbo:
upgrade.append(pkg) arch = "x86_64"
pkg_for_upg.append("{0}-{1}".format(pkg, pkg_version)) elif "-i486-" in sbo:
upg_ver.append(ver) arch = "i486"
upg_arch.append(arch) elif "-arm-" in sbo:
sys.stdout.write("Done\n") arch = "arm"
''' elif "-noarch-" in sbo:
Create a list to display only the dependencies arch = "noarch"
that need to be upgraded or installed. else:
''' arch = os.uname()[4]
name = sbo[:-(len(arch) + len("_SBo") + 3)]
pkg_version = get_file(name, "-")[1:]
upgrade.append(pkg)
pkg_for_upg.append("{0}-{1}".format(pkg, pkg_version))
upg_ver.append(ver)
upg_arch.append(arch)
sys.stdout.write("Done\n")
if pkg_for_upg: if pkg_for_upg:
print("\nThese packages need upgrading:\n") print("\nThese packages need upgrading:\n")
template(78) template(78)
@ -192,9 +202,9 @@ def sbo_check():
binary = (tmp + max(binary_list)).split() binary = (tmp + max(binary_list)).split()
pkg_upgrade(binary) pkg_upgrade(binary)
print("Complete!\n") print("Complete!\n")
if len(pkg_for_upgrade) > 1: if len(pkg_for_upg) > 1:
template(78) template(78)
print("| Total {0} {1} upgraded".format(len(pkg_for_upgrade), msg_pkg)) print("| Total {0} {1} upgraded".format(len(pkg_for_upg), msg_pkg))
template(78) template(78)
for pkg, upg, ver in zip(pkg_for_upg, upgrade, upg_ver): for pkg, upg, ver in zip(pkg_for_upg, upgrade, upg_ver):
upgraded = ("{0}-{1}".format(upg, ver)) upgraded = ("{0}-{1}".format(upg, ver))