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
|
Version 1.8.1
|
||||||
04-09-2014
|
04-09-2014
|
||||||
|
|
||||||
|
|
2
PKG-INFO
2
PKG-INFO
|
@ -1,6 +1,6 @@
|
||||||
Metadata-Version: 1.1
|
Metadata-Version: 1.1
|
||||||
Name: slpkg
|
Name: slpkg
|
||||||
Version: 1.8.1
|
Version: 1.8.2
|
||||||
Author: dslackw
|
Author: dslackw
|
||||||
Author-email: d zlatanidis at gmail com
|
Author-email: d zlatanidis at gmail com
|
||||||
Maintainer: dslackw
|
Maintainer: dslackw
|
||||||
|
|
42
README.rst
42
README.rst
|
@ -7,8 +7,12 @@
|
||||||
.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/logo.png
|
.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/logo.png
|
||||||
:target: https://github.com/dslackw/slpkg
|
: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/>`_
|
`Slpkg <https://github.com/dslackw/slpkg>`_ is a terminal multitool in order to easy use `Slackware <http://www.slackware.com/>`_
|
||||||
packages.
|
packages.
|
||||||
|
@ -72,8 +76,6 @@ Features
|
||||||
It's a quick and easy way to manage your packages in `Slackware <http://www.slackware.com/>`_
|
It's a quick and easy way to manage your packages in `Slackware <http://www.slackware.com/>`_
|
||||||
to a command.
|
to a command.
|
||||||
|
|
||||||
`[CHANGELOG] <https://github.com/dslackw/slpkg/blob/master/CHANGELOG>`_
|
|
||||||
|
|
||||||
Video Tutorial
|
Video Tutorial
|
||||||
==============
|
==============
|
||||||
|
|
||||||
|
@ -87,8 +89,8 @@ Untar the archive and run install.sh script:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ tar xvf slpkg-1.8.1.tar.gz
|
$ tar xvf slpkg-1.8.2.tar.gz
|
||||||
$ cd slpkg-1.8.1
|
$ cd slpkg-1.8.2
|
||||||
$ ./install.sh
|
$ ./install.sh
|
||||||
|
|
||||||
Using `pip <https://pip.pypa.io/en/latest/>`_ :
|
Using `pip <https://pip.pypa.io/en/latest/>`_ :
|
||||||
|
@ -151,7 +153,8 @@ build and install with all dependencies :
|
||||||
$ slpkg -s sbo brasero
|
$ slpkg -s sbo brasero
|
||||||
Building dependency tree...... Done
|
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
|
| Package Version Arch Repository
|
||||||
|
@ -168,29 +171,10 @@ build and install with all dependencies :
|
||||||
Installing summary
|
Installing summary
|
||||||
===============================================================================
|
===============================================================================
|
||||||
Total 6 packages.
|
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
|
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/>`_
|
Find packages from `Slackware official mirrors <http://mirrors.slackware.com/>`_
|
||||||
download and install:
|
download and install:
|
||||||
|
@ -269,7 +253,7 @@ Check if your packages is up to date from slackbuilds.org:
|
||||||
|
|
||||||
Installing summary
|
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]?
|
Would you like to upgrade [Y/n]?
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
PRGNAM=slpkg
|
PRGNAM=slpkg
|
||||||
VERSION=${VERSION:-1.8.1}
|
VERSION=${VERSION:-1.8.2}
|
||||||
TAG=${TAG:-_dsw}
|
TAG=${TAG:-_dsw}
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
|
@ -170,7 +170,8 @@ $ \fBslpkg -s sbo brasero\fP
|
||||||
Installing summary
|
Installing summary
|
||||||
===============================================================================
|
===============================================================================
|
||||||
Total 6 packages.
|
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
|
Do you want to continue [Y/n]? y
|
||||||
.
|
.
|
||||||
|
@ -215,7 +216,7 @@ $ \fBslpkg -c sbo upgrade\fP
|
||||||
|
|
||||||
Installing summary
|
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]?
|
Would you like to upgrade [Y/n]?
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
PRGNAM=slpkg
|
PRGNAM=slpkg
|
||||||
VERSION=${VERSION:-1.8.1}
|
VERSION=${VERSION:-1.8.2}
|
||||||
BUILD=${BUILD:-1}
|
BUILD=${BUILD:-1}
|
||||||
TAG=${TAG:-_dsw}
|
TAG=${TAG:-_dsw}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
PRGNAM="slpkg"
|
PRGNAM="slpkg"
|
||||||
VERSION="1.8.1"
|
VERSION="1.8.2"
|
||||||
HOMEPAGE="https://github.com/dslackw/slpkg"
|
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=""
|
MD5SUM=""
|
||||||
DOWNLOAD_x86_64=""
|
DOWNLOAD_x86_64=""
|
||||||
MD5SUM_x86_64=""
|
MD5SUM_x86_64=""
|
||||||
|
|
|
@ -26,7 +26,7 @@ import subprocess
|
||||||
|
|
||||||
__all__ = "slpkg"
|
__all__ = "slpkg"
|
||||||
__author__ = "dslackw"
|
__author__ = "dslackw"
|
||||||
__version_info__ = (1, 8, 1)
|
__version_info__ = (1, 8, 2)
|
||||||
__version__ = "{0}.{1}.{2}".format(*__version_info__)
|
__version__ = "{0}.{1}.{2}".format(*__version_info__)
|
||||||
__license__ = "GNU General Public License v3 (GPLv3)"
|
__license__ = "GNU General Public License v3 (GPLv3)"
|
||||||
__email__ = "d.zlatanidis@gmail.com"
|
__email__ = "d.zlatanidis@gmail.com"
|
||||||
|
|
|
@ -74,6 +74,11 @@ def s_user(user):
|
||||||
print("\nError: must have root privileges\n")
|
print("\nError: must have root privileges\n")
|
||||||
sys.exit()
|
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):
|
def template(max):
|
||||||
'''
|
'''
|
||||||
Print view template
|
Print view template
|
||||||
|
|
|
@ -23,18 +23,31 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
import shutil
|
import shutil
|
||||||
import tarfile
|
import tarfile
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from slpkg.messages import pkg_not_found
|
from slpkg.messages import pkg_not_found
|
||||||
|
from slpkg.__metadata__ import log_path
|
||||||
|
|
||||||
def build_package(script, sources, 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", "")
|
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:
|
try:
|
||||||
|
if os.path.isfile(logs + log_file):
|
||||||
|
os.remove(logs + log_file)
|
||||||
tar = tarfile.open(script)
|
tar = tarfile.open(script)
|
||||||
tar.extractall()
|
tar.extractall()
|
||||||
tar.close()
|
tar.close()
|
||||||
|
@ -42,8 +55,21 @@ def build_package(script, sources, path):
|
||||||
shutil.copy2(src, prgnam)
|
shutil.copy2(src, prgnam)
|
||||||
os.chdir(path + prgnam)
|
os.chdir(path + prgnam)
|
||||||
subprocess.call("chmod +x {0}.SlackBuild".format(prgnam), shell=True)
|
subprocess.call("chmod +x {0}.SlackBuild".format(prgnam), shell=True)
|
||||||
subprocess.call("./{0}.SlackBuild".format(prgnam), shell=True)
|
with open(logs + log_file, "w") as log: # write headers to log file
|
||||||
os.chdir(path)
|
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):
|
except (OSError, IOError):
|
||||||
message = "Wrong file"
|
message = "Wrong file"
|
||||||
pkg_not_found("\n", prgnam, message, "\n")
|
pkg_not_found("\n", prgnam, message, "\n")
|
||||||
|
|
|
@ -53,7 +53,7 @@ def pkg_upgrade(binary):
|
||||||
for pkg in binary:
|
for pkg in binary:
|
||||||
try:
|
try:
|
||||||
print subprocess.check_output("upgradepkg --install-new {0}".format(pkg),
|
print subprocess.check_output("upgradepkg --install-new {0}".format(pkg),
|
||||||
shell=True)
|
shell=True)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
message = "Can't upgrade"
|
message = "Can't upgrade"
|
||||||
if len(binary) > 1:
|
if len(binary) > 1:
|
||||||
|
@ -69,7 +69,7 @@ def pkg_reinstall(binary):
|
||||||
for pkg in binary:
|
for pkg in binary:
|
||||||
try:
|
try:
|
||||||
print subprocess.check_output("upgradepkg --reinstall {0}".format(pkg),
|
print subprocess.check_output("upgradepkg --reinstall {0}".format(pkg),
|
||||||
shell=True)
|
shell=True)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
message = "Can't reinstall"
|
message = "Can't reinstall"
|
||||||
if len(binary) > 1:
|
if len(binary) > 1:
|
||||||
|
@ -86,7 +86,7 @@ def pkg_remove(binary):
|
||||||
removed, dependencies = [], []
|
removed, dependencies = [], []
|
||||||
rmv_list, rmv_dependencies = [], []
|
rmv_list, rmv_dependencies = [], []
|
||||||
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
|
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:
|
for pkg in binary:
|
||||||
pkgs = find_package(pkg + sp, pkg_path)
|
pkgs = find_package(pkg + sp, pkg_path)
|
||||||
if pkgs:
|
if pkgs:
|
||||||
|
@ -175,7 +175,7 @@ def pkg_find(binary):
|
||||||
for pkg in binary:
|
for pkg in binary:
|
||||||
if find_package(pkg + sp, pkg_path):
|
if find_package(pkg + sp, pkg_path):
|
||||||
print(colors.GREEN + "[ installed ] - " + colors.ENDC + "\n ".join(
|
print(colors.GREEN + "[ installed ] - " + colors.ENDC + "\n ".join(
|
||||||
find_package(pkg + sp, pkg_path)))
|
find_package(pkg + sp, pkg_path)))
|
||||||
else:
|
else:
|
||||||
message = "Can't find"
|
message = "Can't find"
|
||||||
pkg_not_found("", pkg, message, "")
|
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))
|
print("{0}{1}:{2} {3}".format(colors.GREY, index, colors.ENDC, pkg))
|
||||||
if index == page:
|
if index == page:
|
||||||
key = raw_input("\nPress [ {0}Enter{1} ] >> Next page ".format(
|
key = raw_input("\nPress [ {0}Enter{1} ] >> Next page ".format(
|
||||||
colors.CYAN, colors.ENDC))
|
colors.CYAN, colors.ENDC))
|
||||||
page += 50
|
page += 50
|
||||||
print # new line at end
|
print # new line at end
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
|
|
@ -30,13 +30,14 @@ from slpkg.pkg.build import build_package
|
||||||
from slpkg.pkg.manager import pkg_upgrade
|
from slpkg.pkg.manager import pkg_upgrade
|
||||||
|
|
||||||
from slpkg.colors import colors
|
from slpkg.colors import colors
|
||||||
from slpkg.messages import template
|
|
||||||
from slpkg.functions import get_file
|
from slpkg.functions import get_file
|
||||||
|
from slpkg.messages import template, build_FAILED
|
||||||
from slpkg.__metadata__ import tmp, pkg_path, build_path
|
from slpkg.__metadata__ import tmp, pkg_path, build_path
|
||||||
|
|
||||||
from init import initialization
|
from init import initialization
|
||||||
from search import sbo_search_pkg
|
from search import sbo_search_pkg
|
||||||
from download import sbo_slackbuild_dwn
|
from download import sbo_slackbuild_dwn
|
||||||
|
from dependency import sbo_dependencies_pkg
|
||||||
from greps import sbo_source_dwn, sbo_version_pkg
|
from greps import sbo_source_dwn, sbo_version_pkg
|
||||||
|
|
||||||
def sbo_check():
|
def sbo_check():
|
||||||
|
@ -44,16 +45,19 @@ def sbo_check():
|
||||||
Upgrade all slackbuilds packages from slackbuilds.org
|
Upgrade all slackbuilds packages from slackbuilds.org
|
||||||
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()
|
||||||
sbo_list = []
|
|
||||||
index, toolbar_width = 0, 3
|
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 = [], [], [], []
|
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)
|
||||||
|
@ -74,37 +78,117 @@ def sbo_check():
|
||||||
arch = "noarch"
|
arch = "noarch"
|
||||||
else:
|
else:
|
||||||
arch = os.uname()[4]
|
arch = os.uname()[4]
|
||||||
name = pkg[:-(len(arch) + len("_SBo") + 3)]
|
package = pkg[:-(len(arch) + len("_SBo") + 3)]
|
||||||
pkg_version = get_file(name, "-")[1:]
|
pkg_version = get_file(package, "-")[1:]
|
||||||
name = name[:-(len(pkg_version) + 1)]
|
name = package[:-(len(pkg_version) + 1)]
|
||||||
sbo_version = sbo_version_pkg(name)
|
if sbo_search_pkg(name):
|
||||||
if sbo_version > pkg_version:
|
# search packages if exists in the repository
|
||||||
upg_name.append(name)
|
# and it gets to avoidable modified packages
|
||||||
pkg_for_upg.append("{0}-{1}".format(name, pkg_version))
|
# from the user with the tag _SBo
|
||||||
upg_ver.append(sbo_version)
|
sbo_package = ("{0}-{1}".format(name, sbo_version_pkg(name)))
|
||||||
upg_arch.append(arch)
|
if sbo_package > package:
|
||||||
|
upg_name.append(name)
|
||||||
sys.stdout.write("Done\n")
|
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:
|
if pkg_for_upg:
|
||||||
print("\nThese packages need upgrading:\n")
|
print("\nThese packages need upgrading:\n")
|
||||||
template(78)
|
template(78)
|
||||||
print "| Package", " " * 27, "New version", " " * 5, "Arch", " " * 7, "Repository"
|
print "| Package", " " * 27, "New version", " " * 5, "Arch", " " * 7, "Repository"
|
||||||
template(78)
|
template(78)
|
||||||
print("Upgrading:")
|
print("Upgrading:")
|
||||||
|
count_upgraded, count_installed = 0, 0
|
||||||
for upg, ver, arch in zip(pkg_for_upg, upg_ver, upg_arch):
|
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"
|
" " * (16-len(ver)), arch, " " * (11-len(arch)), "SBo"
|
||||||
msg_pkg = "package"
|
msg_upg = "package"
|
||||||
if len(pkg_for_upg) > 1:
|
msg_ins = msg_upg
|
||||||
msg_pkg = msg_pkg + "s"
|
if count_upgraded > 1:
|
||||||
|
msg_upg = msg_upg + "s"
|
||||||
|
if count_installed > 1:
|
||||||
|
msg_ins = msg_ins + "s"
|
||||||
print("\nInstalling summary")
|
print("\nInstalling summary")
|
||||||
print("=" * 79)
|
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]? ")
|
read = raw_input("Would you like to upgrade [Y/n]? ")
|
||||||
if read == "Y" or read == "y":
|
if read == "Y" or read == "y":
|
||||||
if not os.path.exists(build_path):
|
if not os.path.exists(build_path):
|
||||||
os.mkdir(build_path)
|
os.mkdir(build_path)
|
||||||
os.chdir(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))
|
prgnam = ("{0}-{1}".format(name, version))
|
||||||
sbo_url = sbo_search_pkg(name)
|
sbo_url = sbo_search_pkg(name)
|
||||||
sbo_dwn = sbo_slackbuild_dwn(sbo_url)
|
sbo_dwn = sbo_slackbuild_dwn(sbo_url)
|
||||||
|
@ -117,7 +201,6 @@ def sbo_check():
|
||||||
subprocess.call("wget -N {0}".format(src), shell=True)
|
subprocess.call("wget -N {0}".format(src), shell=True)
|
||||||
sources.append(get_file(src, "/"))
|
sources.append(get_file(src, "/"))
|
||||||
build_package(script, sources, build_path)
|
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.
|
Searches the package name and version in /tmp to install.
|
||||||
If find two or more packages e.g. to build tag
|
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):
|
for search in find_package(prgnam, tmp):
|
||||||
if "_SBo" in search:
|
if "_SBo" in search:
|
||||||
binary_list.append(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)
|
pkg_upgrade(binary)
|
||||||
print("Complete!\n")
|
print("Complete!\n")
|
||||||
if len(pkg_for_upg) > 1:
|
if len(pkg_for_upg) > 1:
|
||||||
template(78)
|
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)
|
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))
|
upgraded = ("{0}-{1}".format(upg, ver))
|
||||||
if find_package(upgraded, pkg_path):
|
if find_package(upgraded, pkg_path):
|
||||||
print("| Package {0} upgraded with new package {1}-{2}".format(
|
if upg in installed:
|
||||||
pkg, upg, ver))
|
print("| Package {0} installed".format(pkg))
|
||||||
|
else:
|
||||||
|
print("| Package {0} upgraded with new package {1}-{2}".format(
|
||||||
|
pkg, upg, ver))
|
||||||
template(78)
|
template(78)
|
||||||
else:
|
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:
|
else:
|
||||||
sys.stdout.write("Done\n")
|
sys.stdout.write("Done\n")
|
||||||
print("\nNo SBo packages found\n")
|
print("\nNo SBo packages found\n")
|
||||||
|
|
|
@ -25,7 +25,6 @@ import os
|
||||||
|
|
||||||
from slpkg.url_read import url_read
|
from slpkg.url_read import url_read
|
||||||
from slpkg.__metadata__ import arch, lib_path
|
from slpkg.__metadata__ import arch, lib_path
|
||||||
|
|
||||||
from search import sbo_search_pkg
|
from search import sbo_search_pkg
|
||||||
|
|
||||||
def sbo_source_dwn(name):
|
def sbo_source_dwn(name):
|
||||||
|
|
|
@ -27,8 +27,8 @@ import subprocess
|
||||||
|
|
||||||
from slpkg.colors import colors
|
from slpkg.colors import colors
|
||||||
from slpkg.functions import get_file
|
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.__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.find import find_package
|
||||||
from slpkg.pkg.build import build_package
|
from slpkg.pkg.build import build_package
|
||||||
|
@ -52,10 +52,10 @@ def sbo_build(name):
|
||||||
dependencies_list = sbo_dependencies_pkg(name)
|
dependencies_list = sbo_dependencies_pkg(name)
|
||||||
try:
|
try:
|
||||||
if dependencies_list is not None:
|
if dependencies_list is not None:
|
||||||
pkg_sum = 0
|
pkg_sum, count_upgraded, count_installed = 0, 0, 0
|
||||||
arch = os.uname()[4]
|
arch = os.uname()[4]
|
||||||
sbo_ver, pkg_arch = [], []
|
sbo_ver, pkg_arch = [], []
|
||||||
installs, versions = [], []
|
installs, upgraded, versions = [], [], []
|
||||||
requires, dependencies = [], []
|
requires, dependencies = [], []
|
||||||
PKG_COLOR, DEP_COLOR, ARCH_COLOR = "", "", ""
|
PKG_COLOR, DEP_COLOR, ARCH_COLOR = "", "", ""
|
||||||
ENDC = colors.ENDC
|
ENDC = colors.ENDC
|
||||||
|
@ -101,7 +101,6 @@ def sbo_build(name):
|
||||||
sbo_pkg = ("{0}-{1}".format(pkg, version))
|
sbo_pkg = ("{0}-{1}".format(pkg, version))
|
||||||
if find_package(sbo_pkg, pkg_path):
|
if find_package(sbo_pkg, pkg_path):
|
||||||
pkg_sum += 1
|
pkg_sum += 1
|
||||||
|
|
||||||
sys.stdout.write("Done\n")
|
sys.stdout.write("Done\n")
|
||||||
'''
|
'''
|
||||||
Tag with color green if package already installed
|
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]))
|
master_pkg = ("{0}-{1}".format(name, sbo_ver[-1]))
|
||||||
if find_package(master_pkg, pkg_path):
|
if find_package(master_pkg, pkg_path):
|
||||||
PKG_COLOR = colors.GREEN
|
PKG_COLOR = colors.GREEN
|
||||||
|
elif find_package(name + sp, pkg_path):
|
||||||
|
PKG_COLOR = colors.YELLOW
|
||||||
|
count_upgraded += 1
|
||||||
else:
|
else:
|
||||||
PKG_COLOR = colors.RED
|
PKG_COLOR = colors.RED
|
||||||
|
count_installed += 1
|
||||||
if "UNSUPPORTED" in pkg_arch[-1]:
|
if "UNSUPPORTED" in pkg_arch[-1]:
|
||||||
ARCH_COLOR = colors.RED
|
ARCH_COLOR = colors.RED
|
||||||
elif "UNTESTED" in pkg_arch[-1]:
|
elif "UNTESTED" in pkg_arch[-1]:
|
||||||
|
@ -134,8 +137,12 @@ def sbo_build(name):
|
||||||
dep_pkg = ("{0}-{1}".format(dep, ver))
|
dep_pkg = ("{0}-{1}".format(dep, ver))
|
||||||
if find_package(dep_pkg, pkg_path):
|
if find_package(dep_pkg, pkg_path):
|
||||||
DEP_COLOR = colors.GREEN
|
DEP_COLOR = colors.GREEN
|
||||||
|
elif find_package(dep + sp, pkg_path):
|
||||||
|
DEP_COLOR = colors.YELLOW
|
||||||
|
count_upgraded += 1
|
||||||
else:
|
else:
|
||||||
DEP_COLOR = colors.RED
|
DEP_COLOR = colors.RED
|
||||||
|
count_installed += 1
|
||||||
if "UNSUPPORTED" in dep_arch:
|
if "UNSUPPORTED" in dep_arch:
|
||||||
ARCH_COLOR = colors.RED
|
ARCH_COLOR = colors.RED
|
||||||
elif "UNTESTED" in dep_arch:
|
elif "UNTESTED" in dep_arch:
|
||||||
|
@ -144,17 +151,18 @@ def sbo_build(name):
|
||||||
" " * (38-len(dep)), ver, \
|
" " * (38-len(dep)), ver, \
|
||||||
" " * (14-len(ver)), ARCH_COLOR + dep_arch + ENDC, \
|
" " * (14-len(ver)), ARCH_COLOR + dep_arch + ENDC, \
|
||||||
" " * (9-len(dep_arch)), "SBo"
|
" " * (9-len(dep_arch)), "SBo"
|
||||||
msg_pkg = "package"
|
msg_ins = "package"
|
||||||
msg_2_pkg = msg_pkg
|
msg_upg = msg_ins
|
||||||
if len(dependencies) > 1:
|
if count_installed > 1:
|
||||||
msg_pkg = msg_pkg + "s"
|
msg_ins = msg_ins + "s"
|
||||||
if len(dependencies) - pkg_sum > 1:
|
if msg_upg > 1:
|
||||||
msg_2_pkg = msg_2_pkg + "s"
|
msg_upg = msg_upg + "s"
|
||||||
print("\nInstalling summary")
|
print("\nInstalling summary")
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
print("Total {0} {1}.".format(len(dependencies), msg_pkg))
|
print("Total {0} {1}.".format(len(dependencies), msg_ins))
|
||||||
print("{0} {1} will be installed, {2} allready installed.".format(
|
print("{0} {1} will be installed, {2} allready installed and {3} {4}".format(
|
||||||
(len(dependencies) - pkg_sum), msg_2_pkg, pkg_sum))
|
count_installed, msg_ins, pkg_sum, count_upgraded, msg_upg))
|
||||||
|
print("will be upgraded.")
|
||||||
'''
|
'''
|
||||||
Check if package supported by arch
|
Check if package supported by arch
|
||||||
before proceed to install
|
before proceed to install
|
||||||
|
@ -170,11 +178,15 @@ def sbo_build(name):
|
||||||
if not os.path.exists(build_path):
|
if not os.path.exists(build_path):
|
||||||
os.mkdir(build_path)
|
os.mkdir(build_path)
|
||||||
os.chdir(build_path)
|
os.chdir(build_path)
|
||||||
for pkg, ver in zip(dependencies, sbo_ver):
|
for pkg, ver, ar in zip(dependencies, sbo_ver, pkg_arch):
|
||||||
sbo_file = "".join(find_package(pkg, pkg_path))
|
prgnam = ("{0}-{1}".format(pkg, ver))
|
||||||
sbo_file_version = sbo_file[len(pkg) + 1:-len(arch) - 7]
|
sbo_file = "".join(find_package(prgnam, pkg_path))
|
||||||
if ver > sbo_file_version:
|
if sbo_file:
|
||||||
prgnam = ("{0}-{1}".format(pkg, ver))
|
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_url = sbo_search_pkg(pkg)
|
||||||
sbo_link = sbo_slackbuild_dwn(sbo_url)
|
sbo_link = sbo_slackbuild_dwn(sbo_url)
|
||||||
src_link = sbo_source_dwn(pkg).split()
|
src_link = sbo_source_dwn(pkg).split()
|
||||||
|
@ -186,8 +198,6 @@ def sbo_build(name):
|
||||||
subprocess.call("wget -N {0}".format(src), shell=True)
|
subprocess.call("wget -N {0}".format(src), shell=True)
|
||||||
sources.append(get_file(src, "/"))
|
sources.append(get_file(src, "/"))
|
||||||
build_package(script, sources, build_path)
|
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.
|
Searches the package name and version in /tmp to install.
|
||||||
If find two or more packages e.g. to build tag
|
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):
|
for search in find_package(prgnam, tmp):
|
||||||
if "_SBo" in search:
|
if "_SBo" in search:
|
||||||
binary_list.append(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)
|
pkg_upgrade(binary)
|
||||||
print("Complete!\n")
|
print("Complete!\n")
|
||||||
installs.append(pkg)
|
installs.append(pkg)
|
||||||
versions.append(ver)
|
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:
|
if len(installs) > 1:
|
||||||
template(78)
|
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)
|
template(78)
|
||||||
for pkg, ver in zip(installs, versions):
|
for pkg, ver in zip(installs, versions):
|
||||||
installed = ("{0}-{1}".format(pkg, ver))
|
installed = ("{0}-{1}".format(pkg, ver))
|
||||||
if find_package(installed, pkg_path):
|
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:
|
else:
|
||||||
print("| Package {0} NOT installed".format(installed))
|
print("| Package {0} NOT installed".format(installed))
|
||||||
template(78)
|
template(78)
|
||||||
|
|
|
@ -27,8 +27,8 @@ import subprocess
|
||||||
|
|
||||||
from slpkg.colors import colors
|
from slpkg.colors import colors
|
||||||
from slpkg.functions import get_file
|
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.__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.build import build_package
|
||||||
from slpkg.pkg.find import find_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)
|
subprocess.call("wget -N {0}".format(src), shell=True)
|
||||||
sources.append(get_file(src, "/"))
|
sources.append(get_file(src, "/"))
|
||||||
build_package(script, sources, build_path)
|
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.
|
Searches the package name and version in /tmp to install.
|
||||||
If find two or more packages e.g. to build tag
|
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):
|
for search in find_package(prgnam, tmp):
|
||||||
if "_SBo" in search:
|
if "_SBo" in search:
|
||||||
binary_list.append(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)
|
pkg_upgrade(binary)
|
||||||
print("Complete!\n")
|
print("Complete!\n")
|
||||||
break
|
break
|
||||||
|
|
|
@ -30,7 +30,7 @@ from slpkg.colors import colors
|
||||||
from slpkg.url_read import url_read
|
from slpkg.url_read import url_read
|
||||||
from slpkg.messages import template
|
from slpkg.messages import template
|
||||||
from slpkg.__metadata__ import (pkg_path, slpkg_tmp,
|
from slpkg.__metadata__ import (pkg_path, slpkg_tmp,
|
||||||
slack_archs)
|
slack_archs)
|
||||||
|
|
||||||
from slpkg.pkg.manager import pkg_upgrade
|
from slpkg.pkg.manager import pkg_upgrade
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue