updated for version 1.8.8

This commit is contained in:
Dimitris Zlatanidis 2014-09-22 00:47:08 +03:00
parent 7e2dfd1d53
commit 4e50b5454a
18 changed files with 192 additions and 233 deletions

View file

@ -1,3 +1,10 @@
Version 1.8.8
22-08-2014
[Updated] - Fix Alignment viewing packages
- Fix build time
[Feature] - Added search dependencies from local SLACKBUILDS.TXT file
Version 1.8.7
19-09-2014

View file

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

View file

@ -7,9 +7,9 @@
Latest Release:
- Version: 1.8.7
- Version: 1.8.8
- `Package <https://sourceforge.net/projects/slpkg/files/slpkg/binary/>`_
- `Source <https://github.com/dslackw/slpkg/archive/v1.8.7.tar.gz>`_
- `Source <https://github.com/dslackw/slpkg/archive/v1.8.8.tar.gz>`_
- `CHANGELOG <https://github.com/dslackw/slpkg/blob/master/CHANGELOG>`_
.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/logo.png
@ -98,8 +98,8 @@ Untar the archive and run install.sh script:
.. code-block:: bash
$ tar xvf slpkg-1.8.7.tar.gz
$ cd slpkg-1.8.7
$ tar xvf slpkg-1.8.8.tar.gz
$ cd slpkg-1.8.8
$ ./install.sh
Using `pip <https://pip.pypa.io/en/latest/>`_ :
@ -195,12 +195,12 @@ download and install:
Reading package lists.............................. Done
+==============================================================================
| Package Version Arch Build Repos Size
| Package Version Arch Build Repos Size
+==============================================================================
Installing:
mozilla-firefox 24.1.0esr x86_64 1 Slack 23524 K
mozilla-nss 3.15.2 x86_64 2 Slack 1592 K
mozilla-thunderbird 24.1.0 x86_64 1 Slack 24208 K
mozilla-firefox 24.1.0esr x86_64 1 Slack 23524 K
mozilla-nss 3.15.2 x86_64 2 Slack 1592 K
mozilla-thunderbird 24.1.0 x86_64 1 Slack 24208 K
Installing summary
===============================================================================
@ -274,12 +274,12 @@ Check if your distribution is up to date from `Slackware official mirrors
These packages need upgrading:
+==============================================================================
| Package Version Arch Build Repos Size
| Package Version Arch Build Repos Size
+==============================================================================
Upgrading:
dhcpcd 6.0.5 x86_64 3 Slack 92 K
samba 4.1.11 x86_64 1 Slack 9928 K
xscreensaver 5.29 x86_64 1 Slack 3896 K
dhcpcd 6.0.5 x86_64 3 Slack 92 K
samba 4.1.11 x86_64 1 Slack 9928 K
xscreensaver 5.29 x86_64 1 Slack 3896 K
Installing summary
===============================================================================

View file

@ -21,7 +21,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=slpkg
VERSION=${VERSION:-1.8.7}
VERSION=${VERSION:-1.8.8}
TAG=${TAG:-_dsw}
cd ..

View file

@ -33,9 +33,9 @@ except ImportError:
from distutils.core import setup
setup(
name='slpkg',
packages=['slpkg', 'slpkg/sbo', 'slpkg/pkg', 'slpkg/slack'],
scripts=['bin/slpkg'],
name="slpkg",
packages=["slpkg", "slpkg/sbo", "slpkg/pkg", "slpkg/slack"],
scripts=["bin/slpkg"],
version=__version__,
description="Python tool to manage Slackware packages",
keywords=["slackware", "slpkg", "upgrade", "install", "remove",
@ -61,11 +61,11 @@ setup(
long_description=open("README.rst").read()
)
if 'install' in sys.argv:
if "install" in sys.argv:
man_path = "/usr/man/man8/"
os.system("mkdir -p {}".format(man_path))
if os.path.exists(man_path):
print("Installing man pages")
man_page = "man/slpkg.8"
shutil.copy2(man_page, man_path)
os.chmod(man_path, int('444', 8))
os.chmod(man_path, int("444", 8))

View file

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

View file

@ -1,7 +1,7 @@
PRGNAM="slpkg"
VERSION="1.8.7"
VERSION="1.8.8"
HOMEPAGE="https://github.com/dslackw/slpkg"
DOWNLOAD="https://github.com/dslackw/slpkg/archive/v1.8.7.tar.gz"
DOWNLOAD="https://github.com/dslackw/slpkg/archive/v1.8.8.tar.gz"
MD5SUM=""
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""

View file

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

View file

@ -104,13 +104,13 @@ def build_package(script, sources, path):
end_time = time.time()
diff_time = round(end_time - start_time, 2)
# calculate build time per package
if diff_time <= 60:
if diff_time <= 59.99:
sum_time = str(diff_time) + " Sec"
elif diff_time > 60:
elif diff_time > 59.99 and diff_time <= 3599.99:
sum_time = round(diff_time / 60, 2)
sum_time_list = re.findall(r"\d+", str(sum_time))
sum_time = ("{0} Min {1} Sec".format(sum_time_list[0], sum_time_list[1]))
elif diff_time > 3600:
elif diff_time > 3599.99:
sum_time = round(diff_time / 3600, 2)
sum_time_list = re.findall(r"\d+", str(sum_time))
sum_time = ("{0} Hours {1} Min".format(sum_time_list[0], sum_time_list[1]))

View file

@ -41,9 +41,9 @@ def pkg_install(binary):
except subprocess.CalledProcessError:
message = "Can't install"
if len(binary) > 1:
bol, eol = "", ""
bol = eol = str()
else:
bol, eol = "\n", "\n"
bol = eol = "\n"
pkg_not_found(bol, pkg, message, eol)
def pkg_upgrade(binary):
@ -57,9 +57,9 @@ def pkg_upgrade(binary):
except subprocess.CalledProcessError:
message = "Can't upgrade"
if len(binary) > 1:
bol, eol = "", ""
bol = eol = str()
else:
bol, eol = "\n", "\n"
bol = eol = "\n"
pkg_not_found(bol, pkg, message, eol)
def pkg_reinstall(binary):
@ -73,9 +73,9 @@ def pkg_reinstall(binary):
except subprocess.CalledProcessError:
message = "Can't reinstall"
if len(binary) > 1:
bol, eol = "", ""
bol = eol = str()
else:
bol, eol = "\n", "\n"
bol = eol = "\n"
pkg_not_found(bol, pkg, message, eol)
def pkg_remove(binary):
@ -83,8 +83,8 @@ def pkg_remove(binary):
Remove Slackware binary packages
'''
dep_path = log_path + "dep/"
removed, dependencies = [], []
rmv_list, rmv_dependencies = [], []
removed, dependencies, \
rmv_list, rmv_dependencies = ([] for i in range(4))
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
colors.CYAN, ", ".join(binary), colors.ENDC))
for pkg in binary:
@ -109,11 +109,9 @@ def pkg_remove(binary):
sys.exit()
if remove_pkg == "y" or remove_pkg == "Y":
for rmv in removed:
'''
If package build and install with 'slpkg -s sbo <package>'
then look log file for dependencies in /var/log/slpkg/dep,
read and remove all else remove only the package.
'''
# If package build and install with 'slpkg -s sbo <package>'
# then look log file for dependencies in /var/log/slpkg/dep,
# read and remove all else remove only the package.
if os.path.isfile(dep_path + rmv):
f = open(dep_path + rmv, "r")
dependencies = f.read().split()
@ -122,15 +120,14 @@ def pkg_remove(binary):
template(78)
print("| Found dependencies for package {0}:".format(rmv))
template(78)
'''
Prints dependecies before removed except master package
because referred as master package
'''
# Prints dependecies before removed except master package
# because referred as master package
for dep in dependencies[:-1]:
print("| " + dep)
template(78)
try:
remove_dep = raw_input("\nRemove dependencies (maybe used by other packages) [Y/n]? ")
remove_dep = raw_input(
"\nRemove dependencies (maybe used by other packages) [Y/n]? ")
except KeyboardInterrupt:
print # new line at exit
sys.exit()
@ -151,9 +148,7 @@ def pkg_remove(binary):
if find_package(rmv + sp, pkg_path):
print subprocess.check_output("removepkg {0}".format(rmv), shell=True)
rmv_list.append(rmv)
'''
Prints all removed packages
'''
# Prints all removed packages
if len(rmv_list) > 1:
template(78)
print("| Total {0} packages removed".format(len(rmv_list)))
@ -170,7 +165,7 @@ def pkg_find(binary):
'''
Find installed Slackware packages
'''
matching, size = 0, 0
matching = size = int()
print("\nInstalled packages with name matching [ {0}{1}{2} ]\n".format(
colors.CYAN, binary, colors.ENDC))
for match in sorted(os.listdir(pkg_path)):
@ -205,13 +200,13 @@ def pkg_display(binary):
for pkg in binary:
if find_package(pkg + sp, pkg_path):
print subprocess.check_output("cat {0}{1}".format(pkg_path,
" /var/log/packages/".join(find_package(pkg +sp, pkg_path))), shell=True)
" /var/log/packages/".join(find_package(pkg +sp, pkg_path))), shell=True)
else:
message = "Can't dislpay"
if len(binary) > 1:
bol, eol = "", ""
bol = eol = str()
else:
bol, eol = "\n", "\n"
bol = eol = "\n"
pkg_not_found(bol, pkg, message, eol)
def pkg_list(pattern):

View file

@ -54,10 +54,16 @@ def sbo_check():
colors.GREY, colors.ENDC))
sys.stdout.flush()
initialization()
index, toolbar_width = 0, 3
dependencies, dependencies_list = [], []
requires, upgrade, installed, sbo_list = [], [], [], []
upg_name, pkg_for_upg, upg_ver, upg_arch = [], [], [], []
arches = [
"-x86_64-",
"-i486-",
"-arm-",
"-noarch-"
]
index, toolbar_width = int(), 3
dependencies, dependencies_list, \
requires, upgrade, installed, sbo_list, \
upg_name, pkg_for_upg, upg_ver, upg_arch = ([] for i in range(10))
GREEN, RED, ENDC = colors.GREEN, colors.RED, colors.ENDC
for pkg in os.listdir(pkg_path):
if pkg.endswith("_SBo"):
@ -69,16 +75,11 @@ def sbo_check():
sys.stdout.write("{0}.{1}".format(colors.GREY, ENDC))
sys.stdout.flush()
toolbar_width += 4
if "-x86_64-" in pkg:
arch = "x86_64"
elif "-i486-" in pkg:
arch = "i486"
elif "-arm-" in pkg:
arch = "arm"
elif "-noarch-" in pkg:
arch = "noarch"
else:
arch = os.uname()[4]
for _arch in arches:
if _arch in pkg:
arch = _arch[1:-1]
else:
arch = os.uname()[4]
package = pkg[:-(len(arch) + len("_SBo") + 3)]
pkg_version = get_file(package, "-")[1:]
name = package[:-(len(pkg_version) + 1)]
@ -94,43 +95,33 @@ def sbo_check():
sys.stdout.write("{0}Resolving dependencies ...{1}".format(
colors.GREY, ENDC))
sys.stdout.flush()
'''
Of the packages found to need upgrading,
stored in a series such as reading from the
file .info.
'''
# Of the packages found to need upgrading,
# stored in a series such as reading from the
# file .info.
for upg in upg_name:
dependencies = sbo_dependencies_pkg(upg)
'''
Because there are dependencies that depend on other
dependencies are created lists into other lists.
Thus creating this loop create one-dimensional list.
'''
# Because there are dependencies that depend on other
# dependencies are created lists into other lists.
# Thus creating this loop create one-dimensional list.
for dep in dependencies:
requires += dep
requires.reverse() # Inverting the list brings the
# dependencies in order to be installed.
'''
Many packages use the same dependencies, in this loop
creates a new list by removing duplicate dependencies but
without spoiling the line must be installed.
'''
# Many packages use the same dependencies, in this loop
# creates a new list by removing duplicate dependencies but
# without spoiling the line must be installed.
for duplicate in requires:
if duplicate not in dependencies_list:
dependencies_list.append(duplicate)
'''
Last and after the list is created with the correct number
of dependencies that must be installed, and add the particular
packages that need to be upgraded if they are not already on
the list in end to list.
'''
# Last and after the list is created with the correct number
# of dependencies that must be installed, and add the particular
# packages that need to be upgraded if they are not already on
# the list in end to list.
for upg in upg_name:
if upg not in dependencies_list:
dependencies_list.append(upg)
'''
In the end lest a check of the packages that are on the list
are already installed.
'''
# In the end lest a check of the packages that are on the list
# are already installed.
for pkg in dependencies_list:
ver = sbo_version_pkg(pkg)
prgnam = ("{0}-{1}".format(pkg, ver))
@ -142,16 +133,11 @@ def sbo_check():
# search if packages installed
# if yes grab package name,
# version and arch
if "-x86_64-" in sbo:
arch = "x86_64"
elif "-i486-" in sbo:
arch = "i486"
elif "-arm-" in sbo:
arch = "arm"
elif "-noarch-" in sbo:
arch = "noarch"
else:
arch = os.uname()[4]
for _arch in arches:
if _arch in pkg:
arch = _arch[1:-1]
else:
arch = os.uname()[4]
name = sbo[:-(len(arch) + len("_SBo") + 3)]
pkg_version = get_file(name, "-")[1:]
upgrade.append(pkg)
@ -162,10 +148,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("{0}{1}{2}{3}{4}{5}{6}".format("| Package", " " * 30, "New version", \
" " * 6 , "Arch", " " * 9, "Repository"))
template(78)
print("Upgrading:")
count_upgraded, count_installed = 0, 0
count_upgraded = count_installed = int()
for upg, ver, arch in zip(pkg_for_upg, upg_ver, upg_arch):
if find_package(upg[:-len(ver)], pkg_path):
COLOR = colors.YELLOW
@ -173,8 +160,9 @@ def sbo_check():
else:
COLOR = colors.RED
count_installed += 1
print " " , COLOR + upg + ENDC, " " * (34-len(upg)), GREEN + ver + ENDC, \
" " * (16-len(ver)), arch, " " * (11-len(arch)), "SBo"
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(COLOR, upg, ENDC, \
" " * (38-len(upg)), GREEN, ver, ENDC, \
" " * (17-len(ver)), arch, " " * (13-len(arch)), "SBo"))
msg_upg = "package"
msg_ins = msg_upg
if count_upgraded > 1:
@ -203,11 +191,9 @@ def sbo_check():
subprocess.call("wget -N {0}".format(src), shell=True)
sources.append(get_file(src, "/"))
build_package(script, sources, build_path)
'''
Searches the package name and version in /tmp to install.
If find two or more packages e.g. to build tag
2 or 3 will fit most.
'''
# Searches the package name and version in /tmp to install.
# If find two or more packages e.g. to build tag
# 2 or 3 will fit most.
binary_list = []
for search in find_package(prgnam, tmp):
if "_SBo" in search:

View file

@ -43,8 +43,9 @@ def sbo_dependencies_pkg(name):
dependencies = []
sbo_url = sbo_search_pkg(name)
if sbo_url:
requires = sbo_requires_pkg(sbo_url, name)
requires = sbo_requires_pkg(name)
for req in requires:
# avoid to add %README% as dependency
if "%README%" not in req:
dependencies.append(req)
if dependencies:
@ -77,15 +78,11 @@ def pkg_tracking(name):
sys.stdout.write("{0}Done{1}\n".format(colors.GREY, colors.ENDC))
print # new line at start
requires, dependencies = [], []
'''
Create one list for all packages
'''
# Create one list for all packages
for pkg in dependencies_list:
requires += pkg
requires.reverse()
'''
Remove double dependencies
'''
# Remove double dependencies
for duplicate in requires:
if duplicate not in dependencies:
dependencies.append(duplicate)
@ -97,7 +94,7 @@ def pkg_tracking(name):
template(pkg_len)
print("\\")
print(" +---{0}[ Tree of dependencies ]{1}".format(YELLOW, ENDC))
index = 0
index = int()
for pkg in dependencies:
index += 1
if find_package(pkg + sp, pkg_path):

View file

@ -48,14 +48,16 @@ def sbo_source_dwn(name):
if sbo_name == 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_requires_pkg(name):
'''
Grab package requirements
'''
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 REQUIRES: "):
if sbo_name == name:
return line[21:].strip().split()
def sbo_build_tag(sbo_url, name):
# This feature is not yet used

View file

@ -48,10 +48,8 @@ def initialization():
if not os.path.exists(sbo_lib):
os.mkdir(sbo_lib)
sbo_url = ("http://slackbuilds.org/slackbuilds/{0}/".format(slack_ver()))
'''
Read SLACKBUILDS.TXT from slackbuilds.org and write in /var/lib/slpkg/sbo_repo/
directory if not exist
'''
# Read SLACKBUILDS.TXT from slackbuilds.org and write in /var/lib/slpkg/sbo_repo/
# directory if not exist
if not os.path.isfile(sbo_lib + "SLACKBUILDS.TXT"):
print("\nslpkg ...initialization")
sys.stdout.write("SLACKBUILDS.TXT read ...")
@ -63,10 +61,8 @@ def initialization():
sbo.write(SLACKBUILDS_TXT)
sbo.close()
print("File SLACKBUILDS.TXT created in {0}".format(sbo_lib))
'''
Read ChangeLog.txt from slackbuilds.org and write in /var/log/slpkg/sbo/
directory if not exist
'''
# Read ChangeLog.txt from slackbuilds.org and write in /var/log/slpkg/sbo/
# directory if not exist
if not os.path.isfile(sbo_log + "ChangeLog.txt"):
print("\nslpkg initialization")
sys.stdout.write("ChangeLog.txt read ...")
@ -78,14 +74,10 @@ def initialization():
log.write(ChangeLog_txt)
log.close()
print("File ChangeLog.txt created in {0}".format(sbo_log))
'''
We take the size of ChangeLog.txt from the server and locally
'''
# We take the size of ChangeLog.txt from the server and locally
server = int(''.join(server_file_size(sbo_url + "ChangeLog.txt")))
local = int(local_file_size(sbo_log + "ChangeLog.txt"))
'''
If the two files differ in size delete and replaced with new
'''
# If the two files differ in size delete and replaced with new
if server != local:
os.remove("{0}{1}".format(sbo_lib, "SLACKBUILDS.TXT"))
os.remove("{0}{1}".format(sbo_log, "ChangeLog.txt"))

View file

@ -52,34 +52,25 @@ def sbo_build(name):
dependencies_list = sbo_dependencies_pkg(name)
try:
if dependencies_list is not None:
pkg_sum, count_upgraded, count_installed = 0, 0, 0
arch = os.uname()[4]
sbo_ver, pkg_arch = [], []
installs, upgraded, versions = [], [], []
requires, dependencies = [], []
PKG_COLOR, DEP_COLOR, ARCH_COLOR = "", "", ""
pkg_sum = count_upgraded = count_installed = int()
sbo_ver, pkg_arch, installs, upgraded, \
versions, requires, dependencies = ([] for i in range(7))
PKG_COLOR = DEP_COLOR = ARCH_COLOR = str()
ENDC = colors.ENDC
'''
Insert master package in list to
install it after dependencies
'''
arch = os.uname()[4]
# Insert master package in list to
# install it after dependencies
requires.append(name)
'''
Create one list for all packages
'''
# Create one list for all packages
for pkg in dependencies_list:
requires += pkg
requires.reverse()
'''
Remove double dependencies
'''
# Remove double dependencies
for duplicate in requires:
if duplicate not in dependencies:
dependencies.append(duplicate)
'''
Create two lists one for package version and one
for package arch.
'''
# 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)
@ -90,10 +81,8 @@ def sbo_build(name):
pkg_arch.append("i486")
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")
elif "UNTESTED" in src:
@ -103,12 +92,10 @@ def sbo_build(name):
pkg_sum += 1
sys.stdout.write("{0}Done{1}\n".format(
colors.GREY, ENDC))
'''
Tag with color green if package already installed,
color yellow for packages to upgrade and color red
if not installed. Also if package arch is UNSUPPORTED
tag with color red and if UNTESTED with color yellow.
'''
# Tag with color green if package already installed,
# color yellow for packages to upgrade 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, pkg_path):
PKG_COLOR = colors.GREEN
@ -125,13 +112,14 @@ 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("{0}{1}{2}{3}{4}{5}{6}".format("| Package", " " * 30, "Version", \
" " * 10, "Arch", " " * 9, "Repository"))
template(78)
print("Installing:")
print " " , PKG_COLOR + name + ENDC, \
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(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"
" " * (17-len(sbo_ver[-1])), ARCH_COLOR, pkg_arch[-1], ENDC, \
" " * (13-len(pkg_arch[-1])), "SBo"))
print("Installing for dependencies:")
ARCH_COLOR = "" # reset arch color for dependencies packages
for dep, ver, dep_arch in zip(dependencies[:-1], sbo_ver[:-1], pkg_arch[:-1]):
@ -148,10 +136,10 @@ def sbo_build(name):
ARCH_COLOR = colors.RED
elif "UNTESTED" in dep_arch:
ARCH_COLOR = colors.YELLOW
print " " , DEP_COLOR + dep + ENDC, \
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(DEP_COLOR, dep, ENDC, \
" " * (38-len(dep)), ver, \
" " * (14-len(ver)), ARCH_COLOR + dep_arch + ENDC, \
" " * (9-len(dep_arch)), "SBo"
" " * (17-len(ver)), ARCH_COLOR, dep_arch, ENDC, \
" " * (13-len(dep_arch)), "SBo"))
msg_ins = "package"
msg_upg = msg_ins
if count_installed > 1:
@ -164,10 +152,8 @@ def sbo_build(name):
print("{0} {1} will be installed, {2} allready installed and {3} {4}".format(
count_installed, msg_ins, pkg_sum, count_upgraded, msg_upg))
print("will be upgraded.\n")
'''
Check if package supported or tested by arch
before proceed to install
'''
# Check if package supported or tested by arch
# before proceed to install
UNST = ["UNSUPPORTED", "UNTESTED"]
if src in UNST:
print("\n{0}The package {1}{2}\n".format(colors.RED, src, ENDC))
@ -200,11 +186,9 @@ def sbo_build(name):
subprocess.call("wget -N {0}".format(src), shell=True)
sources.append(get_file(src, "/"))
build_package(script, sources, build_path)
'''
Searches the package name and version in /tmp to install.
If find two or more packages e.g. to build tag
2 or 3 will fit most.
'''
# Searches the package name and version in /tmp to install.
# If find two or more packages e.g. to build tag
# 2 or 3 will fit most.
binary_list = []
for search in find_package(prgnam, tmp):
if "_SBo" in search:
@ -225,10 +209,8 @@ def sbo_build(name):
print("Complete!\n")
installs.append(pkg)
versions.append(ver)
'''
Reference list with packages installed
and upgraded.
'''
# Reference list with packages installed
# and upgraded.
if len(installs) > 1:
template(78)
print("| Total {0} {1} installed and {2} {3} upgraded".format(
@ -244,10 +226,8 @@ def sbo_build(name):
else:
print("| Package {0} NOT installed".format(installed))
template(78)
'''
Write dependencies in a log file
into directory `/var/log/slpkg/dep/`
'''
# Write dependencies in a log file
# into directory `/var/log/slpkg/dep/`
if find_package(name + sp, pkg_path):
dep_path = log_path + "dep/"
if not os.path.exists(dep_path):

View file

@ -52,18 +52,16 @@ def sbo_network(name):
initialization()
sbo_url = sbo_search_pkg(name)
if sbo_url:
sbo_req = sbo_requires_pkg(sbo_url, name)
sbo_req = sbo_requires_pkg(name)
sbo_dwn = sbo_slackbuild_dwn(sbo_url)
source_dwn = sbo_source_dwn(name).split()
sys.stdout.write ("{0}Done{1}\n".format(colors.GREY, colors.ENDC))
sys.stdout.write("{0}Done{1}\n".format(colors.GREY, colors.ENDC))
view_sbo(name, sbo_url, get_file(sbo_dwn, "/"), \
", ".join([get_file(src, "/") for src in source_dwn]), \
sbo_req)
'''
Check if package supported by arch
before proceed to install
'''
FAULT = ""
# Check if package supported by arch
# before proceed to install
FAULT = str()
UNST = ["UNSUPPORTED", "UNTESTED"]
if "".join(source_dwn) in UNST:
FAULT = "".join(source_dwn)
@ -130,11 +128,9 @@ def sbo_network(name):
subprocess.call("wget -N {0}".format(src), shell=True)
sources.append(get_file(src, "/"))
build_package(script, sources, build_path)
'''
Searches the package name and version in /tmp to install.
If find two or more packages e.g. to build tag
2 or 3 will fit most.
'''
# Searches the package name and version in /tmp to install.
# If find two or more packages e.g. to build tag
# 2 or 3 will fit most.
binary_list = []
for search in find_package(prgnam, tmp):
if "_SBo" in search:

View file

@ -43,11 +43,12 @@ def install(slack_pkg):
Install packages from official Slackware distribution
'''
try:
pkg_sum, uni_sum, upg_sum = 0, 0, 0
comp_sum, uncomp_sum = [], []
names, dwn_list, comp_size, uncomp_size = [], [], [], []
install_all, package_name, package_location = [], [], []
arch, COLOR, ENDC = "", "", colors.ENDC
pkg_sum = uni_sum = upg_sum = int()
comp_sum, uncomp_sum, names, dwn_list, comp_size, \
uncomp_size, install_all, package_name, \
package_location = ([] for i in range(9))
arch = COLOR = str()
ENDC = colors.ENDC
# create directories if not exist
tmp_path = slpkg_tmp + "packages/"
if not os.path.exists(slpkg_tmp):
@ -87,8 +88,9 @@ def install(slack_pkg):
sys.stdout.write("{0}Done{1}\n\n".format(colors.GREY, ENDC))
if install_all:
template(78)
print "| Package", " " * 17, "Version", " " * 8, "Arch", " " * 3, \
"Build", " ", "Repos", " ", "Size"
print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
"| Package", " " * 17, "Version", " " * 12, "Arch", " " * 4, \
"Build", " " * 2, "Repos", " " * 10, "Size"))
template(78)
print("Installing:")
for pkg, comp in zip(install_all, comp_sum):
@ -110,13 +112,14 @@ def install(slack_pkg):
else:
COLOR = colors.RED
uni_sum += 1
print " " , COLOR + name + ENDC, \
" " * (24-len(name)), ver, \
" " * (15-len(ver)), arch, \
" " * (7-len(arch)), build, \
" " * (6-len(build)), "Slack", \
" " , comp, " " * (3-len(comp)), "K"
comp_unit, uncomp_unit = "Mb", "Mb"
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11:>12}{12}".format(
COLOR, name, ENDC, \
" " * (25-len(name)), ver, \
" " * (19-len(ver)), arch, \
" " * (8-len(arch)), build, \
" " * (7-len(build)), "Slack", \
comp, " K"))
comp_unit = uncomp_unit = "Mb"
compressed = round((sum(map(float, comp_sum)) / 1024), 2)
uncompressed = round((sum(map(float, uncomp_sum)) / 1024), 2)
if compressed < 1:

View file

@ -42,12 +42,11 @@ def patches():
Install new patches from official Slackware mirrors
'''
try:
comp_sum, uncomp_sum = [], []
dwn_patches, comp_size, uncomp_size = [], [], []
upgrade_all, package_name, package_location = [], [], []
slack_arch = str()
comp_sum, uncomp_sum, dwn_patches, comp_size, uncomp_size, \
upgrade_all, package_name, package_location = ([] for i in range(8))
GREEN, RED, ENDC = colors.GREEN, colors.RED, colors.ENDC
patch_path = slpkg_tmp + "patches/"
slack_arch = ""
if not os.path.exists(slpkg_tmp):
os.mkdir(slpkg_tmp)
if not os.path.exists(patch_path):
@ -81,8 +80,9 @@ def patches():
if upgrade_all:
print("\nThese packages need upgrading:\n")
template(78)
print "| Package", " " * 17, "Version", " " * 8, "Arch", " " * 3, \
"Build", " ", "Repos", " ", "Size"
print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
"| Package", " " * 17, "Version", " " * 12, "Arch", " " * 4, \
"Build", " " * 2, "Repos", " " * 10, "Size"))
template(78)
print("Upgrading:")
for upgrade, size in zip(upgrade_all, comp_sum):
@ -92,20 +92,21 @@ def patches():
if "_slack" in upgrade:
slack = "_slack" + slack_ver()
else:
slack = ""
slack = str()
upg = upgrade[:-(len(slack) + 4)]
build = get_file(upg, "-").replace("-", "")
upg_ver = upg[:-(len(arch) + len(build))]
ver = get_file(upg_ver, "-").replace("-", "")
name = upg_ver[:-(len(ver) + 1)]
arch = arch[1:-1]
print " " , GREEN + name + ENDC, \
" " * (24-len(name)), ver, \
" " * (15-len(ver)), arch, \
" " * (7-len(arch)), build, \
" " * (6-len(build)), "Slack", \
" " , size, " " * (3-len(size)), "K"
comp_unit, uncomp_unit = "Mb", "Mb"
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11:>12}{12}".format(
GREEN, name, ENDC, \
" " * (25-len(name)), ver, \
" " * (19-len(ver)), arch, \
" " * (8-len(arch)), build, \
" " * (7-len(build)), "Slack", \
size, " K"))
comp_unit = uncomp_unit = "Mb"
compressed = round((sum(map(float, comp_sum)) / 1024), 2)
uncompressed = round((sum(map(float, uncomp_sum)) / 1024), 2)
if compressed < 1: