updated source code

This commit is contained in:
Dimitris Zlatanidis 2014-09-02 18:21:04 +03:00
parent b251c5b275
commit f724318c25
7 changed files with 31 additions and 26 deletions

View file

@ -42,7 +42,9 @@ from greps import sbo_source_dwn, sbo_version_pkg
def sbo_check():
'''
Upgrade all slackbuilds packages from slackbuilds.org
repository
repository.
NOTE: This functions check packages by version not by build
tag because build tag not reported the SLACKBUILDS.TXT file.
'''
try:
sys.stdout.write("Reading package lists ...")
@ -85,11 +87,11 @@ def sbo_check():
if pkg_for_upg:
print("\nThese packages need upgrading:\n")
template(78)
print "| Package", " "*27, "New version", " "*5, "Arch", " "*7, "Repository"
print "| Package", " " * 27, "New version", " " * 5, "Arch", " " * 7, "Repository"
template(78)
print("Upgrading:")
for upg, ver, arch in zip(pkg_for_upg, upg_ver, upg_arch):
print " ", RED + upg + ENDC, " " * (34-len(upg)), GREEN + ver + ENDC, \
print " " , RED + upg + ENDC, " " * (34-len(upg)), GREEN + ver + ENDC, \
" " * (16-len(ver)), arch, " " * (11-len(arch)), "SBo"
msg_pkg = "package"
if len(pkg_for_upg) > 1:
@ -108,7 +110,7 @@ def sbo_check():
sbo_dwn = sbo_slackbuild_dwn(sbo_url)
src_dwn = sbo_source_dwn(name).split()
script = get_file(sbo_dwn, "/")
print("\n{0}Start -->{1} {2}\n".format(colors.GREEN, colors.ENDC, name))
print("\n{0}Start -->{1} {2}\n".format(GREEN, ENDC, name))
subprocess.call("wget -N {0}".format(sbo_dwn), shell=True)
sources = []
for src in src_dwn:
@ -117,8 +119,7 @@ def sbo_check():
build_package(script, sources, build_path)
binary = ("{0}{1}-{2}-{3}{4}{5}".format(
tmp, prgnam, arch, build, sbo_tag, sbo_filetype).split())
print("{0}[ Upgrading ] --> {1}{2}".format(
colors.GREEN, colors.ENDC, name))
print("{0}[ Upgrading ] --> {1}{2}".format(GREEN, ENDC, name))
pkg_upgrade(binary)
print("Completed!\n")
else:

View file

@ -60,12 +60,17 @@ def sbo_dependencies_pkg(name):
def pkg_tracking(name):
'''
Print tree of dependencies
View tree of dependencies and also
highlight packages with color green
if allready installed and colore red
if not installed.
'''
sys.stdout.write("Reading package lists ...")
sys.stdout.flush()
initialization()
dependencies_list = sbo_dependencies_pkg(name)
GREEN, RED = colors.GREEN, colors.RED
YELLOW, CYAN, ENDC = colors.YELLOW, colors.CYAN, colors.ENDC
if dependencies_list is not None:
sys.stdout.write("Done\n")
print # new line at start
@ -80,20 +85,19 @@ def pkg_tracking(name):
if dependencies == []:
dependencies = ["No dependencies"]
template(pkg_len)
print("| Package {0}{1}{2} dependencies :".format(colors.CYAN, name,
colors.ENDC))
print("| Package {0}{1}{2} dependencies :".format(CYAN, name, ENDC))
template(pkg_len)
print("\\")
print(" +---{0}[ Tree of dependencies ]{1}".format(colors.YELLOW, colors.ENDC))
print(" +---{0}[ Tree of dependencies ]{1}".format(YELLOW, ENDC))
index = 0
for pkg in dependencies:
index += 1
if find_package(pkg + sp, pkg_path):
print(" |")
print(" {0}{1}: {2}{3}{4}".format("+--", index, colors.GREEN, pkg, colors.ENDC))
print(" {0}{1}: {2}{3}{4}".format("+--", index, GREEN, pkg, ENDC))
else:
print(" |")
print(" {0}{1}: {2}{3}{4}".format("+--", index, colors.RED, pkg, colors.ENDC))
print(" {0}{1}: {2}{3}{4}".format("+--", index, RED, pkg, ENDC))
print # new line at end
else:
sys.stdout.write("Done\n")

View file

@ -23,6 +23,6 @@
def sbo_slackbuild_dwn(sbo_url):
'''
Create download slackbuild tar.gz script
Create download slackbuild tar.gz archive
'''
return sbo_url[:-1] + ".tar.gz"

View file

@ -44,8 +44,9 @@ from greps import sbo_source_dwn, sbo_version_pkg
def sbo_build(name):
'''
Download, build and upgrade packages with all
dependencies
Download, build and install or upgrade packages
with all dependencies if version is greater than
that established.
'''
sys.stdout.write("Building dependency tree ...")
initialization()
@ -89,7 +90,8 @@ def sbo_build(name):
elif "arm" in arch:
pkg_arch.append("arm")
'''
Looks if sources unsupported or untested from arch
Looks if sources unsupported or untested
from arch
'''
if "UNSUPPORTED" in src:
pkg_arch.append("UNSUPPORTED")
@ -117,7 +119,7 @@ def sbo_build(name):
print("\nThe following packages will be automatically installed or upgraded")
print("with new version:\n")
template(78)
print "| Package", " "*31, "Version", " "*7, "Arch", " "*5, "Repository"
print "| Package", " " * 31, "Version", " " * 7, "Arch", " " * 5, "Repository"
template(78)
print("Installing:")
print " " , PKG_COLOR + name + ENDC, \
@ -147,7 +149,7 @@ def sbo_build(name):
if len(dependencies) - pkg_sum > 1:
msg_2_pkg = msg_2_pkg + "s"
print("\nInstalling summary")
print("="*79)
print("=" * 79)
print("Total {0} {1}.".format(len(dependencies), msg_pkg))
print("{0} {1} will be installed, {2} allready installed.".format(
(len(dependencies) - pkg_sum), msg_2_pkg, pkg_sum))

View file

@ -119,7 +119,6 @@ def sbo_network(name):
'''
Before installing new binary package look if arch is noarch.
This is because some maintainers changes arch manualy.
'''
if "-noarch-" in "".join(find_package(prgnam, tmp)):
sbo_arch = "-noarch-"
@ -145,4 +144,3 @@ def sbo_network(name):
sys.stdout.write ("Done\n")
message = "From slackbuilds.org"
pkg_not_found("\n", name, message, "\n")

View file

@ -82,7 +82,7 @@ def install(slack_pkg):
sys.stdout.write("Done\n\n")
if install_all:
template(78)
print "| Package", " "*33, "Arch", " "*3, "Build", " ", "Repos", " ", "Size"
print "| Package", " " * 33, "Arch", " " * 3, "Build", " ", "Repos", " ", "Size"
template(78)
print("Installing:")
for pkg, comp in zip(install_all, comp_sum):
@ -99,7 +99,7 @@ def install(slack_pkg):
" " * (40-len(pkgs[:-5])), arch, \
" " * (7-len(arch)), pkgs[-5:-4], \
" " * (6-len(pkgs[-5:-4])), "Slack", \
" " , comp, " "*(3-len(comp)), "K"
" " , comp, " " * (3-len(comp)), "K"
comp_unit, uncomp_unit = "Mb", "Mb"
compressed = round((sum(map(float, comp_sum)) * 0.0001220703125), 2)
uncompressed = round((sum(map(float, uncomp_sum)) * 0.0001220703125), 2)
@ -114,7 +114,7 @@ def install(slack_pkg):
if len(install_all) - pkg_sum > 1:
msg_2_pkg = msg_2_pkg + "s"
print("\nInstalling summary")
print("="*79)
print("=" * 79)
print("Total {0} {1}.".format(len(install_all), msg_pkg))
print("{0} {1} will be installed, {2} allready installed.".format(
(len(install_all) - pkg_sum), msg_2_pkg, pkg_sum))

View file

@ -81,7 +81,7 @@ def patches():
if upgrade_all:
print("\nThese packages need upgrading:\n")
template(78)
print "| Package", " "*33, "Arch", " "*3, "Build", " ", "Repos", " ", "Size"
print "| Package", " " * 33, "Arch", " " * 3, "Build", " ", "Repos", " ", "Size"
template(78)
print("Upgrading:")
for upgrade, size in zip(upgrade_all, comp_sum):
@ -97,7 +97,7 @@ def patches():
" " * (40-len(upg[:-(5+len(slack))])), arch, \
" " * (7-len(arch)), upg[-(5+len(slack)):-(4+len(slack))], \
" " * (6-len(upg[-(5+len(slack)):-(4+len(slack))])), "Slack", \
" " , size, " "*(3-len(size)), "K"
" " , size, " " * (3-len(size)), "K"
comp_unit, uncomp_unit = "Mb", "Mb"
compressed = round((sum(map(float, comp_sum)) * 0.0001220703125), 2)
uncompressed = round((sum(map(float, uncomp_sum)) * 0.0001220703125), 2)
@ -111,7 +111,7 @@ def patches():
if len(upgrade_all) > 1:
msg_pkg = msg_pkg + "s"
print("\nInstalling summary")
print("="*79)
print("=" * 79)
print("Total {0} {1} will be upgraded.".format(len(upgrade_all), msg_pkg))
print("Need to get {0} {1} of archives.".format(compressed, comp_unit))
print("After this process, {0} {1} of additional disk space will be used.".format(