updated for version 1.8.0

This commit is contained in:
Dimitris Zlatanidis 2014-09-03 02:05:50 +03:00
parent b660a2ce3a
commit eb263353b2
16 changed files with 187 additions and 114 deletions

View file

@ -1,3 +1,11 @@
Version 1.8.0
02-09-2014
[Updated] - Fix arch view dependencies in action -s sbo <package>
Fix find packages with version in action -s sbo <package>
Remove to remove packages after download because not useful
if download the some package and wget -N command not working.
Version 1.7.9
30-08-2014

View file

@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: slpkg
Version: 1.7.9
Version: 1.8.0
Author: dslackw
Author-email: d zlatanidis at gmail com
Maintainer: dslackw

View file

@ -7,6 +7,9 @@
.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/logo.png
:target: https://github.com/dslackw/slpkg
Slpkg 1.8.0
===========
`Slpkg <https://github.com/dslackw/slpkg>`_ is a terminal multitool in order to easy use `Slackware <http://www.slackware.com/>`_
packages.
@ -25,7 +28,8 @@ What makes slpkg apart from other tools is the friendliness and the use of color
enhancement packages
that are not installed on the system or is.
The big advantages is resolving dependencies packages from repository slackbuilds.org and
Of course one of the big advantages is resolving dependencies packages from repository
slackbuilds.org and
monitored for upgraded packages.
Of course you wonder how the slpkg is up to date at all times;

View file

@ -21,12 +21,13 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=slpkg
VERSION=${VERSION:-1.7.9}
VERSION=${VERSION:-1.8.0}
TAG=${TAG:-_dsw}
cd ..
# select archive to copy in slackbuild directory
# support wget download
# Installation script.
# Select archive to copy in slackbuild directory
# support wget download.
if [ -f $PRGNAM-$VERSION.zip ]; then
cp $PRGNAM-$VERSION.zip $PRGNAM-$VERSION/slackbuild
cd $PRGNAM-$VERSION/slackbuild

View file

@ -23,7 +23,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=slpkg
VERSION=${VERSION:-1.7.9}
VERSION=${VERSION:-1.8.0}
BUILD=${BUILD:-1}
TAG=${TAG:-_dsw}

View file

@ -1,7 +1,7 @@
PRGNAM="slpkg"
VERSION="1.7.9"
HOMEPAGE="https://github.com/dslackw/slpkg"
DOWNLOAD="https://github.com/dslackw/slpkg/archive/v1.7.9.tar.gz"
DOWNLOAD="https://github.com/dslackw/slpkg/archive/v1.8.0.tar.gz"
MD5SUM=""
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""

View file

@ -26,7 +26,7 @@ import subprocess
__all__ = "slpkg"
__author__ = "dslackw"
__version_info__ = (1, 7, 9)
__version_info__ = (1, 8, 0)
__version__ = "{0}.{1}.{2}".format(*__version_info__)
__license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com"

View file

@ -40,7 +40,6 @@ def build_package(script, sources, path):
tar.close()
for src in sources:
shutil.copy2(src, prgnam)
os.remove(path + src)
os.chdir(path + prgnam)
subprocess.call("chmod +x {0}.SlackBuild".format(prgnam), shell=True)
subprocess.call("./{0}.SlackBuild".format(prgnam), shell=True)

View file

@ -25,7 +25,6 @@ import os
import sys
import subprocess
from slpkg.pkg.find import find_package
from slpkg.pkg.build import build_package
from slpkg.pkg.manager import pkg_upgrade
@ -33,7 +32,7 @@ from slpkg.colors import colors
from slpkg.messages import template
from slpkg.functions import get_file
from slpkg.__metadata__ import (tmp, sbo_arch, build, sbo_tag,
sbo_filetype, pkg_path, build_path)
sbo_filetype, pkg_path, build_path)
from init import initialization
from search import sbo_search_pkg
@ -43,15 +42,18 @@ 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 ...")
sys.stdout.flush()
initialization()
sbo_list = []
index, toolbar_width = 0, 3
pkg_name, sbo_ver, pkg_for_upg = [], [], []
sbo_list, pkg_arch = [], []
GREEN, RED, ENDC = colors.GREEN, colors.RED, colors.ENDC
upg_name, pkg_for_upg, upg_ver, upg_arch = [], [], [], []
for pkg in os.listdir(pkg_path):
if pkg.endswith("_SBo"):
sbo_list.append(pkg)
@ -77,20 +79,20 @@ def sbo_check():
name = name[:-(len(pkg_version) + 1)]
sbo_version = sbo_version_pkg(name)
if sbo_version > pkg_version:
pkg_name.append(name)
upg_name.append(name)
pkg_for_upg.append("{0}-{1}".format(name, pkg_version))
sbo_ver.append(sbo_version)
pkg_arch.append(arch)
upg_ver.append(sbo_version)
upg_arch.append(arch)
sys.stdout.write("Done\n")
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, sbo_ver, pkg_arch):
print " ", upg, " "*(34-len(upg)), ver, \
" "*(16-len(ver)), arch, " "*(11-len(arch)), "SBo"
for upg, ver, arch in zip(pkg_for_upg, upg_ver, upg_arch):
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:
msg_pkg = msg_pkg + "s"
@ -102,13 +104,13 @@ def sbo_check():
if not os.path.exists(build_path):
os.mkdir(build_path)
os.chdir(build_path)
for name, version, arch in zip(pkg_name, sbo_ver, pkg_arch):
for name, version, arch in zip(upg_name, upg_ver, upg_arch):
prgnam = ("{0}-{1}".format(name, version))
sbo_url = sbo_search_pkg(name)
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,12 +119,11 @@ 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:
print("\nAll SBo packages are up to date\n")
print("\nTotal {0} SBo packages are up to date:\n".format(len(sbo_list)))
else:
sys.stdout.write("Done\n")
print("\nNo SBo packages found\n")

View file

@ -60,19 +60,30 @@ 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
requires, dependencies = [], []
'''
Create one list for all packages
'''
for pkg in dependencies_list:
requires += pkg
requires.reverse()
'''
Remove double dependencies
'''
for duplicate in requires:
if duplicate not in dependencies:
dependencies.append(duplicate)
@ -80,20 +91,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

@ -26,9 +26,11 @@ import os
from slpkg.url_read import url_read
from slpkg.__metadata__ import arch, lib_path
from search import sbo_search_pkg
def sbo_source_dwn(name):
'''
Grep sources downloads links
Grab sources downloads links
'''
if arch == "x86_64":
for line in open(lib_path + "sbo_repo/SLACKBUILDS.TXT", "r"):
@ -47,21 +49,35 @@ def sbo_source_dwn(name):
return line[21:].strip()
def sbo_requires_pkg(sbo_url, name):
'''
Grab package requirements
'''
read_info = url_read(sbo_url + name + ".info")
for line in read_info.splitlines():
if line.startswith("REQUIRES=\""):
return line[10:-1].strip().split()
def sbo_build_tag(sbo_url, name):
# This feature is not yet used
# because the program is doing heavy on search.
# Looking for the best option to be able to use
# the BUILD tag
'''
Grep package requirements
Grab .SlackBuild BUILD tag
'''
read_info = url_read(sbo_url + name + ".info")
read_info = url_read(sbo_url + name + ".SlackBuild")
for line in read_info.splitlines():
if line.startswith("REQUIRES=\""):
return line[10:-1].strip().split()
if line.startswith("BUILD=${BUILD:"):
return line[15:-1].strip().split()
def sbo_version_pkg(name):
'''
Grep package verion
Grab package verion
'''
for line in open(lib_path + "sbo_repo/SLACKBUILDS.TXT", "r"):
if line.startswith("SLACKBUILD NAME: "):
sbo_name = line[17:].strip()
if line.startswith("SLACKBUILD VERSION: "):
if sbo_name == name:
sbo_url = sbo_search_pkg(name)
return line[20:].strip()

View file

@ -44,66 +44,104 @@ 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()
dependencies_list = sbo_dependencies_pkg(name)
try:
if dependencies_list is not None:
pkg_sum, SC, EC = 0, "", ""
requires, dependencies, pkg_for_install = [], [], []
pkg_sum = 0
arch = os.uname()[4]
sbo_ver, pkg_arch = [], []
requires, dependencies = [], []
PKG_COLOR, DEP_COLOR, ARCH_COLOR, ENDC = "", "", "", colors.ENDC
'''
Insert master package in list to
install it after dependencies
'''
requires.append(name)
'''
Create one list for all packages
'''
for pkg in dependencies_list:
requires += pkg
requires.reverse()
'''
Remove double dependencies
'''
for duplicate in requires:
if duplicate not in dependencies:
dependencies.append(duplicate)
if find_package(name + sp, pkg_path):
pkg_for_install.append(colors.GREEN + name + colors.ENDC)
pkg_sum = 1
else:
pkg_for_install.append(colors.RED + name + colors.ENDC)
sbo_ver = sbo_version_pkg(name)
'''
Create two lists one for package version and one
for package arch.
'''
for pkg in dependencies:
version = sbo_version_pkg(pkg)
sbo_ver.append(version)
src = sbo_source_dwn(pkg)
if arch == "x86_64":
pkg_arch.append("x86_64")
elif arch.startswith("i") and arch.endswith("86"):
pkg_arch.append("i486")
elif "arm" in arch:
pkg_arch.append("arm")
'''
Looks if sources unsupported or untested
from arch
'''
if "UNSUPPORTED" in src:
pkg_arch.append("UNSUPPORTED")
elif "UNTESTED" in src:
pkg_arch.append("UNTESTED")
sbo_pkg = ("{0}-{1}".format(pkg, version))
if find_package(sbo_pkg + sp, pkg_path):
pkg_sum += 1
sys.stdout.write("Done\n")
src = sbo_source_dwn(name)
arch = os.uname()[4]
if arch == "x86_64":
arch = "x86_64"
elif arch.startswith("i") and arch.endswith("86"):
arch = "i486"
elif "arm" in arch:
arch = "arm"
if "UNSUPPORTED" in src:
arch = "UNSUPPORTED"
SC, EC = colors.RED, colors.ENDC
elif "UNTESTED" in src:
arch = "UNTESTED"
SC, EC = colors.YELLOW, colors.ENDC
'''
Tag with color green if package already installed
and color red if not installed. Also if package
arch is UNSUPPORTED tag with color red and if
UNTESTED with color yellow.
'''
master_pkg = ("{0}-{1}".format(name, sbo_ver[-1]))
if find_package(master_pkg + sp, pkg_path):
PKG_COLOR = colors.GREEN
else:
PKG_COLOR = colors.RED
if "UNSUPPORTED" in pkg_arch[-1]:
ARCH_COLOR = colors.RED
elif "UNTESTED" in pkg_arch[-1]:
ARCH_COLOR = colors.YELLOW
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 " ", "".join(pkg_for_install), " "*(38-len(name)), sbo_ver, " "*(
14-len(sbo_ver)), SC + arch + EC, " "*(9-len(arch)), "SBo"
print " " , PKG_COLOR + name + ENDC, \
" " * (38-len(name)), sbo_ver[-1], \
" " * (14-len(sbo_ver[-1])), ARCH_COLOR + pkg_arch[-1] + ENDC, \
" " * (9-len(pkg_arch[-1])), "SBo"
print("Installing for dependencies:")
for dep in dependencies[:-1]:
sbo_ver = sbo_version_pkg(dep)
if find_package(dep + sp, pkg_path):
print " ", colors.GREEN + dep + colors.ENDC, \
" "*(38-len(dep)), sbo_ver, \
" "*(14-len(sbo_ver)), SC + arch + EC, \
" "*(9-len(arch)), "SBo"
pkg_sum += 1
ARCH_COLOR = "" # reset arch color for dependencies packages
for dep, ver, dep_arch in zip(dependencies[:-1], sbo_ver[:-1], pkg_arch[:-1]):
dep_pkg = ("{0}-{1}".format(dep, ver))
if find_package(dep_pkg + sp, pkg_path):
DEP_COLOR = colors.GREEN
else:
print " ", colors.RED + dep + colors.ENDC, \
" "*(38-len(dep)), sbo_ver, \
" "*(14-len(sbo_ver)), SC + arch + EC, \
" "*(9-len(arch)), "SBo"
DEP_COLOR = colors.RED
if "UNSUPPORTED" in dep_arch:
ARCH_COLOR = colors.RED
elif "UNTESTED" in dep_arch:
ARCH_COLOR = colors.YELLOW
print " " , DEP_COLOR + dep + ENDC, \
" " * (38-len(dep)), ver, \
" " * (14-len(ver)), ARCH_COLOR + dep_arch + ENDC, \
" " * (9-len(dep_arch)), "SBo"
msg_pkg = "package"
msg_2_pkg = msg_pkg
if len(dependencies) > 1:
@ -111,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))
@ -120,12 +158,11 @@ def sbo_build(name):
if not os.path.exists(build_path):
os.mkdir(build_path)
os.chdir(build_path)
for pkg in dependencies:
sbo_version = sbo_version_pkg(pkg)
for pkg, ver in zip(dependencies, sbo_ver):
sbo_file = "".join(find_package(pkg + sp, pkg_path))
sbo_file_version = sbo_file[len(pkg) + 1:-len(arch) - 7]
if sbo_version > sbo_file_version:
prgnam = ("{0}-{1}".format(pkg, sbo_version_pkg(pkg)))
if ver > sbo_file_version:
prgnam = ("{0}-{1}".format(pkg, ver))
sbo_url = sbo_search_pkg(pkg)
sbo_link = sbo_slackbuild_dwn(sbo_url)
src_link = sbo_source_dwn(pkg).split()

View file

@ -93,7 +93,7 @@ def sbo_network(name):
sources = []
os.chdir(build_path)
script = get_file(sbo_dwn, "/")
print("\n{0}Start -->{1} {2}\n".format(colors.GREEN, colors.ENDC, name))
print("\n{0}Start -->{0} {1}\n".format(colors.GREEN, colors.ENDC, name))
subprocess.call("wget -N {0}".format(sbo_dwn), shell=True)
for src in source_dwn:
subprocess.call("wget -N {0}".format(src), shell=True)
@ -105,11 +105,11 @@ def sbo_network(name):
if not os.path.exists(build_path):
os.mkdir(build_path)
sbo_version = sbo_version_pkg(name)
if find_package(name + sp, pkg_path) == []:
prgnam = ("{0}-{1}".format(name, sbo_version))
if find_package(prgnam + sp, pkg_path) == []:
sources = []
os.chdir(build_path)
prgnam = ("{0}-{1}".format(name, sbo_version))
print("\n{0}Start -->{1} {2}\n".format(colors.GREEN, colors.ENDC, name))
print("\n{0}Start -->{0} {1}\n".format(colors.GREEN, colors.ENDC, name))
subprocess.call("wget -N {0}".format(sbo_dwn), shell=True)
script = get_file(sbo_dwn, "/")
for src in source_dwn:
@ -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-"
@ -127,13 +126,12 @@ def sbo_network(name):
from slpkg.__metadata__ import sbo_arch
binary = ("{0}{1}{2}{3}{4}{5}".format(
tmp, prgnam, sbo_arch, build, sbo_tag, sbo_filetype).split())
print("{0}[ Installing ] --> {1}{2}".format(
colors.GREEN, colors.ENDC, name))
print("{0}[ Installing ] --> {0}{1}".format(colors.GREEN, colors.ENDC, name))
pkg_upgrade(binary)
if find_package(name + sp, pkg_path):
print("Complete!\n")
else:
print("The package {0} may not install successfully".format(name))
print("The package {0} not installed successfully".format(name))
break
else:
template(78)
@ -146,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

@ -44,13 +44,13 @@ def install(slack_pkg):
dwn_list, comp_size, uncomp_size = [], [], []
install_all, package_name, package_location = [], [], []
tmp_path = slpkg_tmp + "packages/"
pkg_sum, arch, SC, EC = 0, "", "", ""
pkg_sum, arch, COLOR, ENDC = 0, "", "", colors.ENDC
if not os.path.exists(tmp_path):
if not os.path.exists(slpkg_tmp):
os.mkdir(slpkg_tmp)
os.mkdir(tmp_path)
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
colors.CYAN, slack_pkg, colors.ENDC))
colors.CYAN, slack_pkg, ENDC))
sys.stdout.write ("Reading package lists ...")
sys.stdout.flush()
PACKAGES = url_read(mirrors(name="PACKAGES.TXT", location=""))
@ -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):
@ -92,14 +92,14 @@ def install(slack_pkg):
arch = archs[1:-1]
if os.path.isfile(pkg_path + pkg[:-4]):
pkg_sum += 1
SC, EC = colors.GREEN, colors.ENDC
COLOR = colors.GREEN
else:
SC, EC = colors.RED, colors.ENDC
print " ", SC + pkgs[:-5] + EC, \
" "*(40-len(pkgs[:-5])), arch, \
" "*(7-len(arch)), pkgs[-5:-4], \
" "*(6-len(pkgs[-5:-4])), "Slack", \
" ", comp, " "*(3-len(comp)), "K"
COLOR = colors.RED
print " " , COLOR + pkgs[:-5] + ENDC, \
" " * (40-len(pkgs[:-5])), arch, \
" " * (7-len(arch)), pkgs[-5:-4], \
" " * (6-len(pkgs[-5:-4])), "Slack", \
" " , 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))
@ -129,11 +129,11 @@ def install(slack_pkg):
for install in install_all:
if not os.path.isfile(pkg_path + install[:-4]):
print("{0}[ installing ] --> {1}{2}".format(
colors.GREEN, colors.ENDC, install))
colors.GREEN, ENDC, install))
pkg_upgrade((tmp_path + install).split())
else:
print("{0}[ reinstalling ] --> {1}{2}".format(
colors.GREEN, colors.ENDC, install))
colors.GREEN, ENDC, install))
pkg_reinstall((tmp_path + install).split())
print("Completed!\n")
read = raw_input("Removal downloaded packages [Y/n]? ")

View file

@ -45,6 +45,7 @@ def patches():
comp_sum, uncomp_sum = [], []
dwn_patches, comp_size, uncomp_size = [], [], []
upgrade_all, package_name, package_location = [], [], []
GREEN, RED, ENDC = colors.GREEN, colors.RED, colors.ENDC
patch_path = slpkg_tmp + "patches/"
slack_arch = ""
if not os.path.exists(patch_path):
@ -80,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):
@ -92,11 +93,11 @@ def patches():
slack = "_slack" + slack_ver()
else:
slack = ""
print " ", upg[:-(5+len(slack))], \
" "*(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"
print " " , GREEN + upg[:-(5+len(slack))] + ENDC, \
" " * (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"
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)
@ -110,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(
@ -121,8 +122,7 @@ def patches():
subprocess.call("wget -N --directory-prefix={0} {1} {2}.asc".format(
patch_path, dwn, dwn), shell=True)
for pkg in upgrade_all:
print("{0}[ upgrading ] --> {1}{2}".format(
colors.GREEN, colors.ENDC, pkg[:-4]))
print("{0}[ upgrading ] --> {1}{2}".format(GREEN, ENDC, pkg[:-4]))
pkg_upgrade((patch_path + pkg).split())
for kernel in upgrade_all:
if "kernel" in kernel: