mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-27 09:58:10 +01:00
add in config
This commit is contained in:
parent
ff975adb41
commit
76799fbb47
24 changed files with 294 additions and 271 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Version 2.0.8
|
||||||
|
24-11-2014
|
||||||
|
|
||||||
|
[Updated] - Add more options in slpkg configuration file.
|
||||||
|
|
||||||
Version 2.0.7
|
Version 2.0.7
|
||||||
22-11-2014
|
22-11-2014
|
||||||
|
|
||||||
|
|
2
INSTALL
2
INSTALL
|
@ -11,7 +11,7 @@ slpkg works on Slackware distribution.
|
||||||
Install slpkg
|
Install slpkg
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
There are mainly five ways:
|
There are mainly 3 ways:
|
||||||
|
|
||||||
1) Download latest slpkg version from https://github.com/dslackw/slpkg/releases
|
1) Download latest slpkg version from https://github.com/dslackw/slpkg/releases
|
||||||
Untar or unzip the archive, cd in slpkg-?.?.? directory.
|
Untar or unzip the archive, cd in slpkg-?.?.? directory.
|
||||||
|
|
36
README.rst
36
README.rst
|
@ -102,7 +102,7 @@ Tutorial
|
||||||
--------
|
--------
|
||||||
|
|
||||||
.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/screenshot-1.png
|
.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/screenshot-1.png
|
||||||
:target: https://asciinema.org/a/12667
|
:target: https://asciinema.org/a/14145
|
||||||
|
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
|
@ -121,12 +121,27 @@ From SourceForge:
|
||||||
Download binary package from `SourceForge <https://sourceforge.net/projects/slpkg/>`_
|
Download binary package from `SourceForge <https://sourceforge.net/projects/slpkg/>`_
|
||||||
|
|
||||||
Upgrade
|
Upgrade
|
||||||
-------------
|
-------
|
||||||
|
|
||||||
In each upgrade should track the configuration files in the file '/etc/slpkg' for
|
In each slpkg upgrade should track the configuration files in the file '/etc/slpkg' for
|
||||||
new updates.
|
new updates.
|
||||||
|
|
||||||
|
|
||||||
|
Configuration files
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
/etc/slpkg/slpkg.conf
|
||||||
|
General configuration of slpkg
|
||||||
|
|
||||||
|
/etc/slpkg/blacklist
|
||||||
|
List of packages to skip
|
||||||
|
|
||||||
|
/etc/slpkg/slackware-mirrors
|
||||||
|
List of Slackware Mirrors
|
||||||
|
|
||||||
|
|
||||||
Slackware Current
|
Slackware Current
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
@ -157,7 +172,7 @@ Command Line Tool Usage
|
||||||
-a, script.tar.gz [source...] auto build SBo packages
|
-a, script.tar.gz [source...] auto build SBo packages
|
||||||
-b, --list, [package...] --add, --remove add, remove packages in blacklist
|
-b, --list, [package...] --add, --remove add, remove packages in blacklist
|
||||||
-q, --list, [package...] --add, --remove add, remove SBo packages in queue
|
-q, --list, [package...] --add, --remove add, remove SBo packages in queue
|
||||||
--build, --install, --build-install build or install packages from queue
|
--build, --install, --build-install build, install packages from queue
|
||||||
-g, --config, --config=[editor] configuration file management
|
-g, --config, --config=[editor] configuration file management
|
||||||
-l, [repository], all, noarch list of installed packages
|
-l, [repository], all, noarch list of installed packages
|
||||||
-c, [repository] --upgrade check for updated packages
|
-c, [repository] --upgrade check for updated packages
|
||||||
|
@ -207,7 +222,7 @@ build and install with all dependencies :
|
||||||
6 packages will be installed, 0 allready installed and 0 package
|
6 packages will be installed, 0 allready installed and 0 package
|
||||||
will be upgraded.
|
will be upgraded.
|
||||||
|
|
||||||
Do you want to continue [Y/n]? y
|
Would you like to continue [Y/n]? y
|
||||||
|
|
||||||
|
|
||||||
$ slpkg -s sbo fmpeg
|
$ slpkg -s sbo fmpeg
|
||||||
|
@ -230,7 +245,7 @@ build and install with all dependencies :
|
||||||
0 installed package and 4 uninstalled packages.
|
0 installed package and 4 uninstalled packages.
|
||||||
|
|
||||||
|
|
||||||
Install packages from `Slackware official mirrors <http://mirrors.slackware.com/>`_ :
|
Install Slackware official packages:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
|
@ -254,7 +269,7 @@ Install packages from `Slackware official mirrors <http://mirrors.slackware.com/
|
||||||
Need to get 48.17 Mb of archives.
|
Need to get 48.17 Mb of archives.
|
||||||
After this process, 125.75 Mb of additional disk space will be used.
|
After this process, 125.75 Mb of additional disk space will be used.
|
||||||
|
|
||||||
Would you like to install [Y/n]?
|
Would you like to continue [Y/n]?
|
||||||
|
|
||||||
Tracking all dependencies of packages,
|
Tracking all dependencies of packages,
|
||||||
and also displays installed packages:
|
and also displays installed packages:
|
||||||
|
@ -306,10 +321,9 @@ Check if your packages is up to date:
|
||||||
===============================================================================
|
===============================================================================
|
||||||
Total 8 packages will be upgraded and 0 package will be installed.
|
Total 8 packages will be upgraded and 0 package will be installed.
|
||||||
|
|
||||||
Would you like to upgrade [Y/n]?
|
Would you like to continue [Y/n]?
|
||||||
|
|
||||||
Check if your distribution is up to date from `Slackware official mirrors
|
Check if your Slackware distribution is up to date:
|
||||||
<http://mirrors.slackware.com/>`_ :
|
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
|
@ -332,7 +346,7 @@ Check if your distribution is up to date from `Slackware official mirrors
|
||||||
Need to get 13.58 Mb of archives.
|
Need to get 13.58 Mb of archives.
|
||||||
After this process, 76.10 Mb of additional disk space will be used.
|
After this process, 76.10 Mb of additional disk space will be used.
|
||||||
|
|
||||||
Would you like to upgrade [Y/n]?
|
Would you like to continue [Y/n]?
|
||||||
|
|
||||||
Find packages from slackbuilds.org:
|
Find packages from slackbuilds.org:
|
||||||
|
|
||||||
|
|
|
@ -54,3 +54,9 @@ DEFAULT_ANSWER=n
|
||||||
# Define default answer for the removal of dependencies.
|
# Define default answer for the removal of dependencies.
|
||||||
# Choose 'y' if you do not want to question.
|
# Choose 'y' if you do not want to question.
|
||||||
REMOVE_DEPS_ANSWER=n
|
REMOVE_DEPS_ANSWER=n
|
||||||
|
|
||||||
|
# Delete package dependencies if DEL_DEPS is on.
|
||||||
|
DEL_DEPS=on
|
||||||
|
|
||||||
|
# Use colors for highlighting. Choose 'on' or 'off'.
|
||||||
|
USE_COLORS=on
|
||||||
|
|
|
@ -42,7 +42,7 @@ It's a quick and easy way to manage your packages in slackware to a command.
|
||||||
-a, script.tar.gz [source...] auto build SBo packages
|
-a, script.tar.gz [source...] auto build SBo packages
|
||||||
-b, --list, [package...] --add, --remove add, remove packages in blacklist
|
-b, --list, [package...] --add, --remove add, remove packages in blacklist
|
||||||
-q, --list, [package...] --add, --remove add, remove SBo packages in queue
|
-q, --list, [package...] --add, --remove add, remove SBo packages in queue
|
||||||
--build, --install, --build-install build or install packages from queue
|
--build, --install, --build-install build, install packages from queue
|
||||||
-g, --config, --config=<editor> configuration file management
|
-g, --config, --config=<editor> configuration file management
|
||||||
-l, [repository], all, noarch list of installed packages
|
-l, [repository], all, noarch list of installed packages
|
||||||
-c, [repository] --upgrade check for updated packages
|
-c, [repository] --upgrade check for updated packages
|
||||||
|
|
|
@ -22,9 +22,7 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import getpass
|
|
||||||
|
|
||||||
from messages import s_user
|
|
||||||
|
|
||||||
__all__ = "slpkg"
|
__all__ = "slpkg"
|
||||||
__author__ = "dslackw"
|
__author__ = "dslackw"
|
||||||
|
@ -33,8 +31,6 @@ __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"
|
||||||
|
|
||||||
s_user(getpass.getuser())
|
|
||||||
|
|
||||||
# temponary path
|
# temponary path
|
||||||
tmp = "/tmp/"
|
tmp = "/tmp/"
|
||||||
|
|
||||||
|
@ -49,6 +45,8 @@ del_build = "off"
|
||||||
sbo_build_log = "on"
|
sbo_build_log = "on"
|
||||||
default_answer = "n"
|
default_answer = "n"
|
||||||
remove_deps_answer = "n"
|
remove_deps_answer = "n"
|
||||||
|
del_deps = "on"
|
||||||
|
use_colors = "on"
|
||||||
|
|
||||||
if os.path.isfile("/etc/slpkg/slpkg.conf"):
|
if os.path.isfile("/etc/slpkg/slpkg.conf"):
|
||||||
f = open("/etc/slpkg/slpkg.conf", "r")
|
f = open("/etc/slpkg/slpkg.conf", "r")
|
||||||
|
@ -78,6 +76,11 @@ if os.path.isfile("/etc/slpkg/slpkg.conf"):
|
||||||
default_answer = line[15:].strip()
|
default_answer = line[15:].strip()
|
||||||
if line.startswith("REMOVE_DEPS_ANSWER"):
|
if line.startswith("REMOVE_DEPS_ANSWER"):
|
||||||
remove_deps_answer = line[19:].strip()
|
remove_deps_answer = line[19:].strip()
|
||||||
|
if line.startswith("DEL_DEPS"):
|
||||||
|
del_deps = line[9:].strip()
|
||||||
|
if line.startswith("USE_COLORS"):
|
||||||
|
use_colors = line[11:].strip()
|
||||||
|
|
||||||
|
|
||||||
# repositories
|
# repositories
|
||||||
repositories = [
|
repositories = [
|
||||||
|
@ -88,6 +91,25 @@ repositories = [
|
||||||
"slacky"
|
"slacky"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if use_colors == "on":
|
||||||
|
color = {
|
||||||
|
'RED': "\x1b[31m",
|
||||||
|
'GREEN': "\x1b[32m",
|
||||||
|
'YELLOW': "\x1b[33m",
|
||||||
|
'CYAN': "\x1b[36m",
|
||||||
|
'GREY': "\x1b[38;5;247m",
|
||||||
|
'ENDC': "\x1b[0m"
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
color = {
|
||||||
|
'RED': "",
|
||||||
|
'GREEN': "",
|
||||||
|
'YELLOW': "",
|
||||||
|
'CYAN': "",
|
||||||
|
'GREY': "",
|
||||||
|
'ENDC': ""
|
||||||
|
}
|
||||||
|
|
||||||
# file spacer
|
# file spacer
|
||||||
sp = "-"
|
sp = "-"
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ def options():
|
||||||
"blacklist",
|
"blacklist",
|
||||||
" -q, --list, [package...] --add, --remove add, remove SBo packages "
|
" -q, --list, [package...] --add, --remove add, remove SBo packages "
|
||||||
"in queue",
|
"in queue",
|
||||||
" --build, --install, --build-install build or install packages "
|
" --build, --install, --build-install build, install packages "
|
||||||
"from queue",
|
"from queue",
|
||||||
" -g, --config, --config=[editor] configuration file " +
|
" -g, --config, --config=[editor] configuration file " +
|
||||||
"management",
|
"management",
|
||||||
|
|
|
@ -21,11 +21,7 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from colors import (
|
from __metadata__ import color
|
||||||
RED,
|
|
||||||
GREEN,
|
|
||||||
ENDC
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class BlackList(object):
|
class BlackList(object):
|
||||||
|
@ -59,7 +55,7 @@ class BlackList(object):
|
||||||
print("\nPackages in blacklist:\n")
|
print("\nPackages in blacklist:\n")
|
||||||
for black in self.packages():
|
for black in self.packages():
|
||||||
if black:
|
if black:
|
||||||
print("{0}{1}{2}".format(GREEN, black, ENDC))
|
print("{0}{1}{2}".format(color['GREEN'], black, color['ENDC']))
|
||||||
self.quit = True
|
self.quit = True
|
||||||
if self.quit:
|
if self.quit:
|
||||||
print("") # new line at exit
|
print("") # new line at exit
|
||||||
|
@ -74,7 +70,8 @@ class BlackList(object):
|
||||||
with open(self.blackfile, "a") as black_conf:
|
with open(self.blackfile, "a") as black_conf:
|
||||||
for pkg in pkgs:
|
for pkg in pkgs:
|
||||||
if pkg not in blacklist:
|
if pkg not in blacklist:
|
||||||
print("{0}{1}{2}".format(GREEN, pkg, ENDC))
|
print("{0}{1}{2}".format(color['GREEN'], pkg,
|
||||||
|
color['ENDC']))
|
||||||
black_conf.write(pkg + "\n")
|
black_conf.write(pkg + "\n")
|
||||||
self.quit = True
|
self.quit = True
|
||||||
black_conf.close()
|
black_conf.close()
|
||||||
|
@ -91,7 +88,7 @@ class BlackList(object):
|
||||||
if line not in pkgs:
|
if line not in pkgs:
|
||||||
remove.write(line + "\n")
|
remove.write(line + "\n")
|
||||||
else:
|
else:
|
||||||
print("{0}{1}{2}".format(RED, line, ENDC))
|
print("{0}{1}{2}".format(color['RED'], line, color['ENDC']))
|
||||||
self.quit = True
|
self.quit = True
|
||||||
remove.close()
|
remove.close()
|
||||||
if self.quit:
|
if self.quit:
|
||||||
|
|
|
@ -23,10 +23,7 @@
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from colors import (
|
from __metadata__ import color
|
||||||
CYAN,
|
|
||||||
ENDC
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class Config(object):
|
class Config(object):
|
||||||
|
@ -58,7 +55,7 @@ class Config(object):
|
||||||
if not line.startswith("#") and line.split("=")[0] in conf_args:
|
if not line.startswith("#") and line.split("=")[0] in conf_args:
|
||||||
print(line)
|
print(line)
|
||||||
else:
|
else:
|
||||||
print("{0}{1}{2}".format(CYAN, line, ENDC))
|
print("{0}{1}{2}".format(color['CYAN'], line, color['ENDC']))
|
||||||
print("") # new line at end
|
print("") # new line at end
|
||||||
|
|
||||||
def edit(self, editor):
|
def edit(self, editor):
|
||||||
|
|
|
@ -24,18 +24,11 @@
|
||||||
|
|
||||||
from init import Initialization
|
from init import Initialization
|
||||||
from messages import pkg_not_found
|
from messages import pkg_not_found
|
||||||
from colors import (
|
|
||||||
RED,
|
|
||||||
GREEN,
|
|
||||||
YELLOW,
|
|
||||||
CYAN,
|
|
||||||
GREY,
|
|
||||||
ENDC
|
|
||||||
)
|
|
||||||
from __metadata__ import (
|
from __metadata__ import (
|
||||||
pkg_path,
|
pkg_path,
|
||||||
lib_path,
|
lib_path,
|
||||||
repositories
|
repositories,
|
||||||
|
color
|
||||||
)
|
)
|
||||||
|
|
||||||
from pkg.find import find_package
|
from pkg.find import find_package
|
||||||
|
@ -43,10 +36,10 @@ from pkg.find import find_package
|
||||||
|
|
||||||
class PkgDesc(object):
|
class PkgDesc(object):
|
||||||
|
|
||||||
def __init__(self, name, repo, color):
|
def __init__(self, name, repo, paint):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.repo = repo
|
self.repo = repo
|
||||||
self.color = color
|
self.paint = paint
|
||||||
self.COLOR = ""
|
self.COLOR = ""
|
||||||
self.lib = ""
|
self.lib = ""
|
||||||
init_repos = {
|
init_repos = {
|
||||||
|
@ -58,14 +51,14 @@ class PkgDesc(object):
|
||||||
}
|
}
|
||||||
init_repos[self.repo]()
|
init_repos[self.repo]()
|
||||||
color_text = {
|
color_text = {
|
||||||
'red': RED,
|
'red': color['RED'],
|
||||||
'green': GREEN,
|
'green': color['GREEN'],
|
||||||
'yellow': YELLOW,
|
'yellow': color['YELLOW'],
|
||||||
'cyan': CYAN,
|
'cyan': color['CYAN'],
|
||||||
'grey': GREY,
|
'grey': color['GREY'],
|
||||||
'': ''
|
'': ''
|
||||||
}
|
}
|
||||||
self.COLOR = color_text[self.color]
|
self.COLOR = color_text[self.paint]
|
||||||
if self.repo in repositories:
|
if self.repo in repositories:
|
||||||
repos = {
|
repos = {
|
||||||
'sbo': 'sbo_repo/SLACKBUILDS.TXT',
|
'sbo': 'sbo_repo/SLACKBUILDS.TXT',
|
||||||
|
@ -94,7 +87,7 @@ class PkgDesc(object):
|
||||||
if line.startswith(self.name + end):
|
if line.startswith(self.name + end):
|
||||||
print("{0}{1}{2}".format(self.COLOR,
|
print("{0}{1}{2}".format(self.COLOR,
|
||||||
line[len(self.name) + n:].strip(),
|
line[len(self.name) + n:].strip(),
|
||||||
ENDC))
|
color['ENDC']))
|
||||||
count += 1
|
count += 1
|
||||||
if count == 11:
|
if count == 11:
|
||||||
break
|
break
|
||||||
|
|
|
@ -24,10 +24,7 @@
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from colors import (
|
from __metadata__ import color
|
||||||
GREEN,
|
|
||||||
ENDC
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class Download(object):
|
class Download(object):
|
||||||
|
@ -43,7 +40,8 @@ class Download(object):
|
||||||
Check if file already download the skip or continue
|
Check if file already download the skip or continue
|
||||||
download if before stoped.
|
download if before stoped.
|
||||||
'''
|
'''
|
||||||
print("\n[ {0}Download{1} ] -->{1} {2}\n".format(GREEN, ENDC,
|
print("\n[ {0}Download{1} ] -->{1} {2}\n".format(color['GREEN'],
|
||||||
|
color['ENDC'],
|
||||||
self.file_name))
|
self.file_name))
|
||||||
try:
|
try:
|
||||||
subprocess.call("wget -c -N --directory-prefix={0} {1}".format(
|
subprocess.call("wget -c -N --directory-prefix={0} {1}".format(
|
||||||
|
|
|
@ -23,11 +23,7 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from colors import (
|
from __metadata__ import color
|
||||||
RED,
|
|
||||||
CYAN,
|
|
||||||
ENDC
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def pkg_not_found(bol, pkg, message, eol):
|
def pkg_not_found(bol, pkg, message, eol):
|
||||||
|
@ -65,10 +61,11 @@ def build_FAILED(sbo_url, prgnam):
|
||||||
Print error message if build failed
|
Print error message if build failed
|
||||||
'''
|
'''
|
||||||
template(78)
|
template(78)
|
||||||
print("| Build package {0} [ {1}FAILED{2} ]".format(prgnam, RED, ENDC))
|
print("| Build package {0} [ {1}FAILED{2} ]".format(prgnam, color['RED'],
|
||||||
|
color['ENDC']))
|
||||||
template(78)
|
template(78)
|
||||||
print("| See log file in {0}/var/log/slpkg/sbo/build_logs{1} directory or "
|
print("| See log file in {0}/var/log/slpkg/sbo/build_logs{1} directory or "
|
||||||
"read README file:".format(CYAN, ENDC))
|
"read README file:".format(color['CYAN'], color['ENDC']))
|
||||||
print("| {0}{1}".format(sbo_url, "README"))
|
print("| {0}{1}".format(sbo_url, "README"))
|
||||||
template(78)
|
template(78)
|
||||||
print # new line at end
|
print # new line at end
|
||||||
|
|
|
@ -30,16 +30,12 @@ from slpkg.messages import template
|
||||||
from slpkg.blacklist import BlackList
|
from slpkg.blacklist import BlackList
|
||||||
from slpkg.init import Initialization
|
from slpkg.init import Initialization
|
||||||
from slpkg.splitting import split_package
|
from slpkg.splitting import split_package
|
||||||
from slpkg.colors import (
|
|
||||||
YELLOW,
|
|
||||||
GREY,
|
|
||||||
ENDC
|
|
||||||
)
|
|
||||||
from slpkg.__metadata__ import (
|
from slpkg.__metadata__ import (
|
||||||
pkg_path,
|
pkg_path,
|
||||||
lib_path,
|
lib_path,
|
||||||
slpkg_tmp_packages,
|
slpkg_tmp_packages,
|
||||||
default_answer
|
default_answer,
|
||||||
|
color
|
||||||
)
|
)
|
||||||
|
|
||||||
from slpkg.pkg.manager import PackageManager
|
from slpkg.pkg.manager import PackageManager
|
||||||
|
@ -59,7 +55,8 @@ class OthersUpgrade(object):
|
||||||
self.tmp_path = slpkg_tmp_packages
|
self.tmp_path = slpkg_tmp_packages
|
||||||
self.repo_init()
|
self.repo_init()
|
||||||
repos = Repo()
|
repos = Repo()
|
||||||
sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
|
sys.stdout.write("{0}Reading package lists ...{1}".format(
|
||||||
|
color['GREY'], color['ENDC']))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
self.step = 700
|
self.step = 700
|
||||||
repos = Repo()
|
repos = Repo()
|
||||||
|
@ -99,7 +96,8 @@ class OthersUpgrade(object):
|
||||||
'''
|
'''
|
||||||
try:
|
try:
|
||||||
dwn_links, upgrade_all, comp_sum, uncomp_sum = self.store()
|
dwn_links, upgrade_all, comp_sum, uncomp_sum = self.store()
|
||||||
sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
|
sys.stdout.write("{0}Done{1}\n".format(color['GREY'],
|
||||||
|
color['ENDC']))
|
||||||
print("") # new line at start
|
print("") # new line at start
|
||||||
if upgrade_all:
|
if upgrade_all:
|
||||||
template(78)
|
template(78)
|
||||||
|
@ -118,11 +116,12 @@ class OthersUpgrade(object):
|
||||||
print("\nInstalling summary")
|
print("\nInstalling summary")
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
print("{0}Total {1} {2} will be upgraded.".format(
|
print("{0}Total {1} {2} will be upgraded.".format(
|
||||||
GREY, len(upgrade_all), msg))
|
color['GREY'], len(upgrade_all), msg))
|
||||||
print("Need to get {0} {1} of archives.".format(size[0],
|
print("Need to get {0} {1} of archives.".format(size[0],
|
||||||
unit[0]))
|
unit[0]))
|
||||||
print("After this process, {0} {1} of additional disk "
|
print("After this process, {0} {1} of additional disk "
|
||||||
"space will be used.{2}".format(size[1], unit[1], ENDC))
|
"space will be used.{2}".format(size[1], unit[1],
|
||||||
|
color['ENDC']))
|
||||||
if default_answer == "y":
|
if default_answer == "y":
|
||||||
answer = default_answer
|
answer = default_answer
|
||||||
else:
|
else:
|
||||||
|
@ -198,7 +197,7 @@ def views(upgrade_all, comp_sum, repository):
|
||||||
pkg_split = split_package(pkg[:-4])
|
pkg_split = split_package(pkg[:-4])
|
||||||
upg_sum += 1
|
upg_sum += 1
|
||||||
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11:>11}{12}".format(
|
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11:>11}{12}".format(
|
||||||
YELLOW, pkg_split[0], ENDC,
|
color['YELLOW'], pkg_split[0], color['ENDC'],
|
||||||
" " * (25-len(pkg_split[0])), pkg_split[1],
|
" " * (25-len(pkg_split[0])), pkg_split[1],
|
||||||
" " * (19-len(pkg_split[1])), pkg_split[2],
|
" " * (19-len(pkg_split[1])), pkg_split[2],
|
||||||
" " * (8-len(pkg_split[2])), pkg_split[3],
|
" " * (8-len(pkg_split[2])), pkg_split[3],
|
||||||
|
@ -223,5 +222,6 @@ def upgrade(tmp_path, upgrade_all):
|
||||||
'''
|
'''
|
||||||
for pkg in upgrade_all:
|
for pkg in upgrade_all:
|
||||||
package = (tmp_path + pkg).split()
|
package = (tmp_path + pkg).split()
|
||||||
print("[ {0}upgrading{1} ] --> {2}".format(YELLOW, ENDC, pkg[:-4]))
|
print("[ {0}upgrading{1} ] --> {2}".format(color['YELLOW'],
|
||||||
|
color['ENDC'], pkg[:-4]))
|
||||||
PackageManager(package).upgrade()
|
PackageManager(package).upgrade()
|
||||||
|
|
|
@ -33,20 +33,13 @@ from slpkg.messages import (
|
||||||
pkg_not_found,
|
pkg_not_found,
|
||||||
template
|
template
|
||||||
)
|
)
|
||||||
from slpkg.colors import (
|
|
||||||
RED,
|
|
||||||
GREEN,
|
|
||||||
CYAN,
|
|
||||||
YELLOW,
|
|
||||||
GREY,
|
|
||||||
ENDC
|
|
||||||
)
|
|
||||||
from slpkg.__metadata__ import (
|
from slpkg.__metadata__ import (
|
||||||
pkg_path,
|
pkg_path,
|
||||||
lib_path,
|
lib_path,
|
||||||
log_path,
|
log_path,
|
||||||
slpkg_tmp_packages,
|
slpkg_tmp_packages,
|
||||||
default_answer
|
default_answer,
|
||||||
|
color
|
||||||
)
|
)
|
||||||
|
|
||||||
from slpkg.pkg.find import find_package
|
from slpkg.pkg.find import find_package
|
||||||
|
@ -70,8 +63,9 @@ class OthersInstall(object):
|
||||||
self.repo_init()
|
self.repo_init()
|
||||||
repos = Repo()
|
repos = Repo()
|
||||||
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
|
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
|
||||||
CYAN, self.package, ENDC))
|
color['CYAN'], self.package, color['ENDC']))
|
||||||
sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
|
sys.stdout.write("{0}Reading package lists ...{1}".format(
|
||||||
|
color['GREY'], color['ENDC']))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
self.step = 700
|
self.step = 700
|
||||||
repos = Repo()
|
repos = Repo()
|
||||||
|
@ -93,7 +87,7 @@ class OthersInstall(object):
|
||||||
f = open(lib, "r")
|
f = open(lib, "r")
|
||||||
self.PACKAGES_TXT = f.read()
|
self.PACKAGES_TXT = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
|
sys.stdout.write("{0}Done{1}\n".format(color['GREY'], color['ENDC']))
|
||||||
|
|
||||||
def repo_init(self):
|
def repo_init(self):
|
||||||
'''
|
'''
|
||||||
|
@ -118,7 +112,8 @@ class OthersInstall(object):
|
||||||
dependencies = resolving_deps(self.package, self.repo)
|
dependencies = resolving_deps(self.package, self.repo)
|
||||||
(dwn_links, install_all, comp_sum, uncomp_sum,
|
(dwn_links, install_all, comp_sum, uncomp_sum,
|
||||||
matching) = self.store(dependencies)
|
matching) = self.store(dependencies)
|
||||||
sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
|
sys.stdout.write("{0}Done{1}\n".format(color['GREY'],
|
||||||
|
color['ENDC']))
|
||||||
print("") # new line at start
|
print("") # new line at start
|
||||||
if install_all:
|
if install_all:
|
||||||
template(78)
|
template(78)
|
||||||
|
@ -137,8 +132,8 @@ class OthersInstall(object):
|
||||||
msg = msgs(install_all, sums[2])
|
msg = msgs(install_all, sums[2])
|
||||||
print("\nInstalling summary")
|
print("\nInstalling summary")
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
print("{0}Total {1} {2}.".format(GREY, len(install_all),
|
print("{0}Total {1} {2}.".format(color['GREY'],
|
||||||
msg[0]))
|
len(install_all), msg[0]))
|
||||||
print("{0} {1} will be installed, {2} will be upgraded and "
|
print("{0} {1} will be installed, {2} will be upgraded and "
|
||||||
"{3} will be resettled.".format(sums[2], msg[1],
|
"{3} will be resettled.".format(sums[2], msg[1],
|
||||||
sums[1], sums[0]))
|
sums[1], sums[0]))
|
||||||
|
@ -146,7 +141,7 @@ class OthersInstall(object):
|
||||||
unit[0]))
|
unit[0]))
|
||||||
print("After this process, {0} {1} of additional disk "
|
print("After this process, {0} {1} of additional disk "
|
||||||
"space will be used.{2}".format(size[1], unit[1],
|
"space will be used.{2}".format(size[1], unit[1],
|
||||||
ENDC))
|
color['ENDC']))
|
||||||
if default_answer == "y":
|
if default_answer == "y":
|
||||||
answer = default_answer
|
answer = default_answer
|
||||||
else:
|
else:
|
||||||
|
@ -165,10 +160,10 @@ class OthersInstall(object):
|
||||||
print("\nInstalling summary")
|
print("\nInstalling summary")
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
print("{0}Total found {1} matching {2}.".format(
|
print("{0}Total found {1} matching {2}.".format(
|
||||||
GREY, len(install_all), msg[1]))
|
color['GREY'], len(install_all), msg[1]))
|
||||||
print("{0} installed {1} and {2} uninstalled {3}.{4}"
|
print("{0} installed {1} and {2} uninstalled {3}.{4}"
|
||||||
"\n".format(sums[0] + sums[1], msg[0], sums[2],
|
"\n".format(sums[0] + sums[1], msg[0], sums[2],
|
||||||
msg[1], ENDC))
|
msg[1], color['ENDC']))
|
||||||
else:
|
else:
|
||||||
pkg_not_found("", self.package, "No matching", "\n")
|
pkg_not_found("", self.package, "No matching", "\n")
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
@ -232,15 +227,15 @@ def views(install_all, comp_sum, repository, dependencies):
|
||||||
pkg_split = split_package(pkg[:-4])
|
pkg_split = split_package(pkg[:-4])
|
||||||
if find_package(pkg_split[0] + "-" + pkg_split[1], pkg_path):
|
if find_package(pkg_split[0] + "-" + pkg_split[1], pkg_path):
|
||||||
pkg_sum += 1
|
pkg_sum += 1
|
||||||
COLOR = GREEN
|
COLOR = color['GREEN']
|
||||||
elif find_package(pkg_split[0] + "-", pkg_path):
|
elif find_package(pkg_split[0] + "-", pkg_path):
|
||||||
COLOR = YELLOW
|
COLOR = color['YELLOW']
|
||||||
upg_sum += 1
|
upg_sum += 1
|
||||||
else:
|
else:
|
||||||
COLOR = RED
|
COLOR = color['RED']
|
||||||
uni_sum += 1
|
uni_sum += 1
|
||||||
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11:>11}{12}".format(
|
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11:>11}{12}".format(
|
||||||
COLOR, pkg_split[0], ENDC,
|
COLOR, pkg_split[0], color['ENDC'],
|
||||||
" " * (25-len(pkg_split[0])), pkg_split[1],
|
" " * (25-len(pkg_split[0])), pkg_split[1],
|
||||||
" " * (19-len(pkg_split[1])), pkg_split[2],
|
" " * (19-len(pkg_split[1])), pkg_split[2],
|
||||||
" " * (8-len(pkg_split[2])), pkg_split[3],
|
" " * (8-len(pkg_split[2])), pkg_split[3],
|
||||||
|
@ -272,13 +267,19 @@ def install(tmp_path, install_all):
|
||||||
for install in install_all:
|
for install in install_all:
|
||||||
package = (tmp_path + install).split()
|
package = (tmp_path + install).split()
|
||||||
if os.path.isfile(pkg_path + install[:-4]):
|
if os.path.isfile(pkg_path + install[:-4]):
|
||||||
print("[ {0}reinstalling{1} ] --> {2}".format(GREEN, ENDC, install))
|
print("[ {0}reinstalling{1} ] --> {2}".format(color['GREEN'],
|
||||||
|
color['ENDC'],
|
||||||
|
install))
|
||||||
PackageManager(package).reinstall()
|
PackageManager(package).reinstall()
|
||||||
elif find_package(split_package(install)[0] + "-", pkg_path):
|
elif find_package(split_package(install)[0] + "-", pkg_path):
|
||||||
print("[ {0}upgrading{1} ] --> {2}".format(YELLOW, ENDC, install))
|
print("[ {0}upgrading{1} ] --> {2}".format(color['YELLOW'],
|
||||||
|
color['ENDC'],
|
||||||
|
install))
|
||||||
PackageManager(package).upgrade()
|
PackageManager(package).upgrade()
|
||||||
else:
|
else:
|
||||||
print("[ {0}installing{1} ] --> {2}".format(GREEN, ENDC, install))
|
print("[ {0}installing{1} ] --> {2}".format(color['GREEN'],
|
||||||
|
color['ENDC'],
|
||||||
|
install))
|
||||||
PackageManager(package).upgrade()
|
PackageManager(package).upgrade()
|
||||||
|
|
||||||
|
|
||||||
|
@ -287,7 +288,8 @@ def resolving_deps(name, repo):
|
||||||
Return package dependencies
|
Return package dependencies
|
||||||
'''
|
'''
|
||||||
requires, dependencies = [], []
|
requires, dependencies = [], []
|
||||||
sys.stdout.write("{0}Resolving dependencies ...{1}".format(GREY, ENDC))
|
sys.stdout.write("{0}Resolving dependencies ...{1}".format(color['GREY'],
|
||||||
|
color['ENDC']))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
deps = dependencies_pkg(name, repo)
|
deps = dependencies_pkg(name, repo)
|
||||||
requires.append(name)
|
requires.append(name)
|
||||||
|
|
|
@ -30,11 +30,6 @@ import tarfile
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from slpkg.checksum import md5sum
|
from slpkg.checksum import md5sum
|
||||||
from slpkg.colors import (
|
|
||||||
RED,
|
|
||||||
GREEN,
|
|
||||||
ENDC
|
|
||||||
)
|
|
||||||
from slpkg.messages import (
|
from slpkg.messages import (
|
||||||
pkg_not_found,
|
pkg_not_found,
|
||||||
template
|
template
|
||||||
|
@ -43,7 +38,8 @@ from slpkg.__metadata__ import (
|
||||||
log_path,
|
log_path,
|
||||||
sbo_build_log,
|
sbo_build_log,
|
||||||
sbo_check_md5,
|
sbo_check_md5,
|
||||||
default_answer
|
default_answer,
|
||||||
|
color
|
||||||
)
|
)
|
||||||
|
|
||||||
from slpkg.sbo.greps import SBoGrep
|
from slpkg.sbo.greps import SBoGrep
|
||||||
|
@ -120,7 +116,9 @@ def check_md5(sbo_md5, src):
|
||||||
md5 = md5sum(src)
|
md5 = md5sum(src)
|
||||||
if sbo_md5 != md5:
|
if sbo_md5 != md5:
|
||||||
template(78)
|
template(78)
|
||||||
print("| MD5SUM check for {0} [ {1}FAILED{2} ]".format(src, RED, ENDC))
|
print("| MD5SUM check for {0} [ {1}FAILED{2} ]".format(src,
|
||||||
|
color['RED'],
|
||||||
|
color['ENDC']))
|
||||||
template(78)
|
template(78)
|
||||||
print("| Expected: {0}".format(md5))
|
print("| Expected: {0}".format(md5))
|
||||||
print("| Found: {0}".format(sbo_md5))
|
print("| Found: {0}".format(sbo_md5))
|
||||||
|
@ -135,8 +133,9 @@ def check_md5(sbo_md5, src):
|
||||||
sys.exit()
|
sys.exit()
|
||||||
else:
|
else:
|
||||||
template(78)
|
template(78)
|
||||||
print("| MD5SUM check for {0} [ {1}PASSED{2} ]".format(src, GREEN,
|
print("| MD5SUM check for {0} [ {1}PASSED{2} ]".format(src,
|
||||||
ENDC))
|
color['GREEN'],
|
||||||
|
color['ENDC']))
|
||||||
template(78)
|
template(78)
|
||||||
print("") # new line after pass checksum
|
print("") # new line after pass checksum
|
||||||
|
|
||||||
|
|
|
@ -29,19 +29,14 @@ from slpkg.messages import (
|
||||||
pkg_not_found,
|
pkg_not_found,
|
||||||
template
|
template
|
||||||
)
|
)
|
||||||
from slpkg.colors import (
|
|
||||||
RED,
|
|
||||||
GREEN,
|
|
||||||
CYAN,
|
|
||||||
GREY,
|
|
||||||
ENDC
|
|
||||||
)
|
|
||||||
from slpkg.__metadata__ import (
|
from slpkg.__metadata__ import (
|
||||||
pkg_path,
|
pkg_path,
|
||||||
sp,
|
sp,
|
||||||
log_path,
|
log_path,
|
||||||
default_answer,
|
default_answer,
|
||||||
remove_deps_answer
|
remove_deps_answer,
|
||||||
|
del_deps,
|
||||||
|
color
|
||||||
)
|
)
|
||||||
|
|
||||||
from slpkg.pkg.find import find_package
|
from slpkg.pkg.find import find_package
|
||||||
|
@ -127,7 +122,7 @@ class PackageManager(object):
|
||||||
# If package build and install with 'slpkg -s sbo <package>'
|
# If package build and install with 'slpkg -s sbo <package>'
|
||||||
# then look log file for dependencies in /var/log/slpkg/dep,
|
# then look log file for dependencies in /var/log/slpkg/dep,
|
||||||
# read and remove all else remove only the package.
|
# read and remove all else remove only the package.
|
||||||
if os.path.isfile(dep_path + rmv):
|
if os.path.isfile(dep_path + rmv) and del_deps == "on":
|
||||||
dependencies = self.view_deps(dep_path, rmv)
|
dependencies = self.view_deps(dep_path, rmv)
|
||||||
try:
|
try:
|
||||||
if remove_deps_answer == "y":
|
if remove_deps_answer == "y":
|
||||||
|
@ -158,11 +153,12 @@ class PackageManager(object):
|
||||||
'''
|
'''
|
||||||
removed = []
|
removed = []
|
||||||
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
|
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
|
||||||
CYAN, ", ".join(binary), ENDC))
|
color['CYAN'], ", ".join(binary), color['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:
|
||||||
print("[ {0}delete{1} ] --> {2}".format(RED, ENDC,
|
print("[ {0}delete{1} ] --> {2}".format(
|
||||||
|
color['RED'], color['ENDC'],
|
||||||
"\n ".join(pkgs)))
|
"\n ".join(pkgs)))
|
||||||
removed.append(pkg)
|
removed.append(pkg)
|
||||||
else:
|
else:
|
||||||
|
@ -182,7 +178,7 @@ class PackageManager(object):
|
||||||
print("| Found dependencies for package {0}:".format(package))
|
print("| Found dependencies for package {0}:".format(package))
|
||||||
template(78)
|
template(78)
|
||||||
for dep in dependencies:
|
for dep in dependencies:
|
||||||
print("| {0}{1}{2}".format(RED, dep, ENDC))
|
print("| {0}{1}{2}".format(color['RED'], dep, color['ENDC']))
|
||||||
template(78)
|
template(78)
|
||||||
return dependencies
|
return dependencies
|
||||||
|
|
||||||
|
@ -234,12 +230,12 @@ class PackageManager(object):
|
||||||
self.binary = "".join(self.binary)
|
self.binary = "".join(self.binary)
|
||||||
matching = size = 0
|
matching = size = 0
|
||||||
print("\nPackages with matching name [ {0}{1}{2} ]\n".format(
|
print("\nPackages with matching name [ {0}{1}{2} ]\n".format(
|
||||||
CYAN, self.binary, ENDC))
|
color['CYAN'], self.binary, color['ENDC']))
|
||||||
for match in find_package(self.binary, pkg_path):
|
for match in find_package(self.binary, pkg_path):
|
||||||
if self.binary in match:
|
if self.binary in match:
|
||||||
matching += 1
|
matching += 1
|
||||||
print("[ {0}installed{1} ] - {2}".format(
|
print("[ {0}installed{1} ] - {2}".format(
|
||||||
GREEN, ENDC, match))
|
color['GREEN'], color['ENDC'], match))
|
||||||
with open(pkg_path + match, "r") as f:
|
with open(pkg_path + match, "r") as f:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
|
@ -255,13 +251,13 @@ class PackageManager(object):
|
||||||
pkg_not_found("", self.binary, message, "\n")
|
pkg_not_found("", self.binary, message, "\n")
|
||||||
else:
|
else:
|
||||||
print("\n{0}Total found {1} matching packages.{2}".format(
|
print("\n{0}Total found {1} matching packages.{2}".format(
|
||||||
GREY, matching, ENDC))
|
color['GREY'], matching, color['ENDC']))
|
||||||
unit = "Kb"
|
unit = "Kb"
|
||||||
if size > 1024:
|
if size > 1024:
|
||||||
unit = "Mb"
|
unit = "Mb"
|
||||||
size = (size / 1024)
|
size = (size / 1024)
|
||||||
print("{0}Size of installed packages {1} {2}.{3}\n".format(
|
print("{0}Size of installed packages {1} {2}.{3}\n".format(
|
||||||
GREY, round(size, 2), unit, ENDC))
|
color['GREY'], round(size, 2), unit, color['ENDC']))
|
||||||
|
|
||||||
def display(self):
|
def display(self):
|
||||||
'''
|
'''
|
||||||
|
@ -306,10 +302,12 @@ class PackageManager(object):
|
||||||
for pkg in find_package("", pkg_path):
|
for pkg in find_package("", pkg_path):
|
||||||
if pkg.endswith(search) and sl in pkg:
|
if pkg.endswith(search) and sl in pkg:
|
||||||
index += 1
|
index += 1
|
||||||
print("{0}{1}:{2} {3}".format(GREY, index, ENDC, pkg))
|
print("{0}{1}:{2} {3}".format(color['GREY'], index,
|
||||||
|
color['ENDC'], pkg))
|
||||||
if index == page:
|
if index == page:
|
||||||
read = raw_input("\nPress {0}Enter{1} to "
|
read = raw_input("\nPress {0}Enter{1} to "
|
||||||
"continue... ".format(CYAN, ENDC))
|
"continue... ".format(color['CYAN'],
|
||||||
|
color['ENDC']))
|
||||||
if read in ['Q', 'q']:
|
if read in ['Q', 'q']:
|
||||||
break
|
break
|
||||||
print("") # new line after page
|
print("") # new line after page
|
||||||
|
|
|
@ -24,14 +24,10 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from downloader import Download
|
from downloader import Download
|
||||||
from colors import (
|
|
||||||
GREEN,
|
|
||||||
RED,
|
|
||||||
ENDC
|
|
||||||
)
|
|
||||||
from __metadata__ import (
|
from __metadata__ import (
|
||||||
lib_path,
|
lib_path,
|
||||||
build_path,
|
build_path,
|
||||||
|
color,
|
||||||
tmp
|
tmp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -90,7 +86,7 @@ class QueuePkgs(object):
|
||||||
print("\nPackages in queue:\n")
|
print("\nPackages in queue:\n")
|
||||||
for pkg in self.packages():
|
for pkg in self.packages():
|
||||||
if pkg:
|
if pkg:
|
||||||
print("{0}{1}{2}".format(GREEN, pkg, ENDC))
|
print("{0}{1}{2}".format(color['GREEN'], pkg, color['ENDC']))
|
||||||
self.quit = True
|
self.quit = True
|
||||||
if self.quit:
|
if self.quit:
|
||||||
print("") # new line at exit
|
print("") # new line at exit
|
||||||
|
@ -106,11 +102,12 @@ class QueuePkgs(object):
|
||||||
for pkg in pkgs:
|
for pkg in pkgs:
|
||||||
find = sbo_search_pkg(pkg)
|
find = sbo_search_pkg(pkg)
|
||||||
if pkg not in queue_list and find is not None:
|
if pkg not in queue_list and find is not None:
|
||||||
print("{0}{1}{2}".format(GREEN, pkg, ENDC))
|
print("{0}{1}{2}".format(color['GREEN'], pkg,
|
||||||
|
color['ENDC']))
|
||||||
queue.write(pkg + "\n")
|
queue.write(pkg + "\n")
|
||||||
self.quit = True
|
self.quit = True
|
||||||
else:
|
else:
|
||||||
print("{0}{1}{2}".format(RED, pkg, ENDC))
|
print("{0}{1}{2}".format(color['RED'], pkg, color['ENDC']))
|
||||||
self.quit = True
|
self.quit = True
|
||||||
queue.close()
|
queue.close()
|
||||||
if self.quit:
|
if self.quit:
|
||||||
|
@ -128,7 +125,7 @@ class QueuePkgs(object):
|
||||||
if line not in pkgs:
|
if line not in pkgs:
|
||||||
queue.write(line + "\n")
|
queue.write(line + "\n")
|
||||||
else:
|
else:
|
||||||
print("{0}{1}{2}".format(RED, line, ENDC))
|
print("{0}{1}{2}".format(color['RED'], line, color['ENDC']))
|
||||||
self.quit = True
|
self.quit = True
|
||||||
queue.close()
|
queue.close()
|
||||||
if self.quit:
|
if self.quit:
|
||||||
|
|
|
@ -36,18 +36,12 @@ from slpkg.messages import (
|
||||||
template,
|
template,
|
||||||
build_FAILED
|
build_FAILED
|
||||||
)
|
)
|
||||||
from slpkg.colors import (
|
|
||||||
RED,
|
|
||||||
GREEN,
|
|
||||||
GREY,
|
|
||||||
YELLOW,
|
|
||||||
ENDC
|
|
||||||
)
|
|
||||||
from slpkg.__metadata__ import (
|
from slpkg.__metadata__ import (
|
||||||
tmp,
|
tmp,
|
||||||
pkg_path,
|
pkg_path,
|
||||||
build_path,
|
build_path,
|
||||||
default_answer,
|
default_answer,
|
||||||
|
color,
|
||||||
sp
|
sp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -61,9 +55,10 @@ from dependency import sbo_dependencies_pkg
|
||||||
class SBoCheck(object):
|
class SBoCheck(object):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.done = "{0}Done{1}\n".format(GREY, ENDC)
|
self.done = "{0}Done{1}\n".format(color['GREY'], color['ENDC'])
|
||||||
Initialization().sbo()
|
Initialization().sbo()
|
||||||
sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
|
sys.stdout.write("{0}Reading package lists ...{1}".format(
|
||||||
|
color['GREY'], color['ENDC']))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
self.installed = []
|
self.installed = []
|
||||||
self.index, self.toolbar_width = 0, 3
|
self.index, self.toolbar_width = 0, 3
|
||||||
|
@ -84,7 +79,7 @@ class SBoCheck(object):
|
||||||
data = []
|
data = []
|
||||||
if upg_name:
|
if upg_name:
|
||||||
sys.stdout.write("{0}Resolving dependencies ...{1}".format(
|
sys.stdout.write("{0}Resolving dependencies ...{1}".format(
|
||||||
GREY, ENDC))
|
color['GREY'], color['ENDC']))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
# upgrade name = data[0]
|
# upgrade name = data[0]
|
||||||
# package for upgrade = data[1]
|
# package for upgrade = data[1]
|
||||||
|
@ -124,10 +119,10 @@ class SBoCheck(object):
|
||||||
sys.exit()
|
sys.exit()
|
||||||
if find_package(name + sp, pkg_path):
|
if find_package(name + sp, pkg_path):
|
||||||
print("[ {0}Upgrading{1} ] --> {2}".format(
|
print("[ {0}Upgrading{1} ] --> {2}".format(
|
||||||
YELLOW, ENDC, name))
|
color['YELLOW'], color['ENDC'], name))
|
||||||
else:
|
else:
|
||||||
print("[ {0}Installing{1} ] --> {2}".format(
|
print("[ {0}Installing{1} ] --> {2}".format(
|
||||||
GREEN, ENDC, name))
|
color['GREEN'], color['ENDC'], name))
|
||||||
# Use this list to pick out what
|
# Use this list to pick out what
|
||||||
# packages will be installed
|
# packages will be installed
|
||||||
self.installed.append(name)
|
self.installed.append(name)
|
||||||
|
@ -277,14 +272,14 @@ def view_packages(package_for_upgrade, upgrade_version, upgrade_arch):
|
||||||
for upg, ver, arch in zip(package_for_upgrade, upgrade_version,
|
for upg, ver, arch in zip(package_for_upgrade, upgrade_version,
|
||||||
upgrade_arch):
|
upgrade_arch):
|
||||||
if find_package(upg[:-len(ver)], pkg_path):
|
if find_package(upg[:-len(ver)], pkg_path):
|
||||||
COLOR = YELLOW
|
COLOR = color['YELLOW']
|
||||||
count_upgraded += 1
|
count_upgraded += 1
|
||||||
else:
|
else:
|
||||||
COLOR = RED
|
COLOR = color['RED']
|
||||||
count_installed += 1
|
count_installed += 1
|
||||||
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
|
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
|
||||||
COLOR, upg, ENDC, " " * (38-len(upg)), GREEN,
|
COLOR, upg, color['ENDC'], " " * (38-len(upg)), color['GREEN'],
|
||||||
ver, ENDC, " " * (17-len(ver)), arch,
|
ver, color['ENDC'], " " * (17-len(ver)), arch,
|
||||||
" " * (13-len(arch)), "SBo"))
|
" " * (13-len(arch)), "SBo"))
|
||||||
msg_upg = "package"
|
msg_upg = "package"
|
||||||
msg_ins = msg_upg
|
msg_ins = msg_upg
|
||||||
|
@ -295,8 +290,8 @@ def view_packages(package_for_upgrade, upgrade_version, upgrade_arch):
|
||||||
print("\nInstalling summary")
|
print("\nInstalling summary")
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
print("{0}Total {1} {2} will be upgraded and {3} {4} will be "
|
print("{0}Total {1} {2} will be upgraded and {3} {4} will be "
|
||||||
"installed.{5}\n".format(GREY, count_upgraded, msg_upg,
|
"installed.{5}\n".format(color['GREY'], count_upgraded, msg_upg,
|
||||||
count_installed, msg_ins, ENDC))
|
count_installed, msg_ins, color['ENDC']))
|
||||||
return [count_installed, count_upgraded], [msg_ins, msg_upg]
|
return [count_installed, count_upgraded], [msg_ins, msg_upg]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,16 +35,9 @@ from slpkg.__metadata__ import (
|
||||||
log_path,
|
log_path,
|
||||||
lib_path,
|
lib_path,
|
||||||
default_answer,
|
default_answer,
|
||||||
|
color,
|
||||||
sp
|
sp
|
||||||
)
|
)
|
||||||
from slpkg.colors import (
|
|
||||||
RED,
|
|
||||||
GREEN,
|
|
||||||
GREY,
|
|
||||||
YELLOW,
|
|
||||||
CYAN,
|
|
||||||
ENDC
|
|
||||||
)
|
|
||||||
from slpkg.messages import (
|
from slpkg.messages import (
|
||||||
pkg_found,
|
pkg_found,
|
||||||
template,
|
template,
|
||||||
|
@ -68,7 +61,8 @@ class SBoInstall(object):
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
self.name = name
|
self.name = name
|
||||||
Initialization().sbo()
|
Initialization().sbo()
|
||||||
sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
|
sys.stdout.write("{0}Reading package lists ...{1}".format(
|
||||||
|
color['GREY'], color['ENDC']))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
self.UNST = ["UNSUPPORTED", "UNTESTED"]
|
self.UNST = ["UNSUPPORTED", "UNTESTED"]
|
||||||
self.dependencies_list = sbo_dependencies_pkg(name)
|
self.dependencies_list = sbo_dependencies_pkg(name)
|
||||||
|
@ -82,7 +76,8 @@ class SBoInstall(object):
|
||||||
try:
|
try:
|
||||||
if self.dependencies_list or sbo_search_pkg(self.name) is not None:
|
if self.dependencies_list or sbo_search_pkg(self.name) is not None:
|
||||||
dependencies = self.remove_dbs()
|
dependencies = self.remove_dbs()
|
||||||
sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
|
sys.stdout.write("{0}Done{1}\n".format(color['GREY'],
|
||||||
|
color['ENDC']))
|
||||||
# sbo versions = idata[0]
|
# sbo versions = idata[0]
|
||||||
# package arch = idata[1]
|
# package arch = idata[1]
|
||||||
# package sum = idata[2]
|
# package sum = idata[2]
|
||||||
|
@ -113,12 +108,12 @@ class SBoInstall(object):
|
||||||
msg = msgs(dependencies, count[1], count[0])
|
msg = msgs(dependencies, count[1], count[0])
|
||||||
print("\nInstalling summary")
|
print("\nInstalling summary")
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
print("{0}Total {1} {2}.".format(GREY, len(dependencies),
|
print("{0}Total {1} {2}.".format(color['GREY'],
|
||||||
msg[2]))
|
len(dependencies), msg[2]))
|
||||||
print("{0} {1} will be installed, {2} allready installed and "
|
print("{0} {1} will be installed, {2} allready installed and "
|
||||||
"{3} {4}".format(count[1], msg[0], idata[2], count[0],
|
"{3} {4}".format(count[1], msg[0], idata[2], count[0],
|
||||||
msg[1]))
|
msg[1]))
|
||||||
print("will be upgraded.{0}\n".format(ENDC))
|
print("will be upgraded.{0}\n".format(color['ENDC']))
|
||||||
answer = arch_support(idata[3], self.UNST, idata[2],
|
answer = arch_support(idata[3], self.UNST, idata[2],
|
||||||
dependencies)
|
dependencies)
|
||||||
if answer in['y', 'Y']:
|
if answer in['y', 'Y']:
|
||||||
|
@ -136,18 +131,19 @@ class SBoInstall(object):
|
||||||
# sbo version = mdata1]
|
# sbo version = mdata1]
|
||||||
# package arch = mdata[2]
|
# package arch = mdata[2]
|
||||||
mdata = matching_data(self.name, self.UNST)
|
mdata = matching_data(self.name, self.UNST)
|
||||||
sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
|
sys.stdout.write("{0}Done{1}\n".format(color['GREY'],
|
||||||
|
color['ENDC']))
|
||||||
if mdata[0]:
|
if mdata[0]:
|
||||||
print("\nPackages with name matching [ {0}{1}{2} ]"
|
print("\nPackages with name matching [ {0}{1}{2} ]"
|
||||||
"\n".format(CYAN, self.name, ENDC))
|
"\n".format(color['CYAN'], self.name, color['ENDC']))
|
||||||
top_view()
|
top_view()
|
||||||
print("Matching:")
|
print("Matching:")
|
||||||
for match, ver, march in zip(mdata[0], mdata[1], mdata[2]):
|
for match, ver, march in zip(mdata[0], mdata[1], mdata[2]):
|
||||||
if find_package(match + sp + ver, pkg_path):
|
if find_package(match + sp + ver, pkg_path):
|
||||||
view_packages(GREEN, match, ver, "", march)
|
view_packages(color['GREEN'], match, ver, "", march)
|
||||||
count_installed += 1
|
count_installed += 1
|
||||||
else:
|
else:
|
||||||
view_packages(RED, match, ver, "", march)
|
view_packages(color['RED'], match, ver, "", march)
|
||||||
count_uninstalled += 1
|
count_uninstalled += 1
|
||||||
# insstall message = msg[0]
|
# insstall message = msg[0]
|
||||||
# uninstall message = msg[1]
|
# uninstall message = msg[1]
|
||||||
|
@ -156,10 +152,10 @@ class SBoInstall(object):
|
||||||
print("\nInstalling summary")
|
print("\nInstalling summary")
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
print("{0}Total found {1} matching {2}.".format(
|
print("{0}Total found {1} matching {2}.".format(
|
||||||
GREY, len(mdata[0]), msg[2]))
|
color['GREY'], len(mdata[0]), msg[2]))
|
||||||
print("{0} installed {1} and {2} uninstalled {3}.{4}"
|
print("{0} installed {1} and {2} uninstalled {3}.{4}"
|
||||||
"\n".format(count_installed, msg[0],
|
"\n".format(count_installed, msg[0],
|
||||||
count_uninstalled, msg[1], ENDC))
|
count_uninstalled, msg[1], color['ENDC']))
|
||||||
else:
|
else:
|
||||||
pkg_not_found("\n", self.name, "No matching", "\n")
|
pkg_not_found("\n", self.name, "No matching", "\n")
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
@ -196,7 +192,8 @@ def installing_data(dependencies, support):
|
||||||
'''
|
'''
|
||||||
package_sum = 0
|
package_sum = 0
|
||||||
sbo_versions, package_arch = [], []
|
sbo_versions, package_arch = [], []
|
||||||
sys.stdout.write("{0}Resolving dependencies ...{1}".format(GREY, ENDC))
|
sys.stdout.write("{0}Resolving dependencies ...{1}".format(
|
||||||
|
color['GREY'], color['ENDC']))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
toolbar_width, index = 2, 0
|
toolbar_width, index = 2, 0
|
||||||
for pkg in dependencies:
|
for pkg in dependencies:
|
||||||
|
@ -209,7 +206,7 @@ def installing_data(dependencies, support):
|
||||||
sbo_package = ("{0}-{1}".format(pkg, version))
|
sbo_package = ("{0}-{1}".format(pkg, version))
|
||||||
if find_package(sbo_package, pkg_path):
|
if find_package(sbo_package, pkg_path):
|
||||||
package_sum += 1
|
package_sum += 1
|
||||||
sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
|
sys.stdout.write("{0}Done{1}\n".format(color['GREY'], color['ENDC']))
|
||||||
return [sbo_versions, package_arch, package_sum, sources]
|
return [sbo_versions, package_arch, package_sum, sources]
|
||||||
|
|
||||||
|
|
||||||
|
@ -227,14 +224,14 @@ def pkg_colors_tag(name, sbo_versions, count_upg, count_ins):
|
||||||
sbo_versions = sbo_versions[-1]
|
sbo_versions = sbo_versions[-1]
|
||||||
master_pkg = ("{0}-{1}".format(name, sbo_versions))
|
master_pkg = ("{0}-{1}".format(name, sbo_versions))
|
||||||
if find_package(master_pkg, pkg_path):
|
if find_package(master_pkg, pkg_path):
|
||||||
color = GREEN
|
paint = color['GREEN']
|
||||||
elif find_package(name + sp, pkg_path):
|
elif find_package(name + sp, pkg_path):
|
||||||
color = YELLOW
|
paint = color['YELLOW']
|
||||||
count_upg += 1
|
count_upg += 1
|
||||||
else:
|
else:
|
||||||
color = RED
|
paint = color['RED']
|
||||||
count_ins += 1
|
count_ins += 1
|
||||||
return color, [count_upg, count_ins]
|
return paint, [count_upg, count_ins]
|
||||||
|
|
||||||
|
|
||||||
def arch_colors_tag(support, package_arch):
|
def arch_colors_tag(support, package_arch):
|
||||||
|
@ -243,9 +240,9 @@ def arch_colors_tag(support, package_arch):
|
||||||
'''
|
'''
|
||||||
color = ""
|
color = ""
|
||||||
if support[0] in package_arch[-1]:
|
if support[0] in package_arch[-1]:
|
||||||
color = RED
|
color = color['RED']
|
||||||
elif support[1] in package_arch[-1]:
|
elif support[1] in package_arch[-1]:
|
||||||
color = YELLOW
|
color = color['YELLOW']
|
||||||
return color
|
return color
|
||||||
|
|
||||||
|
|
||||||
|
@ -267,9 +264,9 @@ def view_packages(*args):
|
||||||
View slackbuild packages with version and arch
|
View slackbuild packages with version and arch
|
||||||
'''
|
'''
|
||||||
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
|
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
|
||||||
args[0], args[1], ENDC,
|
args[0], args[1], color['ENDC'],
|
||||||
" " * (38-len(args[1])), args[2],
|
" " * (38-len(args[1])), args[2],
|
||||||
" " * (17-len(args[2])), args[3], args[4], ENDC,
|
" " * (17-len(args[2])), args[3], args[4], color['ENDC'],
|
||||||
" " * (13-len(args[4])), "SBo"))
|
" " * (13-len(args[4])), "SBo"))
|
||||||
|
|
||||||
|
|
||||||
|
@ -294,7 +291,8 @@ def arch_support(source, support, package_sum, dependencies):
|
||||||
Exit if all packages already installed
|
Exit if all packages already installed
|
||||||
'''
|
'''
|
||||||
if source in support:
|
if source in support:
|
||||||
print("{0}The package {1}{2}\n".format(RED, source, ENDC))
|
print("{0}The package {1}{2}\n".format(color['RED'], source,
|
||||||
|
color['ENDC']))
|
||||||
answer = ""
|
answer = ""
|
||||||
elif package_sum == len(dependencies):
|
elif package_sum == len(dependencies):
|
||||||
answer = ""
|
answer = ""
|
||||||
|
@ -358,10 +356,14 @@ def build_install(dependencies, sbo_versions):
|
||||||
build_FAILED(sbo_url, prgnam)
|
build_FAILED(sbo_url, prgnam)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
if find_package(pkg + sp, pkg_path):
|
if find_package(pkg + sp, pkg_path):
|
||||||
print("{0}[ Upgrading ] --> {1}{2}".format(GREEN, ENDC, pkg))
|
print("{0}[ Upgrading ] --> {1}{2}".format(color['GREEN'],
|
||||||
|
color['ENDC'],
|
||||||
|
pkg))
|
||||||
upgraded.append(pkg)
|
upgraded.append(pkg)
|
||||||
else:
|
else:
|
||||||
print("{0}[ Installing ] --> {1}{2}".format(GREEN, ENDC, pkg))
|
print("{0}[ Installing ] --> {1}{2}".format(color['GREEN'],
|
||||||
|
color['ENDC'],
|
||||||
|
pkg))
|
||||||
PackageManager(binary).upgrade()
|
PackageManager(binary).upgrade()
|
||||||
installs.append(pkg)
|
installs.append(pkg)
|
||||||
versions.append(ver)
|
versions.append(ver)
|
||||||
|
|
|
@ -31,16 +31,9 @@ from slpkg.__metadata__ import (
|
||||||
tmp,
|
tmp,
|
||||||
build_path,
|
build_path,
|
||||||
pkg_path,
|
pkg_path,
|
||||||
|
color,
|
||||||
sp
|
sp
|
||||||
)
|
)
|
||||||
from slpkg.colors import (
|
|
||||||
RED,
|
|
||||||
GREEN,
|
|
||||||
GREY,
|
|
||||||
CYAN,
|
|
||||||
YELLOW,
|
|
||||||
ENDC
|
|
||||||
)
|
|
||||||
from slpkg.messages import (
|
from slpkg.messages import (
|
||||||
pkg_found,
|
pkg_found,
|
||||||
pkg_not_found,
|
pkg_not_found,
|
||||||
|
@ -64,7 +57,8 @@ class SBoNetwork(object):
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
self.name = name
|
self.name = name
|
||||||
Initialization().sbo()
|
Initialization().sbo()
|
||||||
sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
|
sys.stdout.write("{0}Reading package lists ...{1}".format(
|
||||||
|
color['GREY'], color['ENDC']))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
grep = SBoGrep(self.name)
|
grep = SBoGrep(self.name)
|
||||||
self.sbo_url = sbo_search_pkg(self.name)
|
self.sbo_url = sbo_search_pkg(self.name)
|
||||||
|
@ -75,7 +69,7 @@ class SBoNetwork(object):
|
||||||
self.sbo_dwn = SBoLink(self.sbo_url).tar_gz()
|
self.sbo_dwn = SBoLink(self.sbo_url).tar_gz()
|
||||||
self.sbo_version = grep.version()
|
self.sbo_version = grep.version()
|
||||||
self.space = ("\n" * 50)
|
self.space = ("\n" * 50)
|
||||||
sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
|
sys.stdout.write("{0}Done{1}\n".format(color['GREY'], color['ENDC']))
|
||||||
|
|
||||||
def view(self):
|
def view(self):
|
||||||
'''
|
'''
|
||||||
|
@ -135,28 +129,35 @@ class SBoNetwork(object):
|
||||||
'''
|
'''
|
||||||
print("") # new line at start
|
print("") # new line at start
|
||||||
template(78)
|
template(78)
|
||||||
print("| {0}Package {1}{2}{3} --> {4}".format(GREEN, CYAN, args[0],
|
print("| {0}Package {1}{2}{3} --> {4}".format(color['GREEN'],
|
||||||
GREEN, ENDC + args[1]))
|
color['CYAN'], args[0],
|
||||||
|
color['GREEN'],
|
||||||
|
color['ENDC'] + args[1]))
|
||||||
template(78)
|
template(78)
|
||||||
print("| {0}Description : {1}{2}".format(GREEN, ENDC, args[2]))
|
print("| {0}Description : {1}{2}".format(color['GREEN'],
|
||||||
print("| {0}SlackBuild : {1}{2}".format(GREEN, ENDC, args[3]))
|
color['ENDC'], args[2]))
|
||||||
print("| {0}Sources : {1}{2}".format(GREEN, ENDC, args[4]))
|
print("| {0}SlackBuild : {1}{2}".format(color['GREEN'], color['ENDC'],
|
||||||
print("| {0}Requirements : {1}{2}".format(YELLOW, ENDC,
|
args[3]))
|
||||||
|
print("| {0}Sources : {1}{2}".format(color['GREEN'], color['ENDC'],
|
||||||
|
args[4]))
|
||||||
|
print("| {0}Requirements : {1}{2}".format(color['YELLOW'],
|
||||||
|
color['ENDC'],
|
||||||
", ".join(args[5])))
|
", ".join(args[5])))
|
||||||
template(78)
|
template(78)
|
||||||
print(" {0}R{1}EADME View the README file".format(RED,
|
print(" {0}R{1}EADME View the README file".format(
|
||||||
ENDC))
|
color['RED'], color['ENDC']))
|
||||||
print(" {0}S{1}lackBuild View the SlackBuild file".format(
|
print(" {0}S{1}lackBuild View the SlackBuild file".format(
|
||||||
RED, ENDC))
|
color['RED'], color['ENDC']))
|
||||||
print(" In{0}f{1}o View the Info file".format(RED,
|
print(" In{0}f{1}o View the Info file".format(
|
||||||
ENDC))
|
color['RED'], color['ENDC']))
|
||||||
print(" {0}D{1}ownload Download this package".format(RED,
|
print(" {0}D{1}ownload Download this package".format(
|
||||||
ENDC))
|
color['RED'], color['ENDC']))
|
||||||
print(" {0}B{1}uild Download and build".format(RED,
|
print(" {0}B{1}uild Download and build".format(
|
||||||
ENDC))
|
color['RED'], color['ENDC']))
|
||||||
print(" {0}I{1}nstall Download/Build/Install".format(
|
print(" {0}I{1}nstall Download/Build/Install".format(
|
||||||
RED, ENDC))
|
color['RED'], color['ENDC']))
|
||||||
print(" {0}Q{1}uit Quit\n".format(RED, ENDC))
|
print(" {0}Q{1}uit Quit\n".format(color['RED'],
|
||||||
|
color['ENDC']))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def fill_pager(page):
|
def fill_pager(page):
|
||||||
|
@ -178,7 +179,8 @@ class SBoNetwork(object):
|
||||||
Return choice
|
Return choice
|
||||||
'''
|
'''
|
||||||
try:
|
try:
|
||||||
choice = raw_input(" {0}Choose an option: {1}".format(GREY, ENDC))
|
choice = raw_input(" {0}Choose an option: {1}".format(
|
||||||
|
color['GREY'], color['ENDC']))
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("") # new line at exit
|
print("") # new line at exit
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
@ -206,7 +208,8 @@ class SBoNetwork(object):
|
||||||
Only build and create Slackware package
|
Only build and create Slackware package
|
||||||
'''
|
'''
|
||||||
if FAULT:
|
if FAULT:
|
||||||
print("\n{0}The package {1} {2}\n".format(RED, FAULT, ENDC))
|
print("\n{0}The package {1} {2}\n".format(color['RED'], FAULT,
|
||||||
|
color['ENDC']))
|
||||||
sys.exit()
|
sys.exit()
|
||||||
sources = []
|
sources = []
|
||||||
os.chdir(build_path)
|
os.chdir(build_path)
|
||||||
|
@ -231,5 +234,7 @@ class SBoNetwork(object):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
build_FAILED(self.sbo_url, prgnam)
|
build_FAILED(self.sbo_url, prgnam)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
print("[ {0}Installing{1} ] --> {2}".format(GREEN, ENDC, self.name))
|
print("[ {0}Installing{1} ] --> {2}".format(color['GREEN'],
|
||||||
|
color['ENDC'],
|
||||||
|
self.name))
|
||||||
PackageManager(binary).upgrade()
|
PackageManager(binary).upgrade()
|
||||||
|
|
|
@ -32,19 +32,12 @@ from slpkg.messages import (
|
||||||
pkg_not_found,
|
pkg_not_found,
|
||||||
template
|
template
|
||||||
)
|
)
|
||||||
from slpkg.colors import (
|
|
||||||
RED,
|
|
||||||
GREEN,
|
|
||||||
CYAN,
|
|
||||||
YELLOW,
|
|
||||||
GREY,
|
|
||||||
ENDC
|
|
||||||
)
|
|
||||||
from slpkg.__metadata__ import (
|
from slpkg.__metadata__ import (
|
||||||
pkg_path,
|
pkg_path,
|
||||||
lib_path,
|
lib_path,
|
||||||
slpkg_tmp_packages,
|
slpkg_tmp_packages,
|
||||||
default_answer
|
default_answer,
|
||||||
|
color
|
||||||
)
|
)
|
||||||
|
|
||||||
from slpkg.pkg.find import find_package
|
from slpkg.pkg.find import find_package
|
||||||
|
@ -64,8 +57,9 @@ class Slack(object):
|
||||||
self.tmp_path = slpkg_tmp_packages
|
self.tmp_path = slpkg_tmp_packages
|
||||||
Initialization().slack()
|
Initialization().slack()
|
||||||
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
|
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
|
||||||
CYAN, self.slack_pkg, ENDC))
|
color['CYAN'], self.slack_pkg, color['ENDC']))
|
||||||
sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
|
sys.stdout.write("{0}Reading package lists ...{1}".format(
|
||||||
|
color['GREY'], color['ENDC']))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
Initialization().slack()
|
Initialization().slack()
|
||||||
lib = lib_path + "slack_repo/PACKAGES.TXT"
|
lib = lib_path + "slack_repo/PACKAGES.TXT"
|
||||||
|
@ -79,7 +73,8 @@ class Slack(object):
|
||||||
'''
|
'''
|
||||||
try:
|
try:
|
||||||
dwn_links, install_all, comp_sum, uncomp_sum = self.store()
|
dwn_links, install_all, comp_sum, uncomp_sum = self.store()
|
||||||
sys.stdout.write("{0}Done{1}\n\n".format(GREY, ENDC))
|
sys.stdout.write("{0}Done{1}\n\n".format(color['GREY'],
|
||||||
|
color['ENDC']))
|
||||||
if install_all:
|
if install_all:
|
||||||
template(78)
|
template(78)
|
||||||
print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
|
print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
|
||||||
|
@ -96,15 +91,16 @@ class Slack(object):
|
||||||
msg = msgs(install_all, sums[2])
|
msg = msgs(install_all, sums[2])
|
||||||
print("\nInstalling summary")
|
print("\nInstalling summary")
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
print("{0}Total {1} {2}.".format(GREY, len(install_all),
|
print("{0}Total {1} {2}.".format(color['GREY'],
|
||||||
msg[0]))
|
len(install_all), msg[0]))
|
||||||
print("{0} {1} will be installed, {2} will be upgraded and "
|
print("{0} {1} will be installed, {2} will be upgraded and "
|
||||||
"{3} will be resettled.".format(sums[2], msg[1],
|
"{3} will be resettled.".format(sums[2], msg[1],
|
||||||
sums[1], sums[0]))
|
sums[1], sums[0]))
|
||||||
print("Need to get {0} {1} of archives.".format(size[0],
|
print("Need to get {0} {1} of archives.".format(size[0],
|
||||||
unit[0]))
|
unit[0]))
|
||||||
print("After this process, {0} {1} of additional disk space "
|
print("After this process, {0} {1} of additional disk space "
|
||||||
"will be used.{2}".format(size[1], unit[1], ENDC))
|
"will be used.{2}".format(size[1], unit[1],
|
||||||
|
color['ENDC']))
|
||||||
if default_answer == "y":
|
if default_answer == "y":
|
||||||
answer = default_answer
|
answer = default_answer
|
||||||
else:
|
else:
|
||||||
|
@ -145,15 +141,15 @@ def views(install_all, comp_sum):
|
||||||
pkg_split = split_package(pkg[:-4])
|
pkg_split = split_package(pkg[:-4])
|
||||||
if os.path.isfile(pkg_path + pkg[:-4]):
|
if os.path.isfile(pkg_path + pkg[:-4]):
|
||||||
pkg_sum += 1
|
pkg_sum += 1
|
||||||
COLOR = GREEN
|
COLOR = color['GREEN']
|
||||||
elif find_package(pkg_split[0] + "-", pkg_path):
|
elif find_package(pkg_split[0] + "-", pkg_path):
|
||||||
COLOR = YELLOW
|
COLOR = color['YELLOW']
|
||||||
upg_sum += 1
|
upg_sum += 1
|
||||||
else:
|
else:
|
||||||
COLOR = RED
|
COLOR = color['RED']
|
||||||
uni_sum += 1
|
uni_sum += 1
|
||||||
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11:>12}{12}".format(
|
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11:>12}{12}".format(
|
||||||
COLOR, pkg_split[0], ENDC,
|
COLOR, pkg_split[0], color['ENDC'],
|
||||||
" " * (25-len(pkg_split[0])), pkg_split[1],
|
" " * (25-len(pkg_split[0])), pkg_split[1],
|
||||||
" " * (19-len(pkg_split[1])), pkg_split[2],
|
" " * (19-len(pkg_split[1])), pkg_split[2],
|
||||||
" " * (8-len(pkg_split[2])), pkg_split[3],
|
" " * (8-len(pkg_split[2])), pkg_split[3],
|
||||||
|
@ -182,11 +178,17 @@ def install(tmp_path, install_all):
|
||||||
for install in install_all:
|
for install in install_all:
|
||||||
package = (tmp_path + install).split()
|
package = (tmp_path + install).split()
|
||||||
if os.path.isfile(pkg_path + install[:-4]):
|
if os.path.isfile(pkg_path + install[:-4]):
|
||||||
print("[ {0}reinstalling{1} ] --> {2}".format(GREEN, ENDC, install))
|
print("[ {0}reinstalling{1} ] --> {2}".format(color['GREEN'],
|
||||||
|
color['ENDC'],
|
||||||
|
install))
|
||||||
PackageManager(package).reinstall()
|
PackageManager(package).reinstall()
|
||||||
elif find_package(split_package(install)[0] + "-", pkg_path):
|
elif find_package(split_package(install)[0] + "-", pkg_path):
|
||||||
print("[ {0}upgrading{1} ] --> {2}".format(YELLOW, ENDC, install))
|
print("[ {0}upgrading{1} ] --> {2}".format(color['YELLOW'],
|
||||||
|
color['ENDC'],
|
||||||
|
install))
|
||||||
PackageManager(package).upgrade()
|
PackageManager(package).upgrade()
|
||||||
else:
|
else:
|
||||||
print("[ {0}installing{1} ] --> {2}".format(GREEN, ENDC, install))
|
print("[ {0}installing{1} ] --> {2}".format(color['GREEN'],
|
||||||
|
color['ENDC'],
|
||||||
|
install))
|
||||||
PackageManager(package).upgrade()
|
PackageManager(package).upgrade()
|
||||||
|
|
|
@ -30,15 +30,11 @@ from slpkg.url_read import URL
|
||||||
from slpkg.messages import template
|
from slpkg.messages import template
|
||||||
from slpkg.blacklist import BlackList
|
from slpkg.blacklist import BlackList
|
||||||
from slpkg.splitting import split_package
|
from slpkg.splitting import split_package
|
||||||
from slpkg.colors import (
|
|
||||||
GREY,
|
|
||||||
YELLOW,
|
|
||||||
ENDC
|
|
||||||
)
|
|
||||||
from slpkg.__metadata__ import (
|
from slpkg.__metadata__ import (
|
||||||
pkg_path,
|
pkg_path,
|
||||||
slpkg_tmp_patches,
|
slpkg_tmp_patches,
|
||||||
default_answer
|
default_answer,
|
||||||
|
color
|
||||||
)
|
)
|
||||||
|
|
||||||
from slpkg.pkg.find import find_package
|
from slpkg.pkg.find import find_package
|
||||||
|
@ -56,7 +52,8 @@ class Patches(object):
|
||||||
def __init__(self, version):
|
def __init__(self, version):
|
||||||
self.version = version
|
self.version = version
|
||||||
self.patch_path = slpkg_tmp_patches
|
self.patch_path = slpkg_tmp_patches
|
||||||
sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
|
sys.stdout.write("{0}Reading package lists ...{1}".format(
|
||||||
|
color['GREY'], color['ENDC']))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
if version == "stable":
|
if version == "stable":
|
||||||
self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "patches/",
|
self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "patches/",
|
||||||
|
@ -73,7 +70,8 @@ class Patches(object):
|
||||||
'''
|
'''
|
||||||
try:
|
try:
|
||||||
dwn_links, upgrade_all, comp_sum, uncomp_sum = self.store()
|
dwn_links, upgrade_all, comp_sum, uncomp_sum = self.store()
|
||||||
sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
|
sys.stdout.write("{0}Done{1}\n".format(color['GREY'],
|
||||||
|
color['ENDC']))
|
||||||
if upgrade_all:
|
if upgrade_all:
|
||||||
print("\nThese packages need upgrading:\n")
|
print("\nThese packages need upgrading:\n")
|
||||||
template(78)
|
template(78)
|
||||||
|
@ -91,11 +89,12 @@ class Patches(object):
|
||||||
print("\nInstalling summary")
|
print("\nInstalling summary")
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
print("{0}Total {1} {2} will be upgraded.".format(
|
print("{0}Total {1} {2} will be upgraded.".format(
|
||||||
GREY, len(upgrade_all), msgs(upgrade_all)))
|
color['GREY'], len(upgrade_all), msgs(upgrade_all)))
|
||||||
print("Need to get {0} {1} of archives.".format(size[0],
|
print("Need to get {0} {1} of archives.".format(size[0],
|
||||||
unit[0]))
|
unit[0]))
|
||||||
print("After this process, {0} {1} of additional disk space "
|
print("After this process, {0} {1} of additional disk space "
|
||||||
"will be used.{2}".format(size[1], unit[1], ENDC))
|
"will be used.{2}".format(size[1], unit[1],
|
||||||
|
color['ENDC']))
|
||||||
if default_answer == "y":
|
if default_answer == "y":
|
||||||
answer = default_answer
|
answer = default_answer
|
||||||
else:
|
else:
|
||||||
|
@ -141,7 +140,7 @@ def views(upgrade_all, comp_sum):
|
||||||
for upgrade, size in zip(upgrade_all, comp_sum):
|
for upgrade, size in zip(upgrade_all, comp_sum):
|
||||||
pkg_split = split_package(upgrade[:-4])
|
pkg_split = split_package(upgrade[:-4])
|
||||||
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11:>12}{12}".format(
|
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11:>12}{12}".format(
|
||||||
YELLOW, pkg_split[0], ENDC,
|
color['YELLOW'], pkg_split[0], color['ENDC'],
|
||||||
" " * (25-len(pkg_split[0])), pkg_split[1],
|
" " * (25-len(pkg_split[0])), pkg_split[1],
|
||||||
" " * (19-len(pkg_split[1])), pkg_split[2],
|
" " * (19-len(pkg_split[1])), pkg_split[2],
|
||||||
" " * (8-len(pkg_split[2])), pkg_split[3],
|
" " * (8-len(pkg_split[2])), pkg_split[3],
|
||||||
|
@ -164,7 +163,8 @@ def upgrade(patch_path, upgrade_all):
|
||||||
Upgrade packages
|
Upgrade packages
|
||||||
'''
|
'''
|
||||||
for pkg in upgrade_all:
|
for pkg in upgrade_all:
|
||||||
print("[ {0}upgrading{1} ] --> {2}".format(YELLOW, ENDC, pkg[:-4]))
|
print("[ {0}upgrading{1} ] --> {2}".format(color['YELLOW'],
|
||||||
|
color['ENDC'], pkg[:-4]))
|
||||||
PackageManager((patch_path + pkg).split()).upgrade()
|
PackageManager((patch_path + pkg).split()).upgrade()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,7 @@
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from colors import (
|
from __metadata__ import color
|
||||||
GREY,
|
|
||||||
ENDC
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def status(index, width, step):
|
def status(index, width, step):
|
||||||
|
@ -35,7 +32,7 @@ def status(index, width, step):
|
||||||
Print toolbar status
|
Print toolbar status
|
||||||
'''
|
'''
|
||||||
if index == width:
|
if index == width:
|
||||||
sys.stdout.write("{0}.{1}".format(GREY, ENDC))
|
sys.stdout.write("{0}.{1}".format(color['GREY'], color['ENDC']))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
width += step
|
width += step
|
||||||
time.sleep(0.05)
|
time.sleep(0.05)
|
||||||
|
|
|
@ -27,16 +27,9 @@ from messages import template
|
||||||
from init import Initialization
|
from init import Initialization
|
||||||
from __metadata__ import (
|
from __metadata__ import (
|
||||||
pkg_path,
|
pkg_path,
|
||||||
|
color,
|
||||||
sp
|
sp
|
||||||
)
|
)
|
||||||
from colors import (
|
|
||||||
RED,
|
|
||||||
GREEN,
|
|
||||||
GREY,
|
|
||||||
YELLOW,
|
|
||||||
CYAN,
|
|
||||||
ENDC
|
|
||||||
)
|
|
||||||
|
|
||||||
from pkg.find import find_package
|
from pkg.find import find_package
|
||||||
|
|
||||||
|
@ -62,7 +55,8 @@ def track_dep(name, repo):
|
||||||
'slacky': Initialization().slacky
|
'slacky': Initialization().slacky
|
||||||
}
|
}
|
||||||
init_repos[repo]()
|
init_repos[repo]()
|
||||||
sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
|
sys.stdout.write("{0}Reading package lists ...{1}".format(color['GREY'],
|
||||||
|
color['ENDC']))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
if repo == "sbo":
|
if repo == "sbo":
|
||||||
dependencies_list = sbo_dependencies_pkg(name)
|
dependencies_list = sbo_dependencies_pkg(name)
|
||||||
|
@ -70,7 +64,7 @@ def track_dep(name, repo):
|
||||||
else:
|
else:
|
||||||
dependencies_list = dependencies_pkg(name, repo)
|
dependencies_list = dependencies_pkg(name, repo)
|
||||||
find_pkg = search_pkg(name, repo)
|
find_pkg = search_pkg(name, repo)
|
||||||
sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
|
sys.stdout.write("{0}Done{1}\n".format(color['GREY'], color['ENDC']))
|
||||||
if find_pkg:
|
if find_pkg:
|
||||||
requires, dependencies = [], []
|
requires, dependencies = [], []
|
||||||
# Create one list for all packages
|
# Create one list for all packages
|
||||||
|
@ -86,20 +80,23 @@ def track_dep(name, repo):
|
||||||
pkg_len = len(name) + 24
|
pkg_len = len(name) + 24
|
||||||
print("") # new line at start
|
print("") # new line at start
|
||||||
template(pkg_len)
|
template(pkg_len)
|
||||||
print("| Package {0}{1}{2} dependencies :".format(CYAN, name, ENDC))
|
print("| Package {0}{1}{2} dependencies :".format(color['CYAN'], name,
|
||||||
|
color['ENDC']))
|
||||||
template(pkg_len)
|
template(pkg_len)
|
||||||
print("\\")
|
print("\\")
|
||||||
print(" +---{0}[ Tree of dependencies ]{1}".format(YELLOW, ENDC))
|
print(" +---{0}[ Tree of dependencies ]{1}".format(color['YELLOW'],
|
||||||
|
color['ENDC']))
|
||||||
index = 0
|
index = 0
|
||||||
for pkg in dependencies:
|
for pkg in dependencies:
|
||||||
index += 1
|
index += 1
|
||||||
if find_package(pkg + sp, pkg_path):
|
if find_package(pkg + sp, pkg_path):
|
||||||
print(" |")
|
print(" |")
|
||||||
print(" {0}{1}: {2}{3}{4}".format("+--", index, GREEN, pkg,
|
print(" {0}{1}: {2}{3}{4}".format("+--", index, color['GREEN'],
|
||||||
ENDC))
|
pkg, color['ENDC']))
|
||||||
else:
|
else:
|
||||||
print(" |")
|
print(" |")
|
||||||
print(" {0}{1}: {2}{3}{4}".format("+--", index, RED, pkg, ENDC))
|
print(" {0}{1}: {2}{3}{4}".format("+--", index, color['RED'],
|
||||||
|
pkg, color['ENDC']))
|
||||||
print("") # new line at end
|
print("") # new line at end
|
||||||
else:
|
else:
|
||||||
print("\nNo package was found to match\n")
|
print("\nNo package was found to match\n")
|
||||||
|
|
Loading…
Reference in a new issue