mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-18 10:26:29 +01:00
updated for version 1.8.2
This commit is contained in:
parent
5c049ea7e2
commit
a12e01ed70
16 changed files with 250 additions and 104 deletions
|
@ -1,3 +1,10 @@
|
|||
Version 1.8.2
|
||||
08-09-2014
|
||||
|
||||
[Updated] - Fix resolving dependencies '-c sbo upgrade' option.
|
||||
- Update sbo summarys
|
||||
[Feature] - Add build log file
|
||||
|
||||
Version 1.8.1
|
||||
04-09-2014
|
||||
|
||||
|
|
2
PKG-INFO
2
PKG-INFO
|
@ -1,6 +1,6 @@
|
|||
Metadata-Version: 1.1
|
||||
Name: slpkg
|
||||
Version: 1.8.1
|
||||
Version: 1.8.2
|
||||
Author: dslackw
|
||||
Author-email: d zlatanidis at gmail com
|
||||
Maintainer: dslackw
|
||||
|
|
42
README.rst
42
README.rst
|
@ -7,8 +7,12 @@
|
|||
.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/logo.png
|
||||
:target: https://github.com/dslackw/slpkg
|
||||
|
||||
slpkg 1.8.1
|
||||
===========
|
||||
Latest Release:
|
||||
|
||||
- Version: 1.8.2
|
||||
- `Package <https://sourceforge.net/projects/slpkg/>`_
|
||||
- `Source <https://github.com/dslackw/slpkg/archive/v1.8.2.tar.gz>`_
|
||||
- `CHANGELOG <https://github.com/dslackw/slpkg/blob/master/CHANGELOG>`_
|
||||
|
||||
`Slpkg <https://github.com/dslackw/slpkg>`_ is a terminal multitool in order to easy use `Slackware <http://www.slackware.com/>`_
|
||||
packages.
|
||||
|
@ -72,8 +76,6 @@ Features
|
|||
It's a quick and easy way to manage your packages in `Slackware <http://www.slackware.com/>`_
|
||||
to a command.
|
||||
|
||||
`[CHANGELOG] <https://github.com/dslackw/slpkg/blob/master/CHANGELOG>`_
|
||||
|
||||
Video Tutorial
|
||||
==============
|
||||
|
||||
|
@ -87,8 +89,8 @@ Untar the archive and run install.sh script:
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
$ tar xvf slpkg-1.8.1.tar.gz
|
||||
$ cd slpkg-1.8.1
|
||||
$ tar xvf slpkg-1.8.2.tar.gz
|
||||
$ cd slpkg-1.8.2
|
||||
$ ./install.sh
|
||||
|
||||
Using `pip <https://pip.pypa.io/en/latest/>`_ :
|
||||
|
@ -151,7 +153,8 @@ build and install with all dependencies :
|
|||
$ slpkg -s sbo brasero
|
||||
Building dependency tree...... Done
|
||||
|
||||
The following packages will be automatically installed or upgraded with new version:
|
||||
The following packages will be automatically installed or upgraded
|
||||
with new version:
|
||||
|
||||
+==============================================================================
|
||||
| Package Version Arch Repository
|
||||
|
@ -168,29 +171,10 @@ build and install with all dependencies :
|
|||
Installing summary
|
||||
===============================================================================
|
||||
Total 6 packages.
|
||||
6 packages will be installed, 0 allready installed.
|
||||
6 packages will be installed, 0 allready installed and 0 package
|
||||
will be upgraded.
|
||||
|
||||
Do you want to continue [Y/n]? y
|
||||
.
|
||||
.
|
||||
.
|
||||
+==============================================================================
|
||||
| Installing new package /tmp/brasero-3.11.3-x86_64-1_SBo.tgz
|
||||
+==============================================================================
|
||||
|
||||
Verifying package brasero-3.11.3-x86_64-1_SBo.tgz.
|
||||
Installing package brasero-3.11.3-x86_64-1_SBo.tgz:
|
||||
PACKAGE DESCRIPTION:
|
||||
# brasero (CD/DVD burning application)
|
||||
#
|
||||
# Brasero is a application to burn CD/DVD for the Gnome Desktop. It is
|
||||
# designed to be as simple as possible and has some unique features to
|
||||
# enable users to create their discs easily and quickly.
|
||||
#
|
||||
# Homepage: http://projects.gnome.org/brasero
|
||||
#
|
||||
Executing install script for brasero-3.11.3-x86_64-1_SBo.tgz.
|
||||
Package brasero-3.11.3-x86_64-1_SBo.tgz installed.
|
||||
|
||||
Find packages from `Slackware official mirrors <http://mirrors.slackware.com/>`_
|
||||
download and install:
|
||||
|
@ -269,7 +253,7 @@ Check if your packages is up to date from slackbuilds.org:
|
|||
|
||||
Installing summary
|
||||
===============================================================================
|
||||
Total 8 packages will be upgraded.
|
||||
Total 8 packages will be upgraded and 0 package will be installed.
|
||||
|
||||
Would you like to upgrade [Y/n]?
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
PRGNAM=slpkg
|
||||
VERSION=${VERSION:-1.8.1}
|
||||
VERSION=${VERSION:-1.8.2}
|
||||
TAG=${TAG:-_dsw}
|
||||
|
||||
cd ..
|
||||
|
|
|
@ -170,7 +170,8 @@ $ \fBslpkg -s sbo brasero\fP
|
|||
Installing summary
|
||||
===============================================================================
|
||||
Total 6 packages.
|
||||
0 packages will be installed, 6 allready installed.
|
||||
2 packages will be installed, 3 allready installed and 1 packages
|
||||
will be upgraded.
|
||||
|
||||
Do you want to continue [Y/n]? y
|
||||
.
|
||||
|
@ -215,7 +216,7 @@ $ \fBslpkg -c sbo upgrade\fP
|
|||
|
||||
Installing summary
|
||||
===============================================================================
|
||||
Total 8 packages will be upgraded.
|
||||
Total 8 packages will be upgraded and 0 package will be installed.
|
||||
|
||||
Would you like to upgrade [Y/n]?
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
PRGNAM=slpkg
|
||||
VERSION=${VERSION:-1.8.1}
|
||||
VERSION=${VERSION:-1.8.2}
|
||||
BUILD=${BUILD:-1}
|
||||
TAG=${TAG:-_dsw}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
PRGNAM="slpkg"
|
||||
VERSION="1.8.1"
|
||||
VERSION="1.8.2"
|
||||
HOMEPAGE="https://github.com/dslackw/slpkg"
|
||||
DOWNLOAD="https://github.com/dslackw/slpkg/archive/v1.8.1.tar.gz"
|
||||
DOWNLOAD="https://github.com/dslackw/slpkg/archive/v1.8.2.tar.gz"
|
||||
MD5SUM=""
|
||||
DOWNLOAD_x86_64=""
|
||||
MD5SUM_x86_64=""
|
||||
|
|
|
@ -26,7 +26,7 @@ import subprocess
|
|||
|
||||
__all__ = "slpkg"
|
||||
__author__ = "dslackw"
|
||||
__version_info__ = (1, 8, 1)
|
||||
__version_info__ = (1, 8, 2)
|
||||
__version__ = "{0}.{1}.{2}".format(*__version_info__)
|
||||
__license__ = "GNU General Public License v3 (GPLv3)"
|
||||
__email__ = "d.zlatanidis@gmail.com"
|
||||
|
|
|
@ -74,6 +74,11 @@ def s_user(user):
|
|||
print("\nError: must have root privileges\n")
|
||||
sys.exit()
|
||||
|
||||
def build_FAILED(sbo_url, prgnam):
|
||||
print("\n{0}<-- FAILED{1} to build the package {2}".format(colors.RED, colors.ENDC, prgnam))
|
||||
print("See log file in slpkg_Build directory or read README file:")
|
||||
print("{0}{1}\n".format(sbo_url, "README"))
|
||||
|
||||
def template(max):
|
||||
'''
|
||||
Print view template
|
||||
|
|
|
@ -23,18 +23,31 @@
|
|||
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import shutil
|
||||
import tarfile
|
||||
import subprocess
|
||||
|
||||
from slpkg.messages import pkg_not_found
|
||||
from slpkg.__metadata__ import log_path
|
||||
|
||||
def build_package(script, sources, path):
|
||||
'''
|
||||
Build package from source
|
||||
Build package from source and
|
||||
create log file in path /var/log/slpkg/logs/
|
||||
'''
|
||||
prgnam = script.replace(".tar.gz", "")
|
||||
log_file = ("build_{0}_log".format(prgnam))
|
||||
logs = log_path + "logs/"
|
||||
if not os.path.exists(log_path):
|
||||
os.mkdir(log_path)
|
||||
if not os.path.exists(logs):
|
||||
os.mkdir(logs)
|
||||
log_date = time.strftime("%c")
|
||||
template = ("#" * 79 + "\n\n")
|
||||
try:
|
||||
if os.path.isfile(logs + log_file):
|
||||
os.remove(logs + log_file)
|
||||
tar = tarfile.open(script)
|
||||
tar.extractall()
|
||||
tar.close()
|
||||
|
@ -42,8 +55,21 @@ def build_package(script, sources, path):
|
|||
shutil.copy2(src, prgnam)
|
||||
os.chdir(path + prgnam)
|
||||
subprocess.call("chmod +x {0}.SlackBuild".format(prgnam), shell=True)
|
||||
subprocess.call("./{0}.SlackBuild".format(prgnam), shell=True)
|
||||
os.chdir(path)
|
||||
with open(logs + log_file, "w") as log: # write headers to log file
|
||||
log.write(template)
|
||||
log.write("File : " + log_file + "\n")
|
||||
log.write("Path : " + logs + "\n")
|
||||
log.write("Date : " + log_date + "\n\n")
|
||||
log.write(template)
|
||||
log.close()
|
||||
with open(logs + log_file, "a") as log: # append END tag to a log file
|
||||
log.write(template)
|
||||
log.write(" " * 38 + "E N D\n\n")
|
||||
log.write(template)
|
||||
subprocess.Popen("./{0}.SlackBuild 2>&1 | tee -a {1}{2}".format(
|
||||
prgnam, logs, log_file), shell=True, stdout=sys.stdout).communicate()
|
||||
log.close()
|
||||
os.chdir(path)
|
||||
except (OSError, IOError):
|
||||
message = "Wrong file"
|
||||
pkg_not_found("\n", prgnam, message, "\n")
|
||||
|
|
|
@ -53,7 +53,7 @@ def pkg_upgrade(binary):
|
|||
for pkg in binary:
|
||||
try:
|
||||
print subprocess.check_output("upgradepkg --install-new {0}".format(pkg),
|
||||
shell=True)
|
||||
shell=True)
|
||||
except subprocess.CalledProcessError:
|
||||
message = "Can't upgrade"
|
||||
if len(binary) > 1:
|
||||
|
@ -69,7 +69,7 @@ def pkg_reinstall(binary):
|
|||
for pkg in binary:
|
||||
try:
|
||||
print subprocess.check_output("upgradepkg --reinstall {0}".format(pkg),
|
||||
shell=True)
|
||||
shell=True)
|
||||
except subprocess.CalledProcessError:
|
||||
message = "Can't reinstall"
|
||||
if len(binary) > 1:
|
||||
|
@ -86,7 +86,7 @@ def pkg_remove(binary):
|
|||
removed, dependencies = [], []
|
||||
rmv_list, rmv_dependencies = [], []
|
||||
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
|
||||
colors.CYAN, ', '.join(binary), colors.ENDC))
|
||||
colors.CYAN, ", ".join(binary), colors.ENDC))
|
||||
for pkg in binary:
|
||||
pkgs = find_package(pkg + sp, pkg_path)
|
||||
if pkgs:
|
||||
|
@ -175,7 +175,7 @@ def pkg_find(binary):
|
|||
for pkg in binary:
|
||||
if find_package(pkg + sp, pkg_path):
|
||||
print(colors.GREEN + "[ installed ] - " + colors.ENDC + "\n ".join(
|
||||
find_package(pkg + sp, pkg_path)))
|
||||
find_package(pkg + sp, pkg_path)))
|
||||
else:
|
||||
message = "Can't find"
|
||||
pkg_not_found("", pkg, message, "")
|
||||
|
@ -217,7 +217,7 @@ def pkg_list(pattern):
|
|||
print("{0}{1}:{2} {3}".format(colors.GREY, index, colors.ENDC, pkg))
|
||||
if index == page:
|
||||
key = raw_input("\nPress [ {0}Enter{1} ] >> Next page ".format(
|
||||
colors.CYAN, colors.ENDC))
|
||||
colors.CYAN, colors.ENDC))
|
||||
page += 50
|
||||
print # new line at end
|
||||
except KeyboardInterrupt:
|
||||
|
|
|
@ -30,13 +30,14 @@ from slpkg.pkg.build import build_package
|
|||
from slpkg.pkg.manager import pkg_upgrade
|
||||
|
||||
from slpkg.colors import colors
|
||||
from slpkg.messages import template
|
||||
from slpkg.functions import get_file
|
||||
from slpkg.messages import template, build_FAILED
|
||||
from slpkg.__metadata__ import tmp, pkg_path, build_path
|
||||
|
||||
from init import initialization
|
||||
from search import sbo_search_pkg
|
||||
from download import sbo_slackbuild_dwn
|
||||
from dependency import sbo_dependencies_pkg
|
||||
from greps import sbo_source_dwn, sbo_version_pkg
|
||||
|
||||
def sbo_check():
|
||||
|
@ -44,16 +45,19 @@ def sbo_check():
|
|||
Upgrade all slackbuilds packages from slackbuilds.org
|
||||
repository.
|
||||
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:
|
||||
sys.stdout.write("Reading package lists ...")
|
||||
sys.stdout.flush()
|
||||
initialization()
|
||||
sbo_list = []
|
||||
index, toolbar_width = 0, 3
|
||||
GREEN, RED, ENDC = colors.GREEN, colors.RED, colors.ENDC
|
||||
dependencies, dependencies_list = [], []
|
||||
requires, upgrade, installed, sbo_list = [], [], [], []
|
||||
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):
|
||||
if pkg.endswith("_SBo"):
|
||||
sbo_list.append(pkg)
|
||||
|
@ -74,37 +78,117 @@ def sbo_check():
|
|||
arch = "noarch"
|
||||
else:
|
||||
arch = os.uname()[4]
|
||||
name = pkg[:-(len(arch) + len("_SBo") + 3)]
|
||||
pkg_version = get_file(name, "-")[1:]
|
||||
name = name[:-(len(pkg_version) + 1)]
|
||||
sbo_version = sbo_version_pkg(name)
|
||||
if sbo_version > pkg_version:
|
||||
upg_name.append(name)
|
||||
pkg_for_upg.append("{0}-{1}".format(name, pkg_version))
|
||||
upg_ver.append(sbo_version)
|
||||
upg_arch.append(arch)
|
||||
package = pkg[:-(len(arch) + len("_SBo") + 3)]
|
||||
pkg_version = get_file(package, "-")[1:]
|
||||
name = package[:-(len(pkg_version) + 1)]
|
||||
if sbo_search_pkg(name):
|
||||
# search packages if exists in the repository
|
||||
# and it gets to avoidable modified packages
|
||||
# from the user with the tag _SBo
|
||||
sbo_package = ("{0}-{1}".format(name, sbo_version_pkg(name)))
|
||||
if sbo_package > package:
|
||||
upg_name.append(name)
|
||||
sys.stdout.write("Done\n")
|
||||
if upg_name:
|
||||
sys.stdout.write("Resolving dependencies ...")
|
||||
sys.stdout.flush()
|
||||
'''
|
||||
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.
|
||||
'''
|
||||
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.
|
||||
'''
|
||||
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.
|
||||
'''
|
||||
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.
|
||||
'''
|
||||
for pkg in dependencies_list:
|
||||
ver = sbo_version_pkg(pkg)
|
||||
prgnam = ("{0}-{1}".format(pkg, ver))
|
||||
pkg_version = ver # if package not installed
|
||||
# take version from repository
|
||||
if find_package(prgnam, pkg_path) == []:
|
||||
for sbo in os.listdir(pkg_path):
|
||||
if sbo.startswith(pkg + "-") and sbo.endswith("_SBo"):
|
||||
# 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]
|
||||
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:
|
||||
print("\nThese packages need upgrading:\n")
|
||||
template(78)
|
||||
print "| Package", " " * 27, "New version", " " * 5, "Arch", " " * 7, "Repository"
|
||||
template(78)
|
||||
print("Upgrading:")
|
||||
count_upgraded, count_installed = 0, 0
|
||||
for upg, ver, arch in zip(pkg_for_upg, upg_ver, upg_arch):
|
||||
print " " , RED + upg + ENDC, " " * (34-len(upg)), GREEN + ver + ENDC, \
|
||||
if find_package(upg[:-len(ver)], pkg_path):
|
||||
COLOR = colors.YELLOW
|
||||
count_upgraded += 1
|
||||
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"
|
||||
msg_pkg = "package"
|
||||
if len(pkg_for_upg) > 1:
|
||||
msg_pkg = msg_pkg + "s"
|
||||
msg_upg = "package"
|
||||
msg_ins = msg_upg
|
||||
if count_upgraded > 1:
|
||||
msg_upg = msg_upg + "s"
|
||||
if count_installed > 1:
|
||||
msg_ins = msg_ins + "s"
|
||||
print("\nInstalling summary")
|
||||
print("=" * 79)
|
||||
print("Total {0} {1} will be upgraded.\n".format(len(pkg_for_upg), msg_pkg))
|
||||
print("Total {0} {1} will be upgraded and {2} {3} will be installed.\n".format(
|
||||
count_upgraded, msg_upg, count_installed, msg_ins))
|
||||
read = raw_input("Would you like to upgrade [Y/n]? ")
|
||||
if read == "Y" or read == "y":
|
||||
if not os.path.exists(build_path):
|
||||
os.mkdir(build_path)
|
||||
os.chdir(build_path)
|
||||
for name, version, arch in zip(upg_name, upg_ver, upg_arch):
|
||||
for name, version in zip(upgrade, upg_ver):
|
||||
prgnam = ("{0}-{1}".format(name, version))
|
||||
sbo_url = sbo_search_pkg(name)
|
||||
sbo_dwn = sbo_slackbuild_dwn(sbo_url)
|
||||
|
@ -117,7 +201,6 @@ def sbo_check():
|
|||
subprocess.call("wget -N {0}".format(src), shell=True)
|
||||
sources.append(get_file(src, "/"))
|
||||
build_package(script, sources, build_path)
|
||||
print("{0}[ Upgrading ] --> {1}{2}".format(GREEN, ENDC, name))
|
||||
'''
|
||||
Searches the package name and version in /tmp to install.
|
||||
If find two or more packages e.g. to build tag
|
||||
|
@ -127,21 +210,36 @@ def sbo_check():
|
|||
for search in find_package(prgnam, tmp):
|
||||
if "_SBo" in search:
|
||||
binary_list.append(search)
|
||||
binary = (tmp + max(binary_list)).split()
|
||||
try:
|
||||
binary = (tmp + max(binary_list)).split()
|
||||
except ValueError:
|
||||
build_FAILED(sbo_url, prgnam)
|
||||
sys.exit()
|
||||
if find_package(name, pkg_path):
|
||||
print("{0}[ Upgrading ] --> {1}{2}".format(GREEN, ENDC, name))
|
||||
else:
|
||||
print("{0}[ Installing ] --> {1}{2}".format(GREEN, ENDC, name))
|
||||
# Use this list to pick out what
|
||||
# packages will be installed
|
||||
installed.append(name)
|
||||
pkg_upgrade(binary)
|
||||
print("Complete!\n")
|
||||
if len(pkg_for_upg) > 1:
|
||||
template(78)
|
||||
print("| Total {0} {1} upgraded".format(len(pkg_for_upg), msg_pkg))
|
||||
print("| Total {0} {1} upgraded and {2} {3} installed".format(
|
||||
count_upgraded, msg_upg, count_installed, msg_ins))
|
||||
template(78)
|
||||
for pkg, upg, ver in zip(pkg_for_upg, upg_name, upg_ver):
|
||||
for pkg, upg, ver in zip(pkg_for_upg, upgrade, upg_ver):
|
||||
upgraded = ("{0}-{1}".format(upg, ver))
|
||||
if find_package(upgraded, pkg_path):
|
||||
print("| Package {0} upgraded with new package {1}-{2}".format(
|
||||
pkg, upg, ver))
|
||||
if upg in installed:
|
||||
print("| Package {0} installed".format(pkg))
|
||||
else:
|
||||
print("| Package {0} upgraded with new package {1}-{2}".format(
|
||||
pkg, upg, ver))
|
||||
template(78)
|
||||
else:
|
||||
print("\nTotal {0} SBo packages are up to date:\n".format(len(sbo_list)))
|
||||
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")
|
||||
|
|
|
@ -25,7 +25,6 @@ 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):
|
||||
|
|
|
@ -27,8 +27,8 @@ import subprocess
|
|||
|
||||
from slpkg.colors import colors
|
||||
from slpkg.functions import get_file
|
||||
from slpkg.messages import pkg_not_found, pkg_found, template
|
||||
from slpkg.__metadata__ import tmp, pkg_path, build_path, log_path, sp
|
||||
from slpkg.messages import pkg_not_found, pkg_found, template, build_FAILED
|
||||
|
||||
from slpkg.pkg.find import find_package
|
||||
from slpkg.pkg.build import build_package
|
||||
|
@ -52,10 +52,10 @@ def sbo_build(name):
|
|||
dependencies_list = sbo_dependencies_pkg(name)
|
||||
try:
|
||||
if dependencies_list is not None:
|
||||
pkg_sum = 0
|
||||
pkg_sum, count_upgraded, count_installed = 0, 0, 0
|
||||
arch = os.uname()[4]
|
||||
sbo_ver, pkg_arch = [], []
|
||||
installs, versions = [], []
|
||||
installs, upgraded, versions = [], [], []
|
||||
requires, dependencies = [], []
|
||||
PKG_COLOR, DEP_COLOR, ARCH_COLOR = "", "", ""
|
||||
ENDC = colors.ENDC
|
||||
|
@ -101,7 +101,6 @@ def sbo_build(name):
|
|||
sbo_pkg = ("{0}-{1}".format(pkg, version))
|
||||
if find_package(sbo_pkg, pkg_path):
|
||||
pkg_sum += 1
|
||||
|
||||
sys.stdout.write("Done\n")
|
||||
'''
|
||||
Tag with color green if package already installed
|
||||
|
@ -112,8 +111,12 @@ def sbo_build(name):
|
|||
master_pkg = ("{0}-{1}".format(name, sbo_ver[-1]))
|
||||
if find_package(master_pkg, pkg_path):
|
||||
PKG_COLOR = colors.GREEN
|
||||
elif find_package(name + sp, pkg_path):
|
||||
PKG_COLOR = colors.YELLOW
|
||||
count_upgraded += 1
|
||||
else:
|
||||
PKG_COLOR = colors.RED
|
||||
count_installed += 1
|
||||
if "UNSUPPORTED" in pkg_arch[-1]:
|
||||
ARCH_COLOR = colors.RED
|
||||
elif "UNTESTED" in pkg_arch[-1]:
|
||||
|
@ -134,8 +137,12 @@ def sbo_build(name):
|
|||
dep_pkg = ("{0}-{1}".format(dep, ver))
|
||||
if find_package(dep_pkg, pkg_path):
|
||||
DEP_COLOR = colors.GREEN
|
||||
elif find_package(dep + sp, pkg_path):
|
||||
DEP_COLOR = colors.YELLOW
|
||||
count_upgraded += 1
|
||||
else:
|
||||
DEP_COLOR = colors.RED
|
||||
count_installed += 1
|
||||
if "UNSUPPORTED" in dep_arch:
|
||||
ARCH_COLOR = colors.RED
|
||||
elif "UNTESTED" in dep_arch:
|
||||
|
@ -144,17 +151,18 @@ def sbo_build(name):
|
|||
" " * (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:
|
||||
msg_pkg = msg_pkg + "s"
|
||||
if len(dependencies) - pkg_sum > 1:
|
||||
msg_2_pkg = msg_2_pkg + "s"
|
||||
msg_ins = "package"
|
||||
msg_upg = msg_ins
|
||||
if count_installed > 1:
|
||||
msg_ins = msg_ins + "s"
|
||||
if msg_upg > 1:
|
||||
msg_upg = msg_upg + "s"
|
||||
print("\nInstalling summary")
|
||||
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))
|
||||
print("Total {0} {1}.".format(len(dependencies), msg_ins))
|
||||
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.")
|
||||
'''
|
||||
Check if package supported by arch
|
||||
before proceed to install
|
||||
|
@ -170,11 +178,15 @@ def sbo_build(name):
|
|||
if not os.path.exists(build_path):
|
||||
os.mkdir(build_path)
|
||||
os.chdir(build_path)
|
||||
for pkg, ver in zip(dependencies, sbo_ver):
|
||||
sbo_file = "".join(find_package(pkg, pkg_path))
|
||||
sbo_file_version = sbo_file[len(pkg) + 1:-len(arch) - 7]
|
||||
if ver > sbo_file_version:
|
||||
prgnam = ("{0}-{1}".format(pkg, ver))
|
||||
for pkg, ver, ar in zip(dependencies, sbo_ver, pkg_arch):
|
||||
prgnam = ("{0}-{1}".format(pkg, ver))
|
||||
sbo_file = "".join(find_package(prgnam, pkg_path))
|
||||
if sbo_file:
|
||||
sbo_file_version = sbo_file[len(pkg) + 1:-len(ar) - 7]
|
||||
template(78)
|
||||
pkg_found(pkg, sbo_file_version)
|
||||
template(78)
|
||||
else:
|
||||
sbo_url = sbo_search_pkg(pkg)
|
||||
sbo_link = sbo_slackbuild_dwn(sbo_url)
|
||||
src_link = sbo_source_dwn(pkg).split()
|
||||
|
@ -186,8 +198,6 @@ def sbo_build(name):
|
|||
subprocess.call("wget -N {0}".format(src), shell=True)
|
||||
sources.append(get_file(src, "/"))
|
||||
build_package(script, sources, build_path)
|
||||
print("{0}[ Installing ] --> {1}{2}".format(
|
||||
colors.GREEN, ENDC, pkg))
|
||||
'''
|
||||
Searches the package name and version in /tmp to install.
|
||||
If find two or more packages e.g. to build tag
|
||||
|
@ -197,26 +207,38 @@ def sbo_build(name):
|
|||
for search in find_package(prgnam, tmp):
|
||||
if "_SBo" in search:
|
||||
binary_list.append(search)
|
||||
binary = (tmp + max(binary_list)).split()
|
||||
try:
|
||||
binary = (tmp + max(binary_list)).split()
|
||||
except ValueError:
|
||||
build_FAILED(sbo_url, prgnam)
|
||||
sys.exit()
|
||||
if find_package(pkg, pkg_path):
|
||||
print("{0}[ Upgrading ] --> {1}{2}".format(
|
||||
colors.GREEN, ENDC, pkg))
|
||||
upgraded.append(pkg)
|
||||
else:
|
||||
print("{0}[ Installing ] --> {1}{2}".format(
|
||||
colors.GREEN, ENDC, pkg))
|
||||
pkg_upgrade(binary)
|
||||
print("Complete!\n")
|
||||
installs.append(pkg)
|
||||
versions.append(ver)
|
||||
else:
|
||||
template(78)
|
||||
pkg_found(pkg, sbo_file_version)
|
||||
template(78)
|
||||
'''
|
||||
Reference list only packages installed
|
||||
Reference list with packages installed
|
||||
and upgraded.
|
||||
'''
|
||||
if len(installs) > 1:
|
||||
template(78)
|
||||
print("| Total {0} packages installed".format(len(installs)))
|
||||
print("| Total {0} {1} installed and {2} {3} upgraded".format(
|
||||
count_installed, msg_ins, count_upgraded, msg_upg))
|
||||
template(78)
|
||||
for pkg, ver in zip(installs, versions):
|
||||
installed = ("{0}-{1}".format(pkg, ver))
|
||||
if find_package(installed, pkg_path):
|
||||
print("| Package {0} installed successfully".format(installed))
|
||||
if pkg in upgraded:
|
||||
print("| Package {0} upgraded successfully".format(installed))
|
||||
else:
|
||||
print("| Package {0} installed successfully".format(installed))
|
||||
else:
|
||||
print("| Package {0} NOT installed".format(installed))
|
||||
template(78)
|
||||
|
|
|
@ -27,8 +27,8 @@ import subprocess
|
|||
|
||||
from slpkg.colors import colors
|
||||
from slpkg.functions import get_file
|
||||
from slpkg.messages import pkg_not_found, pkg_found, view_sbo, template
|
||||
from slpkg.__metadata__ import tmp, build_path, pkg_path, slpkg_tmp, sp
|
||||
from slpkg.messages import pkg_not_found, pkg_found, view_sbo, template, build_FAILED
|
||||
|
||||
from slpkg.pkg.build import build_package
|
||||
from slpkg.pkg.find import find_package
|
||||
|
@ -131,7 +131,6 @@ def sbo_network(name):
|
|||
subprocess.call("wget -N {0}".format(src), shell=True)
|
||||
sources.append(get_file(src, "/"))
|
||||
build_package(script, sources, build_path)
|
||||
print("{0}[ Installing ] --> {1}{2}".format(colors.GREEN, colors.ENDC, name))
|
||||
'''
|
||||
Searches the package name and version in /tmp to install.
|
||||
If find two or more packages e.g. to build tag
|
||||
|
@ -141,7 +140,12 @@ def sbo_network(name):
|
|||
for search in find_package(prgnam, tmp):
|
||||
if "_SBo" in search:
|
||||
binary_list.append(search)
|
||||
binary = (tmp + max(binary_list)).split()
|
||||
try:
|
||||
binary = (tmp + max(binary_list)).split()
|
||||
except ValueError:
|
||||
build_FAILED(sbo_url, prgnam)
|
||||
sys.exit()
|
||||
print("{0}[ Installing ] --> {1}{2}".format(colors.GREEN, colors.ENDC, name))
|
||||
pkg_upgrade(binary)
|
||||
print("Complete!\n")
|
||||
break
|
||||
|
|
|
@ -30,7 +30,7 @@ from slpkg.colors import colors
|
|||
from slpkg.url_read import url_read
|
||||
from slpkg.messages import template
|
||||
from slpkg.__metadata__ import (pkg_path, slpkg_tmp,
|
||||
slack_archs)
|
||||
slack_archs)
|
||||
|
||||
from slpkg.pkg.manager import pkg_upgrade
|
||||
|
||||
|
|
Loading…
Reference in a new issue