mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-13 20:01:48 +01:00
align to PEP8 style
This commit is contained in:
parent
b215018bc3
commit
21340c8cf2
28 changed files with 468 additions and 387 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,3 +5,4 @@ __pycache__
|
||||||
.pipy
|
.pipy
|
||||||
*.egg-info/
|
*.egg-info/
|
||||||
/slpkg_Build
|
/slpkg_Build
|
||||||
|
.ropeproject/
|
||||||
|
|
11
bin/slpkg
11
bin/slpkg
|
@ -21,16 +21,16 @@
|
||||||
# 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/>.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
_ _
|
_ _
|
||||||
___| |_ __ | | ____ _
|
___| |_ __ | | ____ _
|
||||||
/ __| | '_ \| |/ / _` |
|
/ __| | '_ \| |/ / _` |
|
||||||
\__ \ | |_) | < (_| |
|
\__ \ | |_) | < (_| |
|
||||||
|___/_| .__/|_|\_\__, |
|
|___/_| .__/|_|\_\__, |
|
||||||
|_| |___/
|
|_| |___/
|
||||||
|
|
||||||
Slpkg is a terminal tool in order to easy use
|
Slpkg is a terminal tool in order to easy use
|
||||||
Slackware packages.It's a quick and easy way
|
Slackware packages.It's a quick and easy way
|
||||||
to manage your packages in slackware to a command.
|
to manage your packages in slackware to a command.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -38,4 +38,3 @@ from slpkg import main
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
4
setup.py
4
setup.py
|
@ -40,7 +40,7 @@ setup(
|
||||||
version=__version__,
|
version=__version__,
|
||||||
description="Python tool to manage Slackware packages",
|
description="Python tool to manage Slackware packages",
|
||||||
keywords=["slackware", "slpkg", "upgrade", "install", "remove",
|
keywords=["slackware", "slpkg", "upgrade", "install", "remove",
|
||||||
"view", "slackpkg", "tool", "build"],
|
"view", "slackpkg", "tool", "build"],
|
||||||
author=__author__,
|
author=__author__,
|
||||||
author_email=__email__,
|
author_email=__email__,
|
||||||
url="https://github.com/dslackw/slpkg",
|
url="https://github.com/dslackw/slpkg",
|
||||||
|
@ -62,7 +62,7 @@ setup(
|
||||||
long_description=open("README.rst").read()
|
long_description=open("README.rst").read()
|
||||||
)
|
)
|
||||||
|
|
||||||
# install man page and blacklist configuration
|
# install man page and blacklist configuration
|
||||||
# file if not exists.
|
# file if not exists.
|
||||||
if "install" in sys.argv:
|
if "install" in sys.argv:
|
||||||
man_path = "/usr/man/man8/"
|
man_path = "/usr/man/man8/"
|
||||||
|
|
|
@ -23,11 +23,12 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from colors import *
|
from colors import RED, GREEN, ENDC
|
||||||
from __metadata__ import bls_path
|
from __metadata__ import bls_path
|
||||||
|
|
||||||
|
|
||||||
class BlackList(object):
|
class BlackList(object):
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Blacklist class to add, remove or listed packages
|
Blacklist class to add, remove or listed packages
|
||||||
in blacklist file.
|
in blacklist file.
|
||||||
|
@ -38,37 +39,37 @@ class BlackList(object):
|
||||||
create it by default.
|
create it by default.
|
||||||
'''
|
'''
|
||||||
blacklist_conf = [
|
blacklist_conf = [
|
||||||
"# This is the blacklist file. Each package listed here may not be\n",
|
"# This is the blacklist file. Each package listed here may not be\n",
|
||||||
"# installed be upgraded be find or deleted.\n",
|
"# installed be upgraded be find or deleted.\n",
|
||||||
"# NOTE: The settings here affect all repositories.\n",
|
"# NOTE: The settings here affect all repositories.\n",
|
||||||
"#\n",
|
"#\n",
|
||||||
"# An example syntax is as follows:\n",
|
"# An example syntax is as follows:\n",
|
||||||
"# add a package from SBo repository:\n",
|
"# add a package from SBo repository:\n",
|
||||||
"# brasero\n",
|
"# brasero\n",
|
||||||
"#\n",
|
"#\n",
|
||||||
"# Add package from slackware repository:\n",
|
"# Add package from slackware repository:\n",
|
||||||
"# example add package 'wicd-1.7.2.4-x86_64-4.txz':\n",
|
"# example add package 'wicd-1.7.2.4-x86_64-4.txz':\n",
|
||||||
"# wicd\n",
|
"# wicd\n",
|
||||||
"#\n",
|
"#\n",
|
||||||
"# Sometimes the automatic kernel update creates problems because you\n",
|
"# Sometimes the automatic kernel update creates problems because you\n",
|
||||||
"# may need to file intervention 'lilo'. The slpkg automatically detects\n",
|
"# may need to file intervention 'lilo'. The slpkg automatically detects\n",
|
||||||
"# if the core has been upgraded and running 'lilo'. If you want to avoid\n",
|
"# if the core has been upgraded and running 'lilo'. If you want to avoid\n",
|
||||||
"# any problems uncomment the lines below.\n",
|
"# any problems uncomment the lines below.\n",
|
||||||
"#\n",
|
"#\n",
|
||||||
"# kernel-firmware\n",
|
"# kernel-firmware\n",
|
||||||
"# kernel-generic\n",
|
"# kernel-generic\n",
|
||||||
"# kernel-generic-smp\n",
|
"# kernel-generic-smp\n",
|
||||||
"# kernel-headers\n",
|
"# kernel-headers\n",
|
||||||
"# kernel-huge\n",
|
"# kernel-huge\n",
|
||||||
"# kernel-huge-smp\n",
|
"# kernel-huge-smp\n",
|
||||||
"# kernel-modules\n",
|
"# kernel-modules\n",
|
||||||
"# kernel-modules-smp\n",
|
"# kernel-modules-smp\n",
|
||||||
"# kernel-source\n"
|
"# kernel-source\n"
|
||||||
"#\n",
|
"#\n",
|
||||||
"#\n",
|
"#\n",
|
||||||
"# aaa_elflibs can't be updated.\n",
|
"# aaa_elflibs can't be updated.\n",
|
||||||
"aaa_elflibs\n"
|
"aaa_elflibs\n"
|
||||||
]
|
]
|
||||||
self.blackfile = bls_path + "blacklist"
|
self.blackfile = bls_path + "blacklist"
|
||||||
if not os.path.exists(bls_path):
|
if not os.path.exists(bls_path):
|
||||||
os.mkdir(bls_path)
|
os.mkdir(bls_path)
|
||||||
|
@ -77,10 +78,10 @@ class BlackList(object):
|
||||||
for line in blacklist_conf:
|
for line in blacklist_conf:
|
||||||
conf.write(line)
|
conf.write(line)
|
||||||
conf.close()
|
conf.close()
|
||||||
|
|
||||||
def packages(self):
|
def packages(self):
|
||||||
'''
|
'''
|
||||||
Return blacklist packages from /etc/slpkg/blacklist
|
Return blacklist packages from /etc/slpkg/blacklist
|
||||||
configuration file.
|
configuration file.
|
||||||
'''
|
'''
|
||||||
blacklist = []
|
blacklist = []
|
||||||
|
@ -88,7 +89,7 @@ class BlackList(object):
|
||||||
for read in black_conf:
|
for read in black_conf:
|
||||||
read = read.lstrip()
|
read = read.lstrip()
|
||||||
if not read.startswith("#"):
|
if not read.startswith("#"):
|
||||||
blacklist.append(read.replace("\n", ""))
|
blacklist.append(read.replace("\n", ""))
|
||||||
black_conf.close()
|
black_conf.close()
|
||||||
return blacklist
|
return blacklist
|
||||||
|
|
||||||
|
@ -103,7 +104,7 @@ class BlackList(object):
|
||||||
print("{0}{1}{2}".format(GREEN, black, ENDC))
|
print("{0}{1}{2}".format(GREEN, black, ENDC))
|
||||||
exit = 1
|
exit = 1
|
||||||
if exit == 1:
|
if exit == 1:
|
||||||
print # new line at exit
|
print # new line at exit
|
||||||
|
|
||||||
def add(self, pkgs):
|
def add(self, pkgs):
|
||||||
'''
|
'''
|
||||||
|
@ -121,7 +122,7 @@ class BlackList(object):
|
||||||
exit = 1
|
exit = 1
|
||||||
black_conf.close()
|
black_conf.close()
|
||||||
if exit == 1:
|
if exit == 1:
|
||||||
print # new line at exit
|
print # new line at exit
|
||||||
|
|
||||||
def remove(self, pkgs):
|
def remove(self, pkgs):
|
||||||
'''
|
'''
|
||||||
|
@ -129,7 +130,6 @@ class BlackList(object):
|
||||||
'''
|
'''
|
||||||
exit = 0
|
exit = 0
|
||||||
print("\nRemove packages from blacklist:\n")
|
print("\nRemove packages from blacklist:\n")
|
||||||
|
|
||||||
with open(self.blackfile, "r") as black_conf:
|
with open(self.blackfile, "r") as black_conf:
|
||||||
lines = black_conf.read()
|
lines = black_conf.read()
|
||||||
black_conf.close()
|
black_conf.close()
|
||||||
|
@ -142,4 +142,4 @@ class BlackList(object):
|
||||||
exit = 1
|
exit = 1
|
||||||
black_conf.close()
|
black_conf.close()
|
||||||
if exit == 1:
|
if exit == 1:
|
||||||
print # new line at exit
|
print # new line at exit
|
||||||
|
|
|
@ -23,10 +23,11 @@
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
|
|
||||||
def md5sum(source):
|
def md5sum(source):
|
||||||
'''
|
'''
|
||||||
Calculate the md5 checksum
|
Calculate the md5 checksum
|
||||||
'''
|
'''
|
||||||
with open(source) as file_to_check:
|
with open(source) as file_to_check:
|
||||||
data = file_to_check.read()
|
data = file_to_check.read()
|
||||||
return hashlib.md5(data).hexdigest()
|
return hashlib.md5(data).hexdigest()
|
||||||
|
|
|
@ -21,6 +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/>.
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Foreground colors
|
Foreground colors
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -21,11 +21,10 @@
|
||||||
# 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/>.
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from colors import *
|
from colors import GREEN, ENDC
|
||||||
|
|
||||||
|
|
||||||
class Download(object):
|
class Download(object):
|
||||||
|
@ -41,10 +40,11 @@ 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} {2}\n".format(GREEN, ENDC, self.file_name))
|
print("\n{0}[ Download ] -->{1} {2}\n".format(GREEN, ENDC,
|
||||||
|
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(
|
||||||
self.path, self.url), shell=True)
|
self.path, self.url), shell=True)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print # new line at cancel
|
print # new line at cancel
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
|
@ -30,7 +30,7 @@ class FileSize(object):
|
||||||
|
|
||||||
def __init__(self, registry):
|
def __init__(self, registry):
|
||||||
self.registry = registry
|
self.registry = registry
|
||||||
|
|
||||||
def server(self):
|
def server(self):
|
||||||
'''
|
'''
|
||||||
Returns the size of remote files
|
Returns the size of remote files
|
||||||
|
@ -43,7 +43,7 @@ class FileSize(object):
|
||||||
print("\nError: connection refused\n")
|
print("\nError: connection refused\n")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print # new line at exit
|
print # new line at cancle
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
def local(self):
|
def local(self):
|
||||||
|
|
|
@ -23,10 +23,8 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import getpass
|
|
||||||
|
|
||||||
from file_size import *
|
from file_size import FileSize
|
||||||
from messages import s_user
|
|
||||||
from url_read import url_read
|
from url_read import url_read
|
||||||
from __metadata__ import log_path, lib_path
|
from __metadata__ import log_path, lib_path
|
||||||
|
|
||||||
|
@ -35,7 +33,7 @@ from slack.slack_version import slack_ver
|
||||||
|
|
||||||
def initialization():
|
def initialization():
|
||||||
'''
|
'''
|
||||||
Slpkg initialization, creating directories and SLACKBUILDS.TXT in
|
Slpkg initialization, creating directories and SLACKBUILDS.TXT in
|
||||||
/var/lib/slpkg/sbo_repo/ and ChangeLog.txt in /var/log/slpkg/ from
|
/var/lib/slpkg/sbo_repo/ and ChangeLog.txt in /var/log/slpkg/ from
|
||||||
slackbuilds.org.
|
slackbuilds.org.
|
||||||
'''
|
'''
|
||||||
|
@ -53,14 +51,15 @@ def initialization():
|
||||||
if not os.path.exists(pkg_que):
|
if not os.path.exists(pkg_que):
|
||||||
os.mkdir(pkg_que)
|
os.mkdir(pkg_que)
|
||||||
sbo_url = ("http://slackbuilds.org/slackbuilds/{0}/".format(slack_ver()))
|
sbo_url = ("http://slackbuilds.org/slackbuilds/{0}/".format(slack_ver()))
|
||||||
# Read SLACKBUILDS.TXT from slackbuilds.org and write in /var/lib/slpkg/sbo_repo/
|
# Read SLACKBUILDS.TXT from slackbuilds.org and write in
|
||||||
# directory if not exist
|
# /var/lib/slpkg/sbo_repo directory if not exist
|
||||||
if not os.path.isfile(sbo_lib + "SLACKBUILDS.TXT"):
|
if not os.path.isfile(sbo_lib + "SLACKBUILDS.TXT"):
|
||||||
print("\nslpkg ...initialization")
|
print("\nslpkg ...initialization")
|
||||||
sys.stdout.write("SLACKBUILDS.TXT read ...")
|
sys.stdout.write("SLACKBUILDS.TXT read ...")
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
SLACKBUILDS_TXT = url_read((
|
SLACKBUILDS_TXT = url_read((
|
||||||
"http://slackbuilds.org/slackbuilds/{0}/SLACKBUILDS.TXT".format(slack_ver())))
|
"http://slackbuilds.org/slackbuilds/{0}/SLACKBUILDS.TXT".format(
|
||||||
|
slack_ver())))
|
||||||
sys.stdout.write("Done\n")
|
sys.stdout.write("Done\n")
|
||||||
with open("{0}SLACKBUILDS.TXT".format(sbo_lib), "w") as sbo:
|
with open("{0}SLACKBUILDS.TXT".format(sbo_lib), "w") as sbo:
|
||||||
sbo.write(SLACKBUILDS_TXT)
|
sbo.write(SLACKBUILDS_TXT)
|
||||||
|
@ -73,7 +72,8 @@ def initialization():
|
||||||
sys.stdout.write("ChangeLog.txt read ...")
|
sys.stdout.write("ChangeLog.txt read ...")
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
ChangeLog_txt = url_read((
|
ChangeLog_txt = url_read((
|
||||||
"http://slackbuilds.org/slackbuilds/{0}/ChangeLog.txt".format(slack_ver())))
|
"http://slackbuilds.org/slackbuilds/{0}/ChangeLog.txt".format(
|
||||||
|
slack_ver())))
|
||||||
sys.stdout.write("Done\n")
|
sys.stdout.write("Done\n")
|
||||||
with open("{0}ChangeLog.txt".format(sbo_log), "w") as log:
|
with open("{0}ChangeLog.txt".format(sbo_log), "w") as log:
|
||||||
log.write(ChangeLog_txt)
|
log.write(ChangeLog_txt)
|
||||||
|
@ -91,9 +91,11 @@ def initialization():
|
||||||
sys.stdout.write("Files re-created ...")
|
sys.stdout.write("Files re-created ...")
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
SLACKBUILDS_TXT = url_read((
|
SLACKBUILDS_TXT = url_read((
|
||||||
"http://slackbuilds.org/slackbuilds/{0}/SLACKBUILDS.TXT".format(slack_ver())))
|
"http://slackbuilds.org/slackbuilds/{0}/SLACKBUILDS.TXT".format(
|
||||||
|
slack_ver())))
|
||||||
ChangeLog_txt = url_read((
|
ChangeLog_txt = url_read((
|
||||||
"http://slackbuilds.org/slackbuilds/{0}/ChangeLog.txt".format(slack_ver())))
|
"http://slackbuilds.org/slackbuilds/{0}/ChangeLog.txt".format(
|
||||||
|
slack_ver())))
|
||||||
with open("{0}SLACKBUILDS.TXT".format(sbo_lib), "w") as sbo:
|
with open("{0}SLACKBUILDS.TXT".format(sbo_lib), "w") as sbo:
|
||||||
sbo.write(SLACKBUILDS_TXT)
|
sbo.write(SLACKBUILDS_TXT)
|
||||||
sbo.close()
|
sbo.close()
|
||||||
|
|
125
slpkg/main.py
125
slpkg/main.py
|
@ -24,7 +24,6 @@
|
||||||
import sys
|
import sys
|
||||||
import getpass
|
import getpass
|
||||||
|
|
||||||
from colors import *
|
|
||||||
from queue import QueuePkgs
|
from queue import QueuePkgs
|
||||||
from messages import s_user
|
from messages import s_user
|
||||||
from blacklist import BlackList
|
from blacklist import BlackList
|
||||||
|
@ -32,7 +31,7 @@ from version import prog_version
|
||||||
from __metadata__ import path, __version__
|
from __metadata__ import path, __version__
|
||||||
|
|
||||||
from pkg.build import build_package
|
from pkg.build import build_package
|
||||||
from pkg.manager import PackageManager
|
from pkg.manager import PackageManager
|
||||||
|
|
||||||
from sbo.check import sbo_check
|
from sbo.check import sbo_check
|
||||||
from sbo.views import sbo_network
|
from sbo.views import sbo_network
|
||||||
|
@ -44,56 +43,61 @@ from slack.install import install
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# root privileges required
|
|
||||||
|
# root privileges required
|
||||||
s_user(getpass.getuser())
|
s_user(getpass.getuser())
|
||||||
arguments = [
|
arguments = [
|
||||||
"slpkg - version {0}\n".format(__version__),
|
"slpkg - version {0}\n".format(__version__),
|
||||||
"Utility for easy management packages in Slackware\n",
|
"Utility for easy management packages in Slackware\n",
|
||||||
"Optional arguments:",
|
"Optional arguments:",
|
||||||
" -h, --help show this help message and exit",
|
" -h, --help show this help message and exit",
|
||||||
" -v, --version print version and exit",
|
" -v, --version print version and exit",
|
||||||
" -a, script [source...] auto build packages",
|
" -a, script [source...] auto build 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 packages in queue",
|
" -q, --list, [package...] --add, --remove add, remove packages in queue",
|
||||||
" --build, --install, --build-install build or install from queue",
|
" --build, --install, --build-install build or install from queue",
|
||||||
" -l, all, sbo, slack, noarch list of installed packages",
|
" -l, all, sbo, slack, noarch list of installed packages",
|
||||||
" -c, <repository> --upgrade --current check for updated packages",
|
" -c, <repository> --upgrade --current check for updated packages",
|
||||||
" -s, <repository> <package> --current download, build & install",
|
" -s, <repository> <package> --current download, build & install",
|
||||||
" -f, <package> find installed packages",
|
" -f, <package> find installed packages",
|
||||||
" -t, <package> tracking dependencies from SBo",
|
" -t, <package> tracking dependencies from SBo",
|
||||||
" -n, <package> view packages from SBo",
|
" -n, <package> view packages from SBo",
|
||||||
" -i, [package...] install binary packages",
|
" -i, [package...] install binary packages",
|
||||||
" -u, [package...] upgrade binary packages",
|
" -u, [package...] upgrade binary packages",
|
||||||
" -o, [package...] reinstall binary packages",
|
" -o, [package...] reinstall binary packages",
|
||||||
" -r, [package...] remove binary packages",
|
" -r, [package...] remove binary packages",
|
||||||
" -d, [package...] display the contents\n",
|
" -d, [package...] display the contents\n",
|
||||||
"Repositories:",
|
"Repositories:",
|
||||||
" SlackBuilds = sbo",
|
" SlackBuilds = sbo",
|
||||||
" Slackware = slack '--current'\n",
|
" Slackware = slack '--current'\n",
|
||||||
]
|
]
|
||||||
usage = [
|
usage = [
|
||||||
"slpkg - version {0}\n".format(__version__),
|
"slpkg - version {0}\n".format(__version__),
|
||||||
"Usage: slpkg [-h] [-v] [-a script [sources...]]",
|
"Usage: slpkg [-h] [-v] [-a script [sources...]]",
|
||||||
" [-b --list, [...] --add, --remove]",
|
" [-b --list, [...] --add, --remove]",
|
||||||
" [-q --list, [...] --add, --remove]",
|
" [-q --list, [...] --add, --remove]",
|
||||||
" [-q --build, --install, --build-install]",
|
" [-q --build, --install, --build-install]",
|
||||||
" [-l all, sbo, slack, noarch]",
|
" [-l all, sbo, slack, noarch]",
|
||||||
" [-c <repository> --upgrade --current]",
|
" [-c <repository> --upgrade --current]",
|
||||||
" [-s <repository> <package> --current]",
|
" [-s <repository> <package> --current]",
|
||||||
" [-f] [-t] [-n] [-i [...]] [-u [...]]",
|
" [-f] [-t] [-n] [-i [...]] [-u [...]]",
|
||||||
" [-o [...]] [-r [...]] [-d [...]]\n",
|
" [-o [...]] [-r [...]] [-d [...]]\n",
|
||||||
"For more information try 'slpkg --help'\n"
|
"For more information try 'slpkg --help'\n"
|
||||||
]
|
]
|
||||||
args = sys.argv
|
args = sys.argv
|
||||||
args.pop(0)
|
args.pop(0)
|
||||||
repository = ["sbo", "slack"]
|
repository = ["sbo", "slack"]
|
||||||
blacklist = BlackList()
|
blacklist = BlackList()
|
||||||
queue = QueuePkgs()
|
queue = QueuePkgs()
|
||||||
if len(args) == 0:
|
if len(args) == 0:
|
||||||
for opt in usage: print(opt)
|
for opt in usage:
|
||||||
elif len(args) == 1 and args[0] == "-h" or args[0] == "--help" and args[1:] == []:
|
print(opt)
|
||||||
for opt in arguments: print(opt)
|
elif (len(args) == 1 and args[0] == "-h" or
|
||||||
elif len(args) == 1 and args[0] == "-v" or args[0] == "--version" and args[1:] == []:
|
args[0] == "--help" and args[1:] == []):
|
||||||
|
for opt in arguments:
|
||||||
|
print(opt)
|
||||||
|
elif (len(args) == 1 and args[0] == "-v" or
|
||||||
|
args[0] == "--version" and args[1:] == []):
|
||||||
prog_version()
|
prog_version()
|
||||||
elif len(args) == 3 and args[0] == "-a":
|
elif len(args) == 3 and args[0] == "-a":
|
||||||
build_package(args[1], args[2:], path)
|
build_package(args[1], args[2:], path)
|
||||||
|
@ -102,7 +106,8 @@ def main():
|
||||||
if args[1] in sbo_list:
|
if args[1] in sbo_list:
|
||||||
PackageManager(None).list(args[1])
|
PackageManager(None).list(args[1])
|
||||||
else:
|
else:
|
||||||
for opt in usage: print(opt)
|
for opt in usage:
|
||||||
|
print(opt)
|
||||||
elif len(args) == 3 and args[0] == "-c":
|
elif len(args) == 3 and args[0] == "-c":
|
||||||
if args[1] == repository[0] and args[2] == "--upgrade":
|
if args[1] == repository[0] and args[2] == "--upgrade":
|
||||||
sbo_check()
|
sbo_check()
|
||||||
|
@ -110,46 +115,49 @@ def main():
|
||||||
version = "stable"
|
version = "stable"
|
||||||
patches(version)
|
patches(version)
|
||||||
else:
|
else:
|
||||||
for opt in usage: print(opt)
|
for opt in usage:
|
||||||
|
print(opt)
|
||||||
elif len(args) == 4 and args[0] == "-c":
|
elif len(args) == 4 and args[0] == "-c":
|
||||||
if args[1] == repository[1] and args[3] == "--current":
|
if args[1] == repository[1] and args[3] == "--current":
|
||||||
version = "current"
|
version = "current"
|
||||||
patches(version)
|
patches(version)
|
||||||
else:
|
else:
|
||||||
for opt in usage: print(opt)
|
for opt in usage:
|
||||||
|
print(opt)
|
||||||
elif len(args) == 3 and args[0] == "-s":
|
elif len(args) == 3 and args[0] == "-s":
|
||||||
if args[1] == repository[0]:
|
if args[1] == repository[0]:
|
||||||
sbo_build(args[2])
|
sbo_build(args[2])
|
||||||
elif args[1] == repository[1]:
|
elif args[1] == repository[1]:
|
||||||
version = "stable"
|
version = "stable"
|
||||||
install(args[2], version)
|
install(args[2], version)
|
||||||
elif len(args) == 4 and args[0] == "-s":
|
elif len(args) == 4 and args[0] == "-s":
|
||||||
if args[1] == repository[1] and args[3] == "--current":
|
if args[1] == repository[1] and args[3] == "--current":
|
||||||
version = "current"
|
version = "current"
|
||||||
install(args[2], version)
|
install(args[2], version)
|
||||||
else:
|
else:
|
||||||
for opt in usage: print(opt)
|
for opt in usage:
|
||||||
|
print(opt)
|
||||||
elif len(args) == 2 and args[0] == "-t":
|
elif len(args) == 2 and args[0] == "-t":
|
||||||
track_dep(args[1])
|
track_dep(args[1])
|
||||||
elif len(args) == 2 and args[0] == "-n":
|
elif len(args) == 2 and args[0] == "-n":
|
||||||
sbo_network(args[1])
|
sbo_network(args[1])
|
||||||
elif len(args) == 2 and args[0] == "-b" and args[1] == "--list":
|
elif len(args) == 2 and args[0] == "-b" and args[1] == "--list":
|
||||||
blacklist.listed()
|
blacklist.listed()
|
||||||
elif len(args) > 2 and args[0] == "-b" and args[-1] == "--add":
|
elif len(args) > 2 and args[0] == "-b" and args[-1] == "--add":
|
||||||
blacklist.add(args[1:-1])
|
blacklist.add(args[1:-1])
|
||||||
elif len(args) > 2 and args[0] == "-b" and args[-1] == "--remove":
|
elif len(args) > 2 and args[0] == "-b" and args[-1] == "--remove":
|
||||||
blacklist.remove(args[1:-1])
|
blacklist.remove(args[1:-1])
|
||||||
elif len(args) == 2 and args[0] == "-q" and args[1] == "--list":
|
elif len(args) == 2 and args[0] == "-q" and args[1] == "--list":
|
||||||
queue.listed()
|
queue.listed()
|
||||||
elif len(args) > 2 and args[0] == "-q" and args[-1] == "--add":
|
elif len(args) > 2 and args[0] == "-q" and args[-1] == "--add":
|
||||||
queue.add(args[1:-1])
|
queue.add(args[1:-1])
|
||||||
elif len(args) > 2 and args[0] == "-q" and args[-1] == "--remove":
|
elif len(args) > 2 and args[0] == "-q" and args[-1] == "--remove":
|
||||||
queue.remove(args[1:-1])
|
queue.remove(args[1:-1])
|
||||||
elif len(args) == 2 and args[0] =="-q" and args[1] == "--build":
|
elif len(args) == 2 and args[0] == "-q" and args[1] == "--build":
|
||||||
queue.build()
|
queue.build()
|
||||||
elif len(args) == 2 and args[0] =="-q" and args[1] == "--install":
|
elif len(args) == 2 and args[0] == "-q" and args[1] == "--install":
|
||||||
queue.install()
|
queue.install()
|
||||||
elif len(args) == 2 and args[0] =="-q" and args[1] == "--build-install":
|
elif len(args) == 2 and args[0] == "-q" and args[1] == "--build-install":
|
||||||
queue.build()
|
queue.build()
|
||||||
queue.install()
|
queue.install()
|
||||||
elif len(args) > 1 and args[0] == "-i":
|
elif len(args) > 1 and args[0] == "-i":
|
||||||
|
@ -165,7 +173,8 @@ def main():
|
||||||
elif len(args) > 1 and args[0] == "-d":
|
elif len(args) > 1 and args[0] == "-d":
|
||||||
PackageManager(args[1:]).display()
|
PackageManager(args[1:]).display()
|
||||||
else:
|
else:
|
||||||
for opt in usage: print(opt)
|
for opt in usage:
|
||||||
|
print(opt)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -22,8 +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 sys
|
import sys
|
||||||
from colors import *
|
from colors import RED, GREEN, CYAN, YELLOW, ENDC
|
||||||
from __metadata__ import __all__
|
|
||||||
|
|
||||||
|
|
||||||
def pkg_not_found(bol, pkg, message, eol):
|
def pkg_not_found(bol, pkg, message, eol):
|
||||||
|
@ -32,18 +31,21 @@ def pkg_not_found(bol, pkg, message, eol):
|
||||||
'''
|
'''
|
||||||
print("{0}No such package {1}: {2}{3}".format(bol, pkg, message, eol))
|
print("{0}No such package {1}: {2}{3}".format(bol, pkg, message, eol))
|
||||||
|
|
||||||
|
|
||||||
def pkg_found(pkg, version):
|
def pkg_found(pkg, version):
|
||||||
'''
|
'''
|
||||||
Print message when package found
|
Print message when package found
|
||||||
'''
|
'''
|
||||||
print("| Package {0}-{1} is already installed".format(pkg, version))
|
print("| Package {0}-{1} is already installed".format(pkg, version))
|
||||||
|
|
||||||
|
|
||||||
def pkg_installed(pkg):
|
def pkg_installed(pkg):
|
||||||
'''
|
'''
|
||||||
Print message when package installed
|
Print message when package installed
|
||||||
'''
|
'''
|
||||||
print("| Package {0} installed".format(pkg))
|
print("| Package {0} installed".format(pkg))
|
||||||
|
|
||||||
|
|
||||||
def s_user(user):
|
def s_user(user):
|
||||||
'''
|
'''
|
||||||
Check for root user
|
Check for root user
|
||||||
|
@ -52,15 +54,17 @@ def s_user(user):
|
||||||
print("\nslpkg: error: must have root privileges\n")
|
print("\nslpkg: error: must have root privileges\n")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
def build_FAILED(sbo_url, prgnam):
|
def build_FAILED(sbo_url, prgnam):
|
||||||
template(78)
|
template(78)
|
||||||
print("| Build package {0} [ {1}FAILED{2} ]".format(prgnam, RED, ENDC))
|
print("| Build package {0} [ {1}FAILED{2} ]".format(prgnam, RED, ENDC))
|
||||||
template(78)
|
template(78)
|
||||||
print("| See log file in {0}/var/log/slpkg/sbo/build_logs{1} directory or read README file:".format(
|
print("| See log file in {0}/var/log/slpkg/sbo/build_logs{1} directory or \
|
||||||
CYAN, ENDC))
|
read README file:".format(CYAN, 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
|
||||||
|
|
||||||
|
|
||||||
def template(max):
|
def template(max):
|
||||||
'''
|
'''
|
||||||
|
@ -68,32 +72,35 @@ def template(max):
|
||||||
'''
|
'''
|
||||||
print("+" + "=" * max)
|
print("+" + "=" * max)
|
||||||
|
|
||||||
|
|
||||||
def view_sbo(pkg, sbo_url, sbo_desc, sbo_dwn, source_dwn, sbo_req):
|
def view_sbo(pkg, sbo_url, sbo_desc, sbo_dwn, source_dwn, sbo_req):
|
||||||
print # new line at start
|
print # new line at start
|
||||||
template(78)
|
template(78)
|
||||||
print("| {0}Package {1}{2}{3} --> {4}".format(GREEN,
|
print("| {0}Package {1}{2}{3} --> {4}".format(GREEN, CYAN, pkg, GREEN,
|
||||||
CYAN, pkg, GREEN, ENDC + sbo_url))
|
ENDC + sbo_url))
|
||||||
template(78)
|
template(78)
|
||||||
print("| {0}Description : {1}{2}".format(GREEN, ENDC, sbo_desc))
|
print("| {0}Description : {1}{2}".format(GREEN, ENDC, sbo_desc))
|
||||||
print("| {0}SlackBuild : {1}{2}".format(GREEN, ENDC, sbo_dwn))
|
print("| {0}SlackBuild : {1}{2}".format(GREEN, ENDC, sbo_dwn))
|
||||||
print("| {0}Sources : {1}{2}".format(GREEN, ENDC, source_dwn))
|
print("| {0}Sources : {1}{2}".format(GREEN, ENDC, source_dwn))
|
||||||
print("| {0}Requirements : {1}{2}".format(YELLOW, ENDC,
|
print("| {0}Requirements : {1}{2}".format(YELLOW, ENDC, ", ".join(sbo_req)))
|
||||||
", ".join(sbo_req)))
|
|
||||||
template(78)
|
template(78)
|
||||||
print(" {0}R{1}EADME View the README file".format(RED, ENDC))
|
print(" {0}R{1}EADME View the README file".format(RED, ENDC))
|
||||||
print(" {0}S{1}lackBuild View the SlackBuild file".format(RED, ENDC))
|
print(" {0}S{1}lackBuild View the SlackBuild file".format(
|
||||||
|
RED, ENDC))
|
||||||
print(" In{0}f{1}o View the Info file".format(RED, ENDC))
|
print(" In{0}f{1}o View the Info file".format(RED, ENDC))
|
||||||
print(" {0}D{1}ownload Download this package".format(RED, ENDC))
|
print(" {0}D{1}ownload Download this package".format(RED, ENDC))
|
||||||
print(" {0}B{1}uild Download and build".format(RED, ENDC))
|
print(" {0}B{1}uild Download and build".format(RED, ENDC))
|
||||||
print(" {0}I{1}nstall Download/Build/Install".format(RED, ENDC))
|
print(" {0}I{1}nstall Download/Build/Install".format(
|
||||||
|
RED, ENDC))
|
||||||
print(" {0}Q{1}uit Quit\n".format(RED, ENDC))
|
print(" {0}Q{1}uit Quit\n".format(RED, ENDC))
|
||||||
|
|
||||||
|
|
||||||
def sbo_packages_view(PKG_COLOR, package, version, ARCH_COLOR, arch):
|
def sbo_packages_view(PKG_COLOR, package, version, ARCH_COLOR, arch):
|
||||||
'''
|
'''
|
||||||
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(PKG_COLOR, package, ENDC, \
|
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
|
||||||
" " * (38-len(package)), version, \
|
PKG_COLOR, package, ENDC,
|
||||||
" " * (17-len(version)), ARCH_COLOR, arch, ENDC, \
|
" " * (38-len(package)), version,
|
||||||
" " * (13-len(arch)), "SBo"))
|
" " * (17-len(version)), ARCH_COLOR, arch, ENDC,
|
||||||
|
" " * (13-len(arch)), "SBo"))
|
||||||
|
|
|
@ -29,9 +29,9 @@ import shutil
|
||||||
import tarfile
|
import tarfile
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from colors import *
|
|
||||||
from checksum import md5sum
|
from checksum import md5sum
|
||||||
from __metadata__ import log_path
|
from __metadata__ import log_path
|
||||||
|
from colors import RED, GREEN, ENDC
|
||||||
from messages import pkg_not_found, template
|
from messages import pkg_not_found, template
|
||||||
|
|
||||||
from sbo.greps import SBoGrep
|
from sbo.greps import SBoGrep
|
||||||
|
@ -39,11 +39,11 @@ from sbo.greps import SBoGrep
|
||||||
|
|
||||||
def build_package(script, sources, path):
|
def build_package(script, sources, path):
|
||||||
'''
|
'''
|
||||||
Build package from source and create log
|
Build package from source and create log
|
||||||
file in path /var/log/slpkg/sbo/build_logs/.
|
file in path /var/log/slpkg/sbo/build_logs/.
|
||||||
Also check md5sum calculates.
|
Also check md5sum calculates.
|
||||||
'''
|
'''
|
||||||
prgnam = script.replace(".tar.gz", "")
|
prgnam = script[:-7] # remove .tar.gz
|
||||||
log_file = ("build_{0}_log".format(prgnam))
|
log_file = ("build_{0}_log".format(prgnam))
|
||||||
sbo_logs = log_path + "sbo/"
|
sbo_logs = log_path + "sbo/"
|
||||||
build_logs = sbo_logs + "build_logs/"
|
build_logs = sbo_logs + "build_logs/"
|
||||||
|
@ -86,11 +86,12 @@ def build_package(script, sources, path):
|
||||||
print("| MD5SUM check for {0} [ {1}PASSED{2} ]".format(
|
print("| MD5SUM check for {0} [ {1}PASSED{2} ]".format(
|
||||||
src, GREEN, ENDC))
|
src, GREEN, ENDC))
|
||||||
template(78)
|
template(78)
|
||||||
print # new line after pass checksum
|
print # new line after pass checksum
|
||||||
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)
|
||||||
with open(build_logs + log_file, "w") as log: # write headers to log file
|
# write headers to log file
|
||||||
|
with open(build_logs + log_file, "w") as log:
|
||||||
log.write(log_line)
|
log.write(log_line)
|
||||||
log.write("File : " + log_file + "\n")
|
log.write("File : " + log_file + "\n")
|
||||||
log.write("Path : " + build_logs + "\n")
|
log.write("Path : " + build_logs + "\n")
|
||||||
|
@ -99,8 +100,8 @@ def build_package(script, sources, path):
|
||||||
log.write(log_line)
|
log.write(log_line)
|
||||||
log.close()
|
log.close()
|
||||||
subprocess.Popen("./{0}.SlackBuild 2>&1 | tee -a {1}{2}".format(
|
subprocess.Popen("./{0}.SlackBuild 2>&1 | tee -a {1}{2}".format(
|
||||||
prgnam, build_logs, log_file), \
|
prgnam, build_logs, log_file),
|
||||||
shell=True, stdout=sys.stdout).communicate()
|
shell=True, stdout=sys.stdout).communicate()
|
||||||
end_log_time = time.strftime("%H:%M:%S")
|
end_log_time = time.strftime("%H:%M:%S")
|
||||||
end_time = time.time()
|
end_time = time.time()
|
||||||
diff_time = round(end_time - start_time, 2)
|
diff_time = round(end_time - start_time, 2)
|
||||||
|
@ -109,14 +110,17 @@ def build_package(script, sources, path):
|
||||||
sum_time = str(diff_time) + " Sec"
|
sum_time = str(diff_time) + " Sec"
|
||||||
elif diff_time > 59.99 and diff_time <= 3599.99:
|
elif diff_time > 59.99 and diff_time <= 3599.99:
|
||||||
sum_time = round(diff_time / 60, 2)
|
sum_time = round(diff_time / 60, 2)
|
||||||
sum_time_list = re.findall(r"\d+", str(sum_time))
|
sum_time_list = re.findall(r"\d+", str(sum_time))
|
||||||
sum_time = ("{0} Min {1} Sec".format(sum_time_list[0], sum_time_list[1]))
|
sum_time = ("{0} Min {1} Sec".format(sum_time_list[0],
|
||||||
|
sum_time_list[1]))
|
||||||
elif diff_time > 3599.99:
|
elif diff_time > 3599.99:
|
||||||
sum_time = round(diff_time / 3600, 2)
|
sum_time = round(diff_time / 3600, 2)
|
||||||
sum_time_list = re.findall(r"\d+", str(sum_time))
|
sum_time_list = re.findall(r"\d+", str(sum_time))
|
||||||
sum_time = ("{0} Hours {1} Min".format(sum_time_list[0], sum_time_list[1]))
|
sum_time = ("{0} Hours {1} Min".format(sum_time_list[0],
|
||||||
with open(build_logs + log_file, "a") as log: # append END tag to a log file
|
sum_time_list[1]))
|
||||||
log.seek(2) # EOF
|
# append END tag to a log file
|
||||||
|
with open(build_logs + log_file, "a") as log:
|
||||||
|
log.seek(2)
|
||||||
log.write(log_line)
|
log.write(log_line)
|
||||||
log.write("Time : " + end_log_time + "\n")
|
log.write("Time : " + end_log_time + "\n")
|
||||||
log.write("Total build time : {0}\n".format(sum_time))
|
log.write("Total build time : {0}\n".format(sum_time))
|
||||||
|
@ -124,10 +128,11 @@ def build_package(script, sources, path):
|
||||||
log.write(log_line)
|
log.write(log_line)
|
||||||
log.close()
|
log.close()
|
||||||
os.chdir(path)
|
os.chdir(path)
|
||||||
print("Total build time for package {0} : {1}\n".format(prgnam, sum_time))
|
print("Total build time for package {0} : {1}\n".format(prgnam,
|
||||||
|
sum_time))
|
||||||
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")
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print # new line at exit
|
print # new line at exit
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
|
@ -35,6 +35,7 @@ def find_package(find_pkg, directory):
|
||||||
pkgs = []
|
pkgs = []
|
||||||
blacklist = BlackList().packages()
|
blacklist = BlackList().packages()
|
||||||
for pkg in sorted(os.listdir(directory)):
|
for pkg in sorted(os.listdir(directory)):
|
||||||
if pkg.startswith(find_pkg) and split_package(pkg + ".???")[0] not in blacklist:
|
name = split_package(pkg + ".???")[0]
|
||||||
|
if pkg.startswith(find_pkg) and name not in blacklist:
|
||||||
pkgs.append(pkg)
|
pkgs.append(pkg)
|
||||||
return pkgs
|
return pkgs
|
||||||
|
|
|
@ -25,9 +25,8 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from colors import *
|
|
||||||
from blacklist import BlackList
|
|
||||||
from messages import pkg_not_found, template
|
from messages import pkg_not_found, template
|
||||||
|
from colors import RED, GREEN, CYAN, GREY, ENDC
|
||||||
from __metadata__ import pkg_path, sp, log_path
|
from __metadata__ import pkg_path, sp, log_path
|
||||||
|
|
||||||
from find import find_package
|
from find import find_package
|
||||||
|
@ -37,9 +36,9 @@ class PackageManager(object):
|
||||||
'''
|
'''
|
||||||
Package manager class for install, upgrade,
|
Package manager class for install, upgrade,
|
||||||
reinstall, remove, find and display packages.
|
reinstall, remove, find and display packages.
|
||||||
'''
|
'''
|
||||||
def __init__(self, binary):
|
def __init__(self, binary):
|
||||||
self.binary = binary
|
self.binary = binary
|
||||||
|
|
||||||
def install(self):
|
def install(self):
|
||||||
'''
|
'''
|
||||||
|
@ -81,8 +80,9 @@ class PackageManager(object):
|
||||||
'''
|
'''
|
||||||
for pkg in self.binary:
|
for pkg in self.binary:
|
||||||
try:
|
try:
|
||||||
print(subprocess.check_output("upgradepkg --reinstall {0}".format(
|
print(
|
||||||
pkg), shell=True))
|
subprocess.check_output("upgradepkg --reinstall {0}".format(
|
||||||
|
pkg), shell=True))
|
||||||
print("Completed!\n")
|
print("Completed!\n")
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
message = "Can't reinstall"
|
message = "Can't reinstall"
|
||||||
|
@ -108,22 +108,25 @@ class PackageManager(object):
|
||||||
for pkg in self.binary:
|
for pkg in self.binary:
|
||||||
pkgs = find_package(pkg + sp, pkg_path)
|
pkgs = find_package(pkg + sp, pkg_path)
|
||||||
if pkgs:
|
if pkgs:
|
||||||
print(RED + "[ delete ] --> " + ENDC + "\n ".join(pkgs))
|
print("{0}[ delete ]{1} --> {2}".format(RED, ENDC,
|
||||||
|
"\n ".join(pkgs)))
|
||||||
|
|
||||||
removed.append(pkg)
|
removed.append(pkg)
|
||||||
else:
|
else:
|
||||||
message = "Can't remove"
|
message = "Can't remove"
|
||||||
pkg_not_found("", pkg, message, "")
|
pkg_not_found("", pkg, message, "")
|
||||||
if removed == []:
|
if removed == []:
|
||||||
print # new line at end
|
print # new line at end
|
||||||
else:
|
else:
|
||||||
msg = "package"
|
msg = "package"
|
||||||
if len(removed) > 1:
|
if len(removed) > 1:
|
||||||
msg = msg + "s"
|
msg = msg + "s"
|
||||||
try:
|
try:
|
||||||
remove_pkg = raw_input("\nAre you sure to remove {0} {1} [Y/n]? ".format(
|
remove_pkg = raw_input(
|
||||||
str(len(removed)), msg))
|
"\nAre you sure to remove {0} {1} [Y/n]? ".format(
|
||||||
|
str(len(removed)), msg))
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print # new line at exit
|
print # new line at exit
|
||||||
sys.exit()
|
sys.exit()
|
||||||
if remove_pkg == "y" or remove_pkg == "Y":
|
if remove_pkg == "y" or remove_pkg == "Y":
|
||||||
for rmv in removed:
|
for rmv in removed:
|
||||||
|
@ -134,40 +137,45 @@ class PackageManager(object):
|
||||||
with open(dep_path + rmv, "r") as f:
|
with open(dep_path + rmv, "r") as f:
|
||||||
dependencies = f.read().split()
|
dependencies = f.read().split()
|
||||||
f.close()
|
f.close()
|
||||||
print # new line at start
|
print # new line at start
|
||||||
template(78)
|
template(78)
|
||||||
print("| Found dependencies for package {0}:".format(rmv))
|
print("| Found dependencies for package {0}:".format(
|
||||||
|
rmv))
|
||||||
template(78)
|
template(78)
|
||||||
# Prints dependecies before removed except master package
|
# Prints dependecies before removed except master
|
||||||
# because referred as master package
|
# package because referred as master package
|
||||||
for dep in dependencies[:-1]:
|
for dep in dependencies[:-1]:
|
||||||
print("| {0}{1}{2}".format(RED, dep, ENDC))
|
print("| {0}{1}{2}".format(RED, dep, ENDC))
|
||||||
template(78)
|
template(78)
|
||||||
try:
|
try:
|
||||||
remove_dep = raw_input(
|
remove_dep = raw_input(
|
||||||
"\nRemove dependencies (maybe used by other packages) [Y/n]? ")
|
"\nRemove dependencies (maybe used by other packages) [Y/n]? ")
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print # new line at exit
|
print # new line at exit
|
||||||
|
|
||||||
sys.exit()
|
sys.exit()
|
||||||
if remove_dep == "y" or remove_dep == "Y":
|
if remove_dep == "y" or remove_dep == "Y":
|
||||||
for dep in dependencies:
|
for dep in dependencies:
|
||||||
if find_package(dep + sp, pkg_path):
|
if find_package(dep + sp, pkg_path):
|
||||||
print(subprocess.check_output("removepkg {0}".format(
|
print(subprocess.check_output(
|
||||||
dep), shell=True))
|
"removepkg {0}".format(dep),
|
||||||
|
shell=True))
|
||||||
rmv_list.append(dep)
|
rmv_list.append(dep)
|
||||||
os.remove(dep_path + rmv)
|
os.remove(dep_path + rmv)
|
||||||
rmv_dependencies += dependencies[:-1]
|
rmv_dependencies += dependencies[:-1]
|
||||||
else:
|
else:
|
||||||
if find_package(rmv + sp, pkg_path):
|
if find_package(rmv + sp, pkg_path):
|
||||||
print(subprocess.check_output("removepkg {0}".format(
|
print(subprocess.check_output(
|
||||||
rmv), shell=True))
|
"removepkg {0}".format(rmv),
|
||||||
|
shell=True))
|
||||||
rmv_list.append(rmv)
|
rmv_list.append(rmv)
|
||||||
f.close()
|
f.close()
|
||||||
os.remove(dep_path + rmv)
|
os.remove(dep_path + rmv)
|
||||||
else:
|
else:
|
||||||
if find_package(rmv + sp, pkg_path):
|
if find_package(rmv + sp, pkg_path):
|
||||||
print(subprocess.check_output("removepkg {0}".format(
|
print(subprocess.check_output(
|
||||||
rmv), shell=True))
|
"removepkg {0}".format(rmv),
|
||||||
|
shell=True))
|
||||||
rmv_list.append(rmv)
|
rmv_list.append(rmv)
|
||||||
# Prints all removed packages
|
# Prints all removed packages
|
||||||
if len(rmv_list) > 1:
|
if len(rmv_list) > 1:
|
||||||
|
@ -180,7 +188,7 @@ class PackageManager(object):
|
||||||
else:
|
else:
|
||||||
print("| Package {0} not found".format(pkg))
|
print("| Package {0} not found".format(pkg))
|
||||||
template(78)
|
template(78)
|
||||||
print # new line at end
|
print # new line at end
|
||||||
|
|
||||||
def find(self):
|
def find(self):
|
||||||
'''
|
'''
|
||||||
|
@ -188,23 +196,23 @@ class PackageManager(object):
|
||||||
'''
|
'''
|
||||||
self.binary = "".join(self.binary)
|
self.binary = "".join(self.binary)
|
||||||
matching = size = int()
|
matching = size = int()
|
||||||
print("\nInstalled packages with name begin matching [ {0}{1}{2} ]\n".format(
|
print("\nPackages with matching name [ {0}{1}{2} ]\n".format(
|
||||||
CYAN, self.binary, ENDC))
|
CYAN, self.binary, 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))
|
GREEN, 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()
|
||||||
for line in data.splitlines():
|
for line in data.splitlines():
|
||||||
if line.startswith("UNCOMPRESSED PACKAGE SIZE:"):
|
if line.startswith("UNCOMPRESSED PACKAGE SIZE:"):
|
||||||
if "M" in line[26:]:
|
if "M" in line[26:]:
|
||||||
size += float(line[26:-1]) * 1024
|
size += float(line[26:-1]) * 1024
|
||||||
else:
|
else:
|
||||||
size += float(line[26:-1])
|
size += float(line[26:-1])
|
||||||
break
|
break
|
||||||
if matching == 0:
|
if matching == 0:
|
||||||
message = "Can't find"
|
message = "Can't find"
|
||||||
pkg_not_found("", self.binary, message, "\n")
|
pkg_not_found("", self.binary, message, "\n")
|
||||||
|
@ -223,10 +231,12 @@ class PackageManager(object):
|
||||||
Print the Slackware packages contents
|
Print the Slackware packages contents
|
||||||
'''
|
'''
|
||||||
for pkg in self.binary:
|
for pkg in self.binary:
|
||||||
if find_package(pkg + sp, pkg_path):
|
find = find_package(pkg + sp, pkg_path)
|
||||||
print(subprocess.check_output("cat {0}{1}".format(pkg_path,
|
if find:
|
||||||
" /var/log/packages/".join(find_package(
|
with open(pkg_path + "".join(find), "r") as package:
|
||||||
pkg + sp, pkg_path))), shell=True))
|
for line in package:
|
||||||
|
print(line).strip()
|
||||||
|
print # new line per file
|
||||||
else:
|
else:
|
||||||
message = "Can't dislpay"
|
message = "Can't dislpay"
|
||||||
if len(self.binary) > 1:
|
if len(self.binary) > 1:
|
||||||
|
@ -254,10 +264,11 @@ class PackageManager(object):
|
||||||
index += 1
|
index += 1
|
||||||
print("{0}{1}:{2} {3}".format(GREY, index, ENDC, pkg))
|
print("{0}{1}:{2} {3}".format(GREY, index, ENDC, pkg))
|
||||||
if index == page:
|
if index == page:
|
||||||
key = raw_input("\nPress [ {0}Enter{1} ] >> Next page ".format(
|
print # new line at start
|
||||||
CYAN, ENDC))
|
raw_input("Press [ {0}Enter{1} ] >> Next page ".format(
|
||||||
|
CYAN, ENDC))
|
||||||
page += 50
|
page += 50
|
||||||
print # new line at end
|
print # new line at end
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print # new line at exit
|
print # new line at exit
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
|
@ -22,10 +22,9 @@
|
||||||
# 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 sys
|
|
||||||
|
|
||||||
from colors import *
|
|
||||||
from downloader import Download
|
from downloader import Download
|
||||||
|
from colors import GREEN, RED, ENDC
|
||||||
from __metadata__ import lib_path, build_path, tmp
|
from __metadata__ import lib_path, build_path, tmp
|
||||||
|
|
||||||
from sbo.greps import SBoGrep
|
from sbo.greps import SBoGrep
|
||||||
|
@ -43,10 +42,10 @@ class QueuePkgs(object):
|
||||||
'''
|
'''
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
queue_file = [
|
queue_file = [
|
||||||
"# In this file you can create a list of\n",
|
"# In this file you can create a list of\n",
|
||||||
"# packages you want to build or install.\n",
|
"# packages you want to build or install.\n",
|
||||||
"#\n"
|
"#\n"
|
||||||
]
|
]
|
||||||
self.queue = lib_path + "queue/"
|
self.queue = lib_path + "queue/"
|
||||||
self.queue_list = self.queue + "queue_list"
|
self.queue_list = self.queue + "queue_list"
|
||||||
if not os.path.exists(lib_path):
|
if not os.path.exists(lib_path):
|
||||||
|
@ -58,10 +57,10 @@ class QueuePkgs(object):
|
||||||
for line in queue_file:
|
for line in queue_file:
|
||||||
queue.write(line)
|
queue.write(line)
|
||||||
queue.close()
|
queue.close()
|
||||||
|
|
||||||
def packages(self):
|
def packages(self):
|
||||||
'''
|
'''
|
||||||
Return queue list from /var/lib/queue/queue_list
|
Return queue list from /var/lib/queue/queue_list
|
||||||
file.
|
file.
|
||||||
'''
|
'''
|
||||||
queue_list = []
|
queue_list = []
|
||||||
|
@ -69,7 +68,7 @@ class QueuePkgs(object):
|
||||||
for read in queue:
|
for read in queue:
|
||||||
read = read.lstrip()
|
read = read.lstrip()
|
||||||
if not read.startswith("#"):
|
if not read.startswith("#"):
|
||||||
queue_list.append(read.replace("\n", ""))
|
queue_list.append(read.replace("\n", ""))
|
||||||
queue.close()
|
queue.close()
|
||||||
return queue_list
|
return queue_list
|
||||||
|
|
||||||
|
@ -84,7 +83,7 @@ class QueuePkgs(object):
|
||||||
print("{0}{1}{2}".format(GREEN, pkg, ENDC))
|
print("{0}{1}{2}".format(GREEN, pkg, ENDC))
|
||||||
exit = 1
|
exit = 1
|
||||||
if exit == 1:
|
if exit == 1:
|
||||||
print # new line at exit
|
print # new line at exit
|
||||||
|
|
||||||
def add(self, pkgs):
|
def add(self, pkgs):
|
||||||
'''
|
'''
|
||||||
|
@ -106,7 +105,7 @@ class QueuePkgs(object):
|
||||||
exit = 1
|
exit = 1
|
||||||
queue.close()
|
queue.close()
|
||||||
if exit == 1:
|
if exit == 1:
|
||||||
print # new line at exit
|
print # new line at exit
|
||||||
|
|
||||||
def remove(self, pkgs):
|
def remove(self, pkgs):
|
||||||
'''
|
'''
|
||||||
|
@ -117,7 +116,8 @@ class QueuePkgs(object):
|
||||||
with open(self.queue_list, "r") as queue:
|
with open(self.queue_list, "r") as queue:
|
||||||
lines = queue.read()
|
lines = queue.read()
|
||||||
queue.close()
|
queue.close()
|
||||||
if pkgs == ["all"]: pkgs = self.packages()
|
if pkgs == ["all"]:
|
||||||
|
pkgs = self.packages()
|
||||||
with open(self.queue_list, "w") as queue:
|
with open(self.queue_list, "w") as queue:
|
||||||
for line in lines.splitlines():
|
for line in lines.splitlines():
|
||||||
if line not in pkgs:
|
if line not in pkgs:
|
||||||
|
@ -127,7 +127,7 @@ class QueuePkgs(object):
|
||||||
exit = 1
|
exit = 1
|
||||||
queue.close()
|
queue.close()
|
||||||
if exit == 1:
|
if exit == 1:
|
||||||
print # new line at exit
|
print # new line at exit
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
'''
|
'''
|
||||||
|
@ -143,11 +143,11 @@ class QueuePkgs(object):
|
||||||
source_dwn = SBoGrep(pkg).source().split()
|
source_dwn = SBoGrep(pkg).source().split()
|
||||||
sources = []
|
sources = []
|
||||||
os.chdir(build_path)
|
os.chdir(build_path)
|
||||||
script = sbo_dwn.split("/")[-1] # get file from script link
|
script = sbo_dwn.split("/")[-1]
|
||||||
Download(build_path, sbo_dwn).start()
|
Download(build_path, sbo_dwn).start()
|
||||||
for src in source_dwn:
|
for src in source_dwn:
|
||||||
Download(build_path, src).start()
|
Download(build_path, src).start()
|
||||||
sources.append(src.split("/")[-1]) # get file from source link
|
sources.append(src.split("/")[-1])
|
||||||
build_package(script, sources, build_path)
|
build_package(script, sources, build_path)
|
||||||
else:
|
else:
|
||||||
print("\nPackages not found in the queue for building\n")
|
print("\nPackages not found in the queue for building\n")
|
||||||
|
@ -155,15 +155,15 @@ class QueuePkgs(object):
|
||||||
def install(self):
|
def install(self):
|
||||||
packages = self.packages()
|
packages = self.packages()
|
||||||
if packages:
|
if packages:
|
||||||
print # new line at start
|
# new line at start
|
||||||
|
print
|
||||||
for pkg in packages:
|
for pkg in packages:
|
||||||
# check if package exist in repository
|
# check if package exist in repository
|
||||||
find = find_package(pkg, tmp)
|
find = find_package(pkg, tmp)
|
||||||
try:
|
try:
|
||||||
find = max(find)
|
find = max(find)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print("Package '{0}' not found in /tmp\n".format(pkg))
|
print("Package '{0}' not found in /tmp\n".format(pkg))
|
||||||
pass
|
|
||||||
if pkg in find:
|
if pkg in find:
|
||||||
binary = "{0}{1}".format(tmp, find)
|
binary = "{0}{1}".format(tmp, find)
|
||||||
PackageManager(binary.split()).install()
|
PackageManager(binary.split()).install()
|
||||||
|
|
|
@ -28,10 +28,10 @@ from pkg.find import find_package
|
||||||
from pkg.build import build_package
|
from pkg.build import build_package
|
||||||
from pkg.manager import PackageManager
|
from pkg.manager import PackageManager
|
||||||
|
|
||||||
from colors import *
|
|
||||||
from init import initialization
|
from init import initialization
|
||||||
from downloader import Download
|
from downloader import Download
|
||||||
from messages import template, build_FAILED
|
from messages import template, build_FAILED
|
||||||
|
from colors import RED, GREEN, GREY, YELLOW, ENDC
|
||||||
from __metadata__ import tmp, pkg_path, build_path, sp
|
from __metadata__ import tmp, pkg_path, build_path, sp
|
||||||
|
|
||||||
from greps import SBoGrep
|
from greps import SBoGrep
|
||||||
|
@ -46,15 +46,15 @@ def sbo_check():
|
||||||
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
|
but install the package with maximum build tag if find the
|
||||||
some version in /tmp directory.
|
some version in /tmp directory.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
done = "{0}Done{1}\n".format(GREY, ENDC)
|
done = "{0}Done{1}\n".format(GREY, ENDC)
|
||||||
reading_lists = "{0}Reading package lists ...{1}".format(GREY, ENDC)
|
reading_lists = "{0}Reading package lists ...{1}".format(GREY, ENDC)
|
||||||
sys.stdout.write(reading_lists)
|
sys.stdout.write(reading_lists)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
init = initialization()
|
initialization()
|
||||||
arches = ["-x86_64-", "-i486-", "-arm-", "-noarch-"]
|
arches = ["-x86_64-", "-i486-", "-arm-", "-noarch-"]
|
||||||
index, toolbar_width = int(), 3
|
index, toolbar_width = int(), 3
|
||||||
[
|
[
|
||||||
|
@ -69,11 +69,11 @@ def sbo_check():
|
||||||
upg_ver,
|
upg_ver,
|
||||||
upg_arch
|
upg_arch
|
||||||
] = ([] for i in range(10))
|
] = ([] for i in range(10))
|
||||||
try:
|
try:
|
||||||
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)
|
||||||
if sbo_list:
|
if sbo_list:
|
||||||
for pkg in sbo_list:
|
for pkg in sbo_list:
|
||||||
index += 1
|
index += 1
|
||||||
if index == toolbar_width:
|
if index == toolbar_width:
|
||||||
|
@ -88,13 +88,14 @@ def sbo_check():
|
||||||
if arch.startswith("i") and arch.endswith("86"):
|
if arch.startswith("i") and arch.endswith("86"):
|
||||||
arch = "i486"
|
arch = "i486"
|
||||||
package = pkg[:-(len(arch) + len("_SBo") + 3)]
|
package = pkg[:-(len(arch) + len("_SBo") + 3)]
|
||||||
pkg_version = package.split("-")[-1]
|
pkg_version = package.split("-")[-1]
|
||||||
name = package[:-(len(pkg_version) + 1)]
|
name = package[:-(len(pkg_version) + 1)]
|
||||||
if sbo_search_pkg(name):
|
if sbo_search_pkg(name):
|
||||||
# search packages if exists in the repository
|
# search packages if exists in the repository
|
||||||
# and it gets to avoidable modified packages
|
# and it gets to avoidable modified packages
|
||||||
# from the user with the tag _SBo
|
# from the user with the tag _SBo
|
||||||
sbo_package = ("{0}-{1}".format(name, SBoGrep(name).version()))
|
sbo_package = ("{0}-{1}".format(name,
|
||||||
|
SBoGrep(name).version()))
|
||||||
if sbo_package > package:
|
if sbo_package > package:
|
||||||
upg_name.append(name)
|
upg_name.append(name)
|
||||||
sys.stdout.write(done)
|
sys.stdout.write(done)
|
||||||
|
@ -103,26 +104,27 @@ def sbo_check():
|
||||||
GREY, ENDC))
|
GREY, ENDC))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
# Of the packages found to need upgrading,
|
# Of the packages found to need upgrading,
|
||||||
# stored in a series such as reading from the
|
# stored in a series such as reading from the
|
||||||
# file .info.
|
# file .info.
|
||||||
for upg in upg_name:
|
for upg in upg_name:
|
||||||
dependencies = sbo_dependencies_pkg(upg)
|
dependencies = sbo_dependencies_pkg(upg)
|
||||||
# Because there are dependencies that depend on other
|
# Because there are dependencies that depend on other
|
||||||
# dependencies are created lists into other lists.
|
# dependencies are created lists into other lists.
|
||||||
# Thus creating this loop create one-dimensional list.
|
# Thus creating this loop create one-dimensional list.
|
||||||
for dep in dependencies:
|
for dep in dependencies:
|
||||||
requires += dep
|
requires += dep
|
||||||
requires.reverse() # Inverting the list brings the
|
# Inverting the list brings the
|
||||||
# dependencies in order to be installed.
|
# dependencies in order to be installed.
|
||||||
# Many packages use the same dependencies, in this loop
|
requires.reverse()
|
||||||
# creates a new list by removing duplicate dependencies but
|
# 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.
|
# without spoiling the line must be installed.
|
||||||
for duplicate in requires:
|
for duplicate in requires:
|
||||||
if duplicate not in dependencies_list:
|
if duplicate not in dependencies_list:
|
||||||
dependencies_list.append(duplicate)
|
dependencies_list.append(duplicate)
|
||||||
# Last and after the list is created with the correct number
|
# Last and after the list is created with the correct number
|
||||||
# of dependencies that must be installed, and add the particular
|
# of dependencies that must be installed, and add the particular
|
||||||
# packages that need to be upgraded if they are not already on
|
# packages that need to be upgraded if they are not already on
|
||||||
# the list in end to list.
|
# the list in end to list.
|
||||||
for upg in upg_name:
|
for upg in upg_name:
|
||||||
if upg not in dependencies_list:
|
if upg not in dependencies_list:
|
||||||
|
@ -132,14 +134,16 @@ def sbo_check():
|
||||||
for pkg in dependencies_list:
|
for pkg in dependencies_list:
|
||||||
ver = SBoGrep(pkg).version()
|
ver = SBoGrep(pkg).version()
|
||||||
prgnam = ("{0}-{1}".format(pkg, ver))
|
prgnam = ("{0}-{1}".format(pkg, ver))
|
||||||
pkg_version = ver # if package not installed
|
# if package not installed
|
||||||
# take version from repository
|
# take version from repository
|
||||||
|
pkg_version = ver
|
||||||
arch = os.uname()[4]
|
arch = os.uname()[4]
|
||||||
if arch.startswith("i") and arch.endswith("86"):
|
if arch.startswith("i") and arch.endswith("86"):
|
||||||
arch = "i486"
|
arch = "i486"
|
||||||
if find_package(prgnam, pkg_path) == []:
|
if find_package(prgnam, pkg_path) == []:
|
||||||
for sbo in os.listdir(pkg_path):
|
for sbo in os.listdir(pkg_path):
|
||||||
if sbo.startswith(pkg + sp) and sbo.endswith("_SBo"):
|
if (sbo.startswith(pkg + sp) and
|
||||||
|
sbo.endswith("_SBo")):
|
||||||
# search if packages installed
|
# search if packages installed
|
||||||
# if yes grab package name,
|
# if yes grab package name,
|
||||||
# version and arch
|
# version and arch
|
||||||
|
@ -156,8 +160,9 @@ def sbo_check():
|
||||||
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("{0}{1}{2}{3}{4}{5}{6}".format("| Package", " " * 30, "New version", \
|
print("{0}{1}{2}{3}{4}{5}{6}".format(
|
||||||
" " * 6 , "Arch", " " * 9, "Repository"))
|
"| Package", " " * 30, "New version", " " * 6,
|
||||||
|
"Arch", " " * 9, "Repository"))
|
||||||
template(78)
|
template(78)
|
||||||
print("Upgrading:")
|
print("Upgrading:")
|
||||||
count_upgraded = count_installed = int()
|
count_upgraded = count_installed = int()
|
||||||
|
@ -168,9 +173,10 @@ def sbo_check():
|
||||||
else:
|
else:
|
||||||
COLOR = RED
|
COLOR = RED
|
||||||
count_installed += 1
|
count_installed += 1
|
||||||
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(COLOR, upg, ENDC, \
|
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
|
||||||
" " * (38-len(upg)), GREEN, ver, ENDC, \
|
COLOR, upg, ENDC, " " * (38-len(upg)), GREEN,
|
||||||
" " * (17-len(ver)), arch, " " * (13-len(arch)), "SBo"))
|
ver, ENDC, " " * (17-len(ver)), arch,
|
||||||
|
" " * (13-len(arch)), "SBo"))
|
||||||
msg_upg = "package"
|
msg_upg = "package"
|
||||||
msg_ins = msg_upg
|
msg_ins = msg_upg
|
||||||
if count_upgraded > 1:
|
if count_upgraded > 1:
|
||||||
|
@ -180,7 +186,8 @@ def sbo_check():
|
||||||
print("\nInstalling summary")
|
print("\nInstalling summary")
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
print("{0}Total {1} {2} will be upgraded and {3} {4} will be installed.{5}\n".format(
|
print("{0}Total {1} {2} will be upgraded and {3} {4} will be installed.{5}\n".format(
|
||||||
GREY, count_upgraded, msg_upg, count_installed, msg_ins, ENDC))
|
GREY, count_upgraded, msg_upg,
|
||||||
|
count_installed, msg_ins, ENDC))
|
||||||
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):
|
||||||
|
@ -191,15 +198,16 @@ def sbo_check():
|
||||||
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)
|
||||||
src_dwn = SBoGrep(name).source().split()
|
src_dwn = SBoGrep(name).source().split()
|
||||||
script = sbo_dwn.split("/")[-1] # keep file from script link
|
script = sbo_dwn.split("/")[-1]
|
||||||
Download(build_path, sbo_dwn).start()
|
Download(build_path, sbo_dwn).start()
|
||||||
sources = []
|
sources = []
|
||||||
for src in src_dwn:
|
for src in src_dwn:
|
||||||
Download(build_path, src).start()
|
Download(build_path, src).start()
|
||||||
sources.append(src.split("/")[-1]) # keep file from source link
|
# keep file from source link
|
||||||
|
sources.append(src.split("/")[-1])
|
||||||
build_package(script, sources, build_path)
|
build_package(script, sources, build_path)
|
||||||
# Searches the package name and version in /tmp to install.
|
# Searches the package name and version in /tmp to
|
||||||
# If find two or more packages e.g. to build tag
|
# install.If find two or more packages e.g. to build tag
|
||||||
# 2 or 3 will fit most.
|
# 2 or 3 will fit most.
|
||||||
binary_list = []
|
binary_list = []
|
||||||
for search in find_package(prgnam, tmp):
|
for search in find_package(prgnam, tmp):
|
||||||
|
@ -211,32 +219,35 @@ def sbo_check():
|
||||||
build_FAILED(sbo_url, prgnam)
|
build_FAILED(sbo_url, prgnam)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
if find_package(name + sp, pkg_path):
|
if find_package(name + sp, pkg_path):
|
||||||
print("{0}[ Upgrading ] --> {1}{2}".format(GREEN, ENDC, name))
|
print("{0}[ Upgrading ] --> {1}{2}".format(
|
||||||
|
GREEN, ENDC, name))
|
||||||
else:
|
else:
|
||||||
print("{0}[ Installing ] --> {1}{2}".format(GREEN, ENDC, name))
|
print("{0}[ Installing ] --> {1}{2}".format(
|
||||||
# Use this list to pick out what
|
GREEN, ENDC, name))
|
||||||
|
# Use this list to pick out what
|
||||||
# packages will be installed
|
# packages will be installed
|
||||||
installed.append(name)
|
installed.append(name)
|
||||||
PackageManager(binary).upgrade()
|
PackageManager(binary).upgrade()
|
||||||
if len(pkg_for_upg) > 1:
|
if len(pkg_for_upg) > 1:
|
||||||
template(78)
|
template(78)
|
||||||
print("| Total {0} {1} upgraded and {2} {3} installed".format(
|
print("| Total {0} {1} upgraded and {2} {3} installed".format(
|
||||||
count_upgraded, msg_upg, count_installed, msg_ins))
|
count_upgraded, msg_upg, count_installed, msg_ins))
|
||||||
template(78)
|
template(78)
|
||||||
for pkg, upg, ver in zip(pkg_for_upg, upgrade, 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):
|
||||||
if upg in installed:
|
if upg in installed:
|
||||||
print("| Package {0} installed".format(pkg))
|
print("| Package {0} installed".format(pkg))
|
||||||
else:
|
else:
|
||||||
print("| Package {0} upgraded with new package {1}-{2}".format(
|
print("| Package {0} upgraded with new package {1}-{2}".format(
|
||||||
pkg, upg, ver))
|
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)
|
sys.stdout.write(done)
|
||||||
print("\nNo SBo packages found\n")
|
print("\nNo SBo packages found\n")
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print # new line at exit
|
print # new line at exit
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from colors import *
|
from colors import GREY, ENDC
|
||||||
from blacklist import BlackList
|
from blacklist import BlackList
|
||||||
|
|
||||||
from greps import SBoGrep
|
from greps import SBoGrep
|
||||||
|
@ -32,13 +32,14 @@ from search import sbo_search_pkg
|
||||||
|
|
||||||
dep_results = []
|
dep_results = []
|
||||||
|
|
||||||
|
|
||||||
def sbo_dependencies_pkg(name):
|
def sbo_dependencies_pkg(name):
|
||||||
'''
|
'''
|
||||||
Build all dependencies of a package
|
Build all dependencies of a package
|
||||||
'''
|
'''
|
||||||
try:
|
try:
|
||||||
dependencies = []
|
dependencies = []
|
||||||
blacklist = BlackList().packages()
|
blacklist = BlackList().packages()
|
||||||
sbo_url = sbo_search_pkg(name)
|
sbo_url = sbo_search_pkg(name)
|
||||||
if sbo_url:
|
if sbo_url:
|
||||||
requires = SBoGrep(name).requires()
|
requires = SBoGrep(name).requires()
|
||||||
|
@ -56,5 +57,5 @@ def sbo_dependencies_pkg(name):
|
||||||
sbo_dependencies_pkg(dep)
|
sbo_dependencies_pkg(dep)
|
||||||
return dep_results
|
return dep_results
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print # new line at exit
|
print # new line at exit
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
|
@ -21,13 +21,8 @@
|
||||||
# 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/>.
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
from url_read import url_read
|
|
||||||
from __metadata__ import arch, lib_path
|
from __metadata__ import arch, lib_path
|
||||||
|
|
||||||
from search import sbo_search_pkg
|
|
||||||
|
|
||||||
|
|
||||||
class SBoGrep(object):
|
class SBoGrep(object):
|
||||||
'''
|
'''
|
||||||
|
@ -67,8 +62,8 @@ class SBoGrep(object):
|
||||||
if line.startswith(self.line_down):
|
if line.startswith(self.line_down):
|
||||||
if sbo_name == self.name:
|
if sbo_name == self.name:
|
||||||
SLACKBUILDS_TXT.close()
|
SLACKBUILDS_TXT.close()
|
||||||
return line[21:].strip()
|
return line[21:].strip()
|
||||||
|
|
||||||
def requires(self):
|
def requires(self):
|
||||||
'''
|
'''
|
||||||
Grab package requirements
|
Grab package requirements
|
||||||
|
@ -117,7 +112,7 @@ class SBoGrep(object):
|
||||||
if sbo_name == self.name:
|
if sbo_name == self.name:
|
||||||
SLACKBUILDS_TXT.close()
|
SLACKBUILDS_TXT.close()
|
||||||
return line[19:].strip()
|
return line[19:].strip()
|
||||||
|
|
||||||
def description(self):
|
def description(self):
|
||||||
'''
|
'''
|
||||||
Grab package verion
|
Grab package verion
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
# 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/>.
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
from url_read import url_read
|
from url_read import url_read
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,6 +30,7 @@ def read_readme(sbo_url, sbo_readme):
|
||||||
'''
|
'''
|
||||||
return url_read(sbo_url + sbo_readme)
|
return url_read(sbo_url + sbo_readme)
|
||||||
|
|
||||||
|
|
||||||
def read_info_slackbuild(sbo_url, name, sbo_file):
|
def read_info_slackbuild(sbo_url, name, sbo_file):
|
||||||
'''
|
'''
|
||||||
Read info and SlackBuild file
|
Read info and SlackBuild file
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
# 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/>.
|
||||||
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from __metadata__ import lib_path
|
from __metadata__ import lib_path
|
||||||
|
@ -37,14 +35,17 @@ def sbo_search_pkg(name):
|
||||||
'''
|
'''
|
||||||
try:
|
try:
|
||||||
blacklist = BlackList().packages()
|
blacklist = BlackList().packages()
|
||||||
sbo_url = ("http://slackbuilds.org/slackbuilds/{0}/".format(slack_ver()))
|
sbo_url = ("http://slackbuilds.org/slackbuilds/{0}/".format(
|
||||||
with open(lib_path + "sbo_repo/SLACKBUILDS.TXT", "r") as SLACKBUILDS_TXT:
|
slack_ver()))
|
||||||
|
with open(lib_path + "sbo_repo/SLACKBUILDS.TXT",
|
||||||
|
"r") as SLACKBUILDS_TXT:
|
||||||
for line in SLACKBUILDS_TXT:
|
for line in SLACKBUILDS_TXT:
|
||||||
if line.startswith("SLACKBUILD LOCATION"):
|
if line.startswith("SLACKBUILD LOCATION"):
|
||||||
sbo_name = (line[23:].split("/")[-1].replace("\n", "")).strip()
|
sbo_name = (line[23:].split("/")[-1].replace("\n",
|
||||||
|
"")).strip()
|
||||||
if name == sbo_name and name not in blacklist:
|
if name == sbo_name and name not in blacklist:
|
||||||
SLACKBUILDS_TXT.close()
|
SLACKBUILDS_TXT.close()
|
||||||
return (sbo_url + line[23:].strip() + "/")
|
return (sbo_url + line[23:].strip() + "/")
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print # new line at exit
|
print # new line at exit
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
|
@ -24,15 +24,16 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from colors import *
|
|
||||||
from init import initialization
|
from init import initialization
|
||||||
from downloader import Download
|
from downloader import Download
|
||||||
from __metadata__ import (tmp, pkg_path, build_path,
|
from __metadata__ import (tmp, pkg_path, build_path,
|
||||||
log_path, lib_path, sp)
|
log_path, lib_path, sp)
|
||||||
|
from colors import RED, GREEN, GREY, YELLOW, CYAN, ENDC
|
||||||
from messages import (pkg_found, template, build_FAILED,
|
from messages import (pkg_found, template, build_FAILED,
|
||||||
pkg_not_found, sbo_packages_view)
|
pkg_not_found, sbo_packages_view)
|
||||||
|
|
||||||
from pkg.find import find_package
|
|
||||||
|
from pkg.find import find_package
|
||||||
from pkg.build import build_package
|
from pkg.build import build_package
|
||||||
from pkg.manager import PackageManager
|
from pkg.manager import PackageManager
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ from dependency import sbo_dependencies_pkg
|
||||||
|
|
||||||
def sbo_build(name):
|
def sbo_build(name):
|
||||||
'''
|
'''
|
||||||
Download, build and install or upgrade packages
|
Download, build and install or upgrade packages
|
||||||
with all dependencies if version is greater than
|
with all dependencies if version is greater than
|
||||||
that established.
|
that established.
|
||||||
'''
|
'''
|
||||||
|
@ -52,7 +53,7 @@ def sbo_build(name):
|
||||||
reading_lists = "{0}Reading package lists ...{1}".format(GREY, ENDC)
|
reading_lists = "{0}Reading package lists ...{1}".format(GREY, ENDC)
|
||||||
sys.stdout.write(reading_lists)
|
sys.stdout.write(reading_lists)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
init = initialization()
|
initialization()
|
||||||
[
|
[
|
||||||
sbo_ver,
|
sbo_ver,
|
||||||
pkg_arch,
|
pkg_arch,
|
||||||
|
@ -67,7 +68,7 @@ def sbo_build(name):
|
||||||
try:
|
try:
|
||||||
if dependencies_list is not None or sbo_search_pkg(name) is not None:
|
if dependencies_list is not None or sbo_search_pkg(name) is not None:
|
||||||
pkg_sum = count_upgraded = count_installed = int()
|
pkg_sum = count_upgraded = count_installed = int()
|
||||||
# Insert master package in list to
|
# Insert master package in list to
|
||||||
# install it after dependencies
|
# install it after dependencies
|
||||||
requires.append(name)
|
requires.append(name)
|
||||||
# Create one list for all packages
|
# Create one list for all packages
|
||||||
|
@ -90,7 +91,7 @@ def sbo_build(name):
|
||||||
pkg_sum += 1
|
pkg_sum += 1
|
||||||
sys.stdout.write(done)
|
sys.stdout.write(done)
|
||||||
# Tag with color green if package already installed,
|
# Tag with color green if package already installed,
|
||||||
# color yellow for packages to upgrade and color red
|
# color yellow for packages to upgrade and color red
|
||||||
# if not installed. Also if package arch is UNSUPPORTED
|
# if not installed. Also if package arch is UNSUPPORTED
|
||||||
# tag with color red and if UNTESTED with color yellow.
|
# tag with color red and if UNTESTED with color yellow.
|
||||||
master_pkg = ("{0}-{1}".format(name, sbo_ver[-1]))
|
master_pkg = ("{0}-{1}".format(name, sbo_ver[-1]))
|
||||||
|
@ -98,7 +99,7 @@ def sbo_build(name):
|
||||||
PKG_COLOR = GREEN
|
PKG_COLOR = GREEN
|
||||||
elif find_package(name + sp, pkg_path):
|
elif find_package(name + sp, pkg_path):
|
||||||
PKG_COLOR = YELLOW
|
PKG_COLOR = YELLOW
|
||||||
count_upgraded += 1
|
count_upgraded += 1
|
||||||
else:
|
else:
|
||||||
PKG_COLOR = RED
|
PKG_COLOR = RED
|
||||||
count_installed += 1
|
count_installed += 1
|
||||||
|
@ -109,14 +110,17 @@ def sbo_build(name):
|
||||||
print("\nThe following packages will be automatically installed or upgraded")
|
print("\nThe following packages will be automatically installed or upgraded")
|
||||||
print("with new version:\n")
|
print("with new version:\n")
|
||||||
template(78)
|
template(78)
|
||||||
print("{0}{1}{2}{3}{4}{5}{6}".format("| Package", " " * 30, "Version", \
|
print("{0}{1}{2}{3}{4}{5}{6}".format(
|
||||||
" " * 10, "Arch", " " * 9, "Repository"))
|
"| Package", " " * 30, "Version",
|
||||||
|
" " * 10, "Arch", " " * 9, "Repository"))
|
||||||
template(78)
|
template(78)
|
||||||
print("Installing:")
|
print("Installing:")
|
||||||
sbo_packages_view(PKG_COLOR, name, sbo_ver[-1], ARCH_COLOR, pkg_arch[-1])
|
sbo_packages_view(PKG_COLOR, name, sbo_ver[-1], ARCH_COLOR,
|
||||||
|
pkg_arch[-1])
|
||||||
print("Installing for dependencies:")
|
print("Installing for dependencies:")
|
||||||
ARCH_COLOR = "" # reset arch color for dependencies packages
|
ARCH_COLOR = "" # reset arch color for dependencies packages
|
||||||
for dep, ver, dep_arch in zip(dependencies[:-1], sbo_ver[:-1], pkg_arch[:-1]):
|
for dep, ver, dep_arch in zip(dependencies[:-1], sbo_ver[:-1],
|
||||||
|
pkg_arch[:-1]):
|
||||||
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 = GREEN
|
DEP_COLOR = GREEN
|
||||||
|
@ -168,17 +172,18 @@ def sbo_build(name):
|
||||||
else:
|
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 = SBoGrep(pkg).source().split()
|
src_link = SBoGrep(pkg).source().split()
|
||||||
script = sbo_link.split("/")[-1] # get file from script
|
script = sbo_link.split("/")[-1]
|
||||||
Download(build_path, sbo_link).start()
|
Download(build_path, sbo_link).start()
|
||||||
sources = []
|
sources = []
|
||||||
for src in src_link:
|
for src in src_link:
|
||||||
sources.append(src.split("/")[-1]) # get file from source
|
# get file from source
|
||||||
|
sources.append(src.split("/")[-1])
|
||||||
Download(build_path, src).start()
|
Download(build_path, src).start()
|
||||||
build_package(script, sources, build_path)
|
build_package(script, sources, build_path)
|
||||||
# Searches the package name and version in /tmp to install.
|
# Searches the package name and version in /tmp to
|
||||||
# If find two or more packages e.g. to build tag
|
# install. If find two or more packages e.g. to build
|
||||||
# 2 or 3 will fit most.
|
# tag 2 or 3 will fit most.
|
||||||
binary_list = []
|
binary_list = []
|
||||||
for search in find_package(prgnam, tmp):
|
for search in find_package(prgnam, tmp):
|
||||||
if "_SBo" in search:
|
if "_SBo" in search:
|
||||||
|
@ -209,19 +214,22 @@ def sbo_build(name):
|
||||||
installed = ("{0}-{1}".format(pkg, ver))
|
installed = ("{0}-{1}".format(pkg, ver))
|
||||||
if find_package(installed, pkg_path):
|
if find_package(installed, pkg_path):
|
||||||
if pkg in upgraded:
|
if pkg in upgraded:
|
||||||
print("| Package {0} upgraded successfully".format(installed))
|
print("| Package {0} upgraded successfully".format(
|
||||||
|
installed))
|
||||||
else:
|
else:
|
||||||
print("| Package {0} installed successfully".format(installed))
|
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)
|
||||||
# Write dependencies in a log file
|
# Write dependencies in a log file
|
||||||
# into directory `/var/log/slpkg/dep/`
|
# into directory `/var/log/slpkg/dep/`
|
||||||
if find_package(name + sp, pkg_path):
|
if find_package(name + sp, pkg_path):
|
||||||
dep_path = log_path + "dep/"
|
dep_path = log_path + "dep/"
|
||||||
if not os.path.exists(dep_path):
|
if not os.path.exists(dep_path):
|
||||||
os.mkdir(dep_path)
|
os.mkdir(dep_path)
|
||||||
if os.path.isfile(dep_path + name):
|
if os.path.isfile(dep_path + name):
|
||||||
os.remove(dep_path + name)
|
os.remove(dep_path + name)
|
||||||
if len(dependencies) > 1:
|
if len(dependencies) > 1:
|
||||||
with open(dep_path + name, "w") as f:
|
with open(dep_path + name, "w") as f:
|
||||||
|
@ -232,7 +240,8 @@ def sbo_build(name):
|
||||||
ins = uns = int()
|
ins = uns = int()
|
||||||
sbo_matching = []
|
sbo_matching = []
|
||||||
index, toolbar_width = int(), 3
|
index, toolbar_width = int(), 3
|
||||||
with open(lib_path + "sbo_repo/SLACKBUILDS.TXT", "r") as SLACKBUILDS_TXT:
|
with open(lib_path + "sbo_repo/SLACKBUILDS.TXT",
|
||||||
|
"r") as SLACKBUILDS_TXT:
|
||||||
for line in SLACKBUILDS_TXT:
|
for line in SLACKBUILDS_TXT:
|
||||||
if line.startswith("SLACKBUILD NAME: "):
|
if line.startswith("SLACKBUILD NAME: "):
|
||||||
sbo_name = line[17:].strip()
|
sbo_name = line[17:].strip()
|
||||||
|
@ -252,8 +261,9 @@ def sbo_build(name):
|
||||||
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
|
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
|
||||||
CYAN, name, ENDC))
|
CYAN, name, ENDC))
|
||||||
template(78)
|
template(78)
|
||||||
print("{0}{1}{2}{3}{4}{5}{6}".format("| Package", " " * 30, "Version", \
|
print("{0}{1}{2}{3}{4}{5}{6}".format(
|
||||||
" " * 10, "Arch", " " * 9, "Repository"))
|
"| Package", " " * 30, "Version",
|
||||||
|
" " * 10, "Arch", " " * 9, "Repository"))
|
||||||
template(78)
|
template(78)
|
||||||
print("Matching:")
|
print("Matching:")
|
||||||
ARCH_COLOR = str()
|
ARCH_COLOR = str()
|
||||||
|
@ -281,9 +291,10 @@ def sbo_build(name):
|
||||||
message = "No matching"
|
message = "No matching"
|
||||||
pkg_not_found("\n", name, message, "\n")
|
pkg_not_found("\n", name, message, "\n")
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print # new line at exit
|
print # new line at exit
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
def select_arch(src):
|
def select_arch(src):
|
||||||
'''
|
'''
|
||||||
Looks if sources unsupported or untested
|
Looks if sources unsupported or untested
|
||||||
|
|
|
@ -23,10 +23,10 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from colors import *
|
|
||||||
from messages import template
|
from messages import template
|
||||||
from init import initialization
|
from init import initialization
|
||||||
from __metadata__ import pkg_path, sp
|
from __metadata__ import pkg_path, sp
|
||||||
|
from colors import RED, GREEN, GREY, YELLOW, CYAN, ENDC
|
||||||
|
|
||||||
from dependency import sbo_dependencies_pkg
|
from dependency import sbo_dependencies_pkg
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ from pkg.find import find_package
|
||||||
def track_dep(name):
|
def track_dep(name):
|
||||||
'''
|
'''
|
||||||
View tree of dependencies and also
|
View tree of dependencies and also
|
||||||
highlight packages with color green
|
highlight packages with color green
|
||||||
if allready installed and color red
|
if allready installed and color red
|
||||||
if not installed.
|
if not installed.
|
||||||
'''
|
'''
|
||||||
|
@ -44,7 +44,7 @@ def track_dep(name):
|
||||||
reading_lists = "{0}Reading package lists ...{1}".format(GREY, ENDC)
|
reading_lists = "{0}Reading package lists ...{1}".format(GREY, ENDC)
|
||||||
sys.stdout.write(reading_lists)
|
sys.stdout.write(reading_lists)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
init = initialization()
|
initialization()
|
||||||
dependencies_list = sbo_dependencies_pkg(name)
|
dependencies_list = sbo_dependencies_pkg(name)
|
||||||
if dependencies_list is not None:
|
if dependencies_list is not None:
|
||||||
sys.stdout.write(done)
|
sys.stdout.write(done)
|
||||||
|
@ -60,7 +60,7 @@ def track_dep(name):
|
||||||
if dependencies == []:
|
if dependencies == []:
|
||||||
dependencies = ["No dependencies"]
|
dependencies = ["No dependencies"]
|
||||||
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(CYAN, name, ENDC))
|
||||||
template(pkg_len)
|
template(pkg_len)
|
||||||
|
@ -71,11 +71,12 @@ def track_dep(name):
|
||||||
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, ENDC))
|
print(" {0}{1}: {2}{3}{4}".format("+--", index, GREEN, pkg,
|
||||||
|
ENDC))
|
||||||
else:
|
else:
|
||||||
print(" |")
|
print(" |")
|
||||||
print(" {0}{1}: {2}{3}{4}".format("+--", index, RED, pkg, ENDC))
|
print(" {0}{1}: {2}{3}{4}".format("+--", index, RED, pkg, ENDC))
|
||||||
print # new line at end
|
print # new line at end
|
||||||
else:
|
else:
|
||||||
sys.stdout.write(done)
|
sys.stdout.write(done)
|
||||||
print("\nNo package was found to match\n")
|
print("\nNo package was found to match\n")
|
||||||
|
|
|
@ -25,33 +25,33 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import pydoc
|
import pydoc
|
||||||
|
|
||||||
from colors import *
|
from colors import RED, GREEN, GREY, ENDC
|
||||||
from init import initialization
|
from init import initialization
|
||||||
from downloader import Download
|
from downloader import Download
|
||||||
from __metadata__ import tmp, build_path, pkg_path, sp
|
from __metadata__ import tmp, build_path, pkg_path, sp
|
||||||
from messages import (pkg_found, view_sbo, pkg_not_found,
|
from messages import (pkg_found, view_sbo, pkg_not_found,
|
||||||
template, build_FAILED)
|
template, build_FAILED)
|
||||||
|
|
||||||
from pkg.build import build_package
|
from pkg.build import build_package
|
||||||
from pkg.find import find_package
|
from pkg.find import find_package
|
||||||
from pkg.manager import PackageManager
|
from pkg.manager import PackageManager
|
||||||
|
|
||||||
from read import *
|
from greps import SBoGrep
|
||||||
from greps import SBoGrep
|
|
||||||
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 read import read_readme, read_info_slackbuild
|
||||||
|
|
||||||
|
|
||||||
def sbo_network(name):
|
def sbo_network(name):
|
||||||
'''
|
'''
|
||||||
View SlackBuild package, read or install them
|
View SlackBuild package, read or install them
|
||||||
from slackbuilds.org
|
from slackbuilds.org
|
||||||
'''
|
'''
|
||||||
done = "{0}Done{1}\n".format(GREY, ENDC)
|
done = "{0}Done{1}\n".format(GREY, ENDC)
|
||||||
reading_lists = "{0}Reading package lists ...{1}".format(GREY, ENDC)
|
reading_lists = "{0}Reading package lists ...{1}".format(GREY, ENDC)
|
||||||
sys.stdout.write(reading_lists)
|
sys.stdout.write(reading_lists)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
init = initialization()
|
initialization()
|
||||||
sbo_url = sbo_search_pkg(name)
|
sbo_url = sbo_search_pkg(name)
|
||||||
if sbo_url:
|
if sbo_url:
|
||||||
sbo_desc = SBoGrep(name).description()[len(name) + 2:-1]
|
sbo_desc = SBoGrep(name).description()[len(name) + 2:-1]
|
||||||
|
@ -59,8 +59,8 @@ def sbo_network(name):
|
||||||
sbo_dwn = sbo_slackbuild_dwn(sbo_url)
|
sbo_dwn = sbo_slackbuild_dwn(sbo_url)
|
||||||
source_dwn = SBoGrep(name).source().split()
|
source_dwn = SBoGrep(name).source().split()
|
||||||
sys.stdout.write(done)
|
sys.stdout.write(done)
|
||||||
view_sbo(name, sbo_url, sbo_desc, sbo_dwn.split("/")[-1], \
|
view_sbo(name, sbo_url, sbo_desc, sbo_dwn.split("/")[-1],
|
||||||
", ".join([src.split("/")[-1] for src in source_dwn]), \
|
", ".join([src.split("/")[-1] for src in source_dwn]),
|
||||||
sbo_req)
|
sbo_req)
|
||||||
# Check if package supported by arch
|
# Check if package supported by arch
|
||||||
# before proceed to install
|
# before proceed to install
|
||||||
|
@ -72,7 +72,7 @@ def sbo_network(name):
|
||||||
try:
|
try:
|
||||||
read = raw_input(" {0}Choose an option: {1}".format(GREY, ENDC))
|
read = raw_input(" {0}Choose an option: {1}".format(GREY, ENDC))
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print # new line at exit
|
print # new line at exit
|
||||||
break
|
break
|
||||||
if read == "D" or read == "d":
|
if read == "D" or read == "d":
|
||||||
path = ""
|
path = ""
|
||||||
|
@ -97,11 +97,11 @@ def sbo_network(name):
|
||||||
os.mkdir(build_path)
|
os.mkdir(build_path)
|
||||||
sources = []
|
sources = []
|
||||||
os.chdir(build_path)
|
os.chdir(build_path)
|
||||||
script = sbo_dwn.split("/")[-1] # get file from script link
|
script = sbo_dwn.split("/")[-1]
|
||||||
Download(build_path, sbo_dwn).start()
|
Download(build_path, sbo_dwn).start()
|
||||||
for src in source_dwn:
|
for src in source_dwn:
|
||||||
Download(build_path, src).start()
|
Download(build_path, src).start()
|
||||||
sources.append(src.split("/")[-1]) # get file from source link
|
sources.append(src.split("/")[-1])
|
||||||
build_package(script, sources, build_path)
|
build_package(script, sources, build_path)
|
||||||
break
|
break
|
||||||
elif read == "I" or read == "i":
|
elif read == "I" or read == "i":
|
||||||
|
@ -116,13 +116,13 @@ def sbo_network(name):
|
||||||
sources = []
|
sources = []
|
||||||
os.chdir(build_path)
|
os.chdir(build_path)
|
||||||
Download(build_path, sbo_dwn).start()
|
Download(build_path, sbo_dwn).start()
|
||||||
script = sbo_dwn.split("/")[-1] # get file from script link
|
script = sbo_dwn.split("/")[-1]
|
||||||
for src in source_dwn:
|
for src in source_dwn:
|
||||||
Download(build_path, src).start()
|
Download(build_path, src).start()
|
||||||
sources.append(src.split("/")[-1]) # get file from source link
|
sources.append(src.split("/")[-1])
|
||||||
build_package(script, sources, build_path)
|
build_package(script, sources, build_path)
|
||||||
# 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
|
||||||
# 2 or 3 will fit most.
|
# 2 or 3 will fit most.
|
||||||
binary_list = []
|
binary_list = []
|
||||||
for search in find_package(prgnam, tmp):
|
for search in find_package(prgnam, tmp):
|
||||||
|
@ -133,7 +133,8 @@ def sbo_network(name):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
build_FAILED(sbo_url, prgnam)
|
build_FAILED(sbo_url, prgnam)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
print("{0}[ Installing ] --> {1} {2}".format(GREEN, ENDC, name))
|
print("{0}[ Installing ] --> {1} {2}".format(GREEN, ENDC,
|
||||||
|
name))
|
||||||
PackageManager(binary).upgrade()
|
PackageManager(binary).upgrade()
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -25,12 +25,12 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from colors import *
|
|
||||||
from url_read import url_read
|
from url_read import url_read
|
||||||
from downloader import Download
|
from downloader import Download
|
||||||
from blacklist import BlackList
|
from blacklist import BlackList
|
||||||
from messages import pkg_not_found, template
|
from messages import pkg_not_found, template
|
||||||
from __metadata__ import slpkg_tmp, pkg_path, slack_archs
|
from __metadata__ import slpkg_tmp, pkg_path
|
||||||
|
from colors import RED, GREEN, CYAN, YELLOW, GREY, ENDC
|
||||||
|
|
||||||
from pkg.find import find_package
|
from pkg.find import find_package
|
||||||
from pkg.manager import PackageManager
|
from pkg.manager import PackageManager
|
||||||
|
@ -49,7 +49,8 @@ def install(slack_pkg, version):
|
||||||
[
|
[
|
||||||
comp_sum,
|
comp_sum,
|
||||||
uncomp_sum,
|
uncomp_sum,
|
||||||
names, dwn_list,
|
names,
|
||||||
|
dwn_list,
|
||||||
comp_size,
|
comp_size,
|
||||||
uncomp_size,
|
uncomp_size,
|
||||||
install_all,
|
install_all,
|
||||||
|
@ -65,7 +66,7 @@ def install(slack_pkg, version):
|
||||||
if not os.path.exists(tmp_path):
|
if not os.path.exists(tmp_path):
|
||||||
os.mkdir(tmp_path)
|
os.mkdir(tmp_path)
|
||||||
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
|
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
|
||||||
CYAN, slack_pkg, ENDC))
|
CYAN, slack_pkg, ENDC))
|
||||||
sys.stdout.write(reading_lists)
|
sys.stdout.write(reading_lists)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
blacklist = BlackList().packages()
|
blacklist = BlackList().packages()
|
||||||
|
@ -89,9 +90,11 @@ def install(slack_pkg, version):
|
||||||
comp_size.append(line[28:-2].strip())
|
comp_size.append(line[28:-2].strip())
|
||||||
if line.startswith("PACKAGE SIZE (uncompressed): "):
|
if line.startswith("PACKAGE SIZE (uncompressed): "):
|
||||||
uncomp_size.append(line[30:-2].strip())
|
uncomp_size.append(line[30:-2].strip())
|
||||||
for loc, name, comp, uncomp in zip(package_location, package_name, comp_size, uncomp_size):
|
for loc, name, comp, uncomp in zip(package_location, package_name,
|
||||||
|
comp_size, uncomp_size):
|
||||||
if slack_pkg in name and slack_pkg not in blacklist:
|
if slack_pkg in name and slack_pkg not in blacklist:
|
||||||
dwn_list.append("{0}{1}/{2}".format(mirrors("","", version), loc, name))
|
dwn_list.append("{0}{1}/{2}".format(mirrors("", "", version),
|
||||||
|
loc, name))
|
||||||
install_all.append(name)
|
install_all.append(name)
|
||||||
comp_sum.append(comp)
|
comp_sum.append(comp)
|
||||||
uncomp_sum.append(uncomp)
|
uncomp_sum.append(uncomp)
|
||||||
|
@ -99,8 +102,12 @@ def install(slack_pkg, version):
|
||||||
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(
|
||||||
"| Package", " " * 17, "Version", " " * 12, "Arch", " " * 4, \
|
"| Package", " " * 17,
|
||||||
"Build", " " * 2, "Repos", " " * 10, "Size"))
|
"Version", " " * 12,
|
||||||
|
"Arch", " " * 4,
|
||||||
|
"Build", " " * 2,
|
||||||
|
"Repos", " " * 10,
|
||||||
|
"Size"))
|
||||||
template(78)
|
template(78)
|
||||||
print("Installing:")
|
print("Installing:")
|
||||||
for pkg, comp in zip(install_all, comp_sum):
|
for pkg, comp in zip(install_all, comp_sum):
|
||||||
|
@ -120,12 +127,12 @@ def install(slack_pkg, version):
|
||||||
COLOR = RED
|
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, name, ENDC, \
|
COLOR, name, ENDC,
|
||||||
" " * (25-len(name)), ver, \
|
" " * (25-len(name)), ver,
|
||||||
" " * (19-len(ver)), arch, \
|
" " * (19-len(ver)), arch,
|
||||||
" " * (8-len(arch)), build, \
|
" " * (8-len(arch)), build,
|
||||||
" " * (7-len(build)), "Slack", \
|
" " * (7-len(build)), "Slack",
|
||||||
comp, " K"))
|
comp, " K"))
|
||||||
comp_unit = uncomp_unit = "Mb"
|
comp_unit = uncomp_unit = "Mb"
|
||||||
compressed = round((sum(map(float, comp_sum)) / 1024), 2)
|
compressed = round((sum(map(float, comp_sum)) / 1024), 2)
|
||||||
uncompressed = round((sum(map(float, uncomp_sum)) / 1024), 2)
|
uncompressed = round((sum(map(float, uncomp_sum)) / 1024), 2)
|
||||||
|
@ -151,8 +158,9 @@ def install(slack_pkg, version):
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
print("{0}Total {1} {2}.".format(GREY, len(install_all), msg_pkg))
|
print("{0}Total {1} {2}.".format(GREY, len(install_all), msg_pkg))
|
||||||
print("{0} {1} will be installed, {2} will be upgraded and {3} will be resettled.".format(
|
print("{0} {1} will be installed, {2} will be upgraded and {3} will be resettled.".format(
|
||||||
uni_sum, msg_2_pkg, upg_sum, pkg_sum))
|
uni_sum, msg_2_pkg, upg_sum, pkg_sum))
|
||||||
print("Need to get {0} {1} of archives.".format(compressed, comp_unit))
|
print("Need to get {0} {1} of archives.".format(compressed,
|
||||||
|
comp_unit))
|
||||||
print("After this process, {0} {1} of additional disk space will be used.{2}".format(
|
print("After this process, {0} {1} of additional disk space will be used.{2}".format(
|
||||||
uncompressed, uncomp_unit, ENDC))
|
uncompressed, uncomp_unit, ENDC))
|
||||||
read = raw_input("\nWould you like to install [Y/n]? ")
|
read = raw_input("\nWould you like to install [Y/n]? ")
|
||||||
|
@ -182,12 +190,14 @@ def install(slack_pkg, version):
|
||||||
if os.listdir(tmp_path) == []:
|
if os.listdir(tmp_path) == []:
|
||||||
print("Packages removed")
|
print("Packages removed")
|
||||||
else:
|
else:
|
||||||
print("\nThere are packages in directory {0}\n".format(tmp_path))
|
print("\nThere are packages in directory {0}\n".format(
|
||||||
|
tmp_path))
|
||||||
else:
|
else:
|
||||||
print("\nThere are packages in directory {0}\n".format(tmp_path))
|
print("\nThere are packages in directory {0}\n".format(
|
||||||
|
tmp_path))
|
||||||
else:
|
else:
|
||||||
message = "No matching"
|
message = "No matching"
|
||||||
pkg_not_found("\n", slack_pkg, message, "\n")
|
pkg_not_found("\n", slack_pkg, message, "\n")
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print # new line at exit
|
print # new line at exit
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
|
@ -34,7 +34,7 @@ def mirrors(name, location, version):
|
||||||
if version == "stable":
|
if version == "stable":
|
||||||
http = "http://mirrors.slackware.com/slackware/slackware64-{0}/{1}{2}".format(
|
http = "http://mirrors.slackware.com/slackware/slackware64-{0}/{1}{2}".format(
|
||||||
slack_ver(), location, name)
|
slack_ver(), location, name)
|
||||||
else:
|
else:
|
||||||
http = "http://mirrors.slackware.com/slackware/slackware64-{0}/{1}{2}".format(
|
http = "http://mirrors.slackware.com/slackware/slackware64-{0}/{1}{2}".format(
|
||||||
version, location, name)
|
version, location, name)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -26,7 +26,7 @@ import sys
|
||||||
import time
|
import time
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from colors import *
|
from colors import GREEN, GREY, YELLOW, ENDC
|
||||||
from url_read import url_read
|
from url_read import url_read
|
||||||
from messages import template
|
from messages import template
|
||||||
from downloader import Download
|
from downloader import Download
|
||||||
|
@ -55,7 +55,7 @@ def patches(version):
|
||||||
uncomp_size,
|
uncomp_size,
|
||||||
upgrade_all,
|
upgrade_all,
|
||||||
package_name,
|
package_name,
|
||||||
package_location
|
package_location
|
||||||
] = ([] for i in range(8))
|
] = ([] for i in range(8))
|
||||||
slack_arch = str()
|
slack_arch = str()
|
||||||
patch_path = slpkg_tmp + "patches/"
|
patch_path = slpkg_tmp + "patches/"
|
||||||
|
@ -63,7 +63,7 @@ def patches(version):
|
||||||
os.mkdir(slpkg_tmp)
|
os.mkdir(slpkg_tmp)
|
||||||
if not os.path.exists(patch_path):
|
if not os.path.exists(patch_path):
|
||||||
os.mkdir(patch_path)
|
os.mkdir(patch_path)
|
||||||
sys.stdout.write (reading_lists)
|
sys.stdout.write(reading_lists)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
blacklist = BlackList().packages()
|
blacklist = BlackList().packages()
|
||||||
if version == "stable":
|
if version == "stable":
|
||||||
|
@ -81,38 +81,41 @@ def patches(version):
|
||||||
toolbar_width += step
|
toolbar_width += step
|
||||||
time.sleep(0.05)
|
time.sleep(0.05)
|
||||||
if line.startswith("PACKAGE NAME"):
|
if line.startswith("PACKAGE NAME"):
|
||||||
package_name.append(line[15:].strip())
|
package_name.append(line[15:].strip())
|
||||||
if line.startswith("PACKAGE LOCATION"):
|
if line.startswith("PACKAGE LOCATION"):
|
||||||
package_location.append(line[21:].strip())
|
package_location.append(line[21:].strip())
|
||||||
if line.startswith("PACKAGE SIZE (compressed): "):
|
if line.startswith("PACKAGE SIZE (compressed): "):
|
||||||
comp_size.append(line[28:-2].strip())
|
comp_size.append(line[28:-2].strip())
|
||||||
if line.startswith("PACKAGE SIZE (uncompressed): "):
|
if line.startswith("PACKAGE SIZE (uncompressed): "):
|
||||||
uncomp_size.append(line[30:-2].strip())
|
uncomp_size.append(line[30:-2].strip())
|
||||||
if version == "stable": # stables versions upgrade
|
if version == "stable": # stables versions upgrade
|
||||||
for loc, name, comp, uncomp in zip(package_location, package_name, \
|
for loc, name, comp, uncomp in zip(package_location, package_name,
|
||||||
comp_size, uncomp_size):
|
comp_size, uncomp_size):
|
||||||
if not os.path.isfile(pkg_path + name[:-4]) and split_package(
|
if (not os.path.isfile(pkg_path + name[:-4]) and split_package(
|
||||||
name)[0] not in blacklist:
|
name)[0] not in blacklist):
|
||||||
dwn_patches.append("{0}{1}/{2}".format(mirrors("","", version), loc, name))
|
dwn_patches.append("{0}{1}/{2}".format(
|
||||||
|
mirrors("", "", version), loc, name))
|
||||||
comp_sum.append(comp)
|
comp_sum.append(comp)
|
||||||
uncomp_sum.append(uncomp)
|
uncomp_sum.append(uncomp)
|
||||||
upgrade_all.append(name)
|
upgrade_all.append(name)
|
||||||
else: # current version upgrade
|
else: # current version upgrade
|
||||||
installed = []
|
installed = []
|
||||||
# get all installed packages and store the package name.
|
# get all installed packages and store the package name.
|
||||||
for pkg in os.listdir(pkg_path):
|
for pkg in os.listdir(pkg_path):
|
||||||
installed.append(split_package(pkg + ".???")[0])
|
installed.append(split_package(pkg + ".???")[0])
|
||||||
for loc, name, comp, uncomp in zip(package_location, package_name, \
|
for loc, name, comp, uncomp in zip(package_location, package_name,
|
||||||
comp_size, uncomp_size):
|
comp_size, uncomp_size):
|
||||||
# If the package from the current repository is installed
|
# If the package from the current repository is installed
|
||||||
# (check with the name) but not is in the path (check with all package
|
# (check with the name) but not is in the path (check with
|
||||||
# like 'apr-1.5.0-x86_64-1') then add to list for upgrade.
|
# all package like 'apr-1.5.0-x86_64-1') then add to list for
|
||||||
# etc. 'apr' in list 'installed' ?? if yes 'apr-1.5.0-x86_64-1' exist
|
# upgrade.
|
||||||
# in /var/log/packages ?? if no add to upgrade.
|
# etc. 'apr' in list 'installed' ?? if yes 'apr-1.5.0-x86_64-1'
|
||||||
|
# exist in /var/log/packages ?? if no add to upgrade.
|
||||||
if split_package(name)[0] in installed:
|
if split_package(name)[0] in installed:
|
||||||
if not os.path.isfile(pkg_path + name[:-4]) and split_package(
|
if (not os.path.isfile(pkg_path + name[:-4]) and
|
||||||
name)[0] not in blacklist:
|
split_package(name)[0] not in blacklist):
|
||||||
dwn_patches.append("{0}{1}/{2}".format(mirrors("","", version), loc, name))
|
dwn_patches.append("{0}{1}/{2}".format(
|
||||||
|
mirrors("", "", version), loc, name))
|
||||||
comp_sum.append(comp)
|
comp_sum.append(comp)
|
||||||
uncomp_sum.append(uncomp)
|
uncomp_sum.append(uncomp)
|
||||||
upgrade_all.append(name)
|
upgrade_all.append(name)
|
||||||
|
@ -121,8 +124,12 @@ def patches(version):
|
||||||
print("\nThese packages need upgrading:\n")
|
print("\nThese packages need upgrading:\n")
|
||||||
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(
|
||||||
"| Package", " " * 17, "Version", " " * 12, "Arch", " " * 4, \
|
"| Package", " " * 17,
|
||||||
"Build", " " * 2, "Repos", " " * 10, "Size"))
|
"Version", " " * 12,
|
||||||
|
"Arch", " " * 4,
|
||||||
|
"Build", " " * 2,
|
||||||
|
"Repos", " " * 10,
|
||||||
|
"Size"))
|
||||||
template(78)
|
template(78)
|
||||||
print("Upgrading:")
|
print("Upgrading:")
|
||||||
for upgrade, size in zip(upgrade_all, comp_sum):
|
for upgrade, size in zip(upgrade_all, comp_sum):
|
||||||
|
@ -132,12 +139,12 @@ def patches(version):
|
||||||
arch = pkg_split[2]
|
arch = pkg_split[2]
|
||||||
build = pkg_split[3]
|
build = pkg_split[3]
|
||||||
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, name, ENDC, \
|
YELLOW, name, ENDC,
|
||||||
" " * (25-len(name)), ver, \
|
" " * (25-len(name)), ver,
|
||||||
" " * (19-len(ver)), arch, \
|
" " * (19-len(ver)), arch,
|
||||||
" " * (8-len(arch)), build, \
|
" " * (8-len(arch)), build,
|
||||||
" " * (7-len(build)), "Slack", \
|
" " * (7-len(build)), "Slack",
|
||||||
size, " K"))
|
size, " K"))
|
||||||
comp_unit = uncomp_unit = "Mb"
|
comp_unit = uncomp_unit = "Mb"
|
||||||
compressed = round((sum(map(float, comp_sum)) / 1024), 2)
|
compressed = round((sum(map(float, comp_sum)) / 1024), 2)
|
||||||
uncompressed = round((sum(map(float, uncomp_sum)) / 1024), 2)
|
uncompressed = round((sum(map(float, uncomp_sum)) / 1024), 2)
|
||||||
|
@ -158,8 +165,11 @@ def patches(version):
|
||||||
msg_pkg = msg_pkg + "s"
|
msg_pkg = msg_pkg + "s"
|
||||||
print("\nInstalling summary")
|
print("\nInstalling summary")
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
print("{0}Total {1} {2} will be upgraded.".format(GREY, len(upgrade_all), msg_pkg))
|
print("{0}Total {1} {2} will be upgraded.".format(GREY,
|
||||||
print("Need to get {0} {1} of archives.".format(compressed, comp_unit))
|
len(upgrade_all),
|
||||||
|
msg_pkg))
|
||||||
|
print("Need to get {0} {1} of archives.".format(compressed,
|
||||||
|
comp_unit))
|
||||||
print("After this process, {0} {1} of additional disk space will be used.{2}".format(
|
print("After this process, {0} {1} of additional disk space will be used.{2}".format(
|
||||||
uncompressed, uncomp_unit, ENDC))
|
uncompressed, uncomp_unit, ENDC))
|
||||||
read = raw_input("\nWould you like to upgrade [Y/n]? ")
|
read = raw_input("\nWould you like to upgrade [Y/n]? ")
|
||||||
|
@ -168,7 +178,8 @@ def patches(version):
|
||||||
Download(patch_path, dwn).start()
|
Download(patch_path, dwn).start()
|
||||||
Download(patch_path, dwn + ".asc").start()
|
Download(patch_path, dwn + ".asc").start()
|
||||||
for pkg in upgrade_all:
|
for pkg in upgrade_all:
|
||||||
print("{0}[ upgrading ] --> {1}{2}".format(GREEN, ENDC, pkg[:-4]))
|
print("{0}[ upgrading ] --> {1}{2}".format(GREEN, ENDC,
|
||||||
|
pkg[:-4]))
|
||||||
PackageManager((patch_path + pkg).split()).upgrade()
|
PackageManager((patch_path + pkg).split()).upgrade()
|
||||||
for kernel in upgrade_all:
|
for kernel in upgrade_all:
|
||||||
if "kernel" in kernel:
|
if "kernel" in kernel:
|
||||||
|
@ -183,14 +194,17 @@ def patches(version):
|
||||||
if os.listdir(patch_path) == []:
|
if os.listdir(patch_path) == []:
|
||||||
print("Packages removed")
|
print("Packages removed")
|
||||||
else:
|
else:
|
||||||
print("\nThere are packages in direcrory {0}\n".format(patch_path))
|
print("\nThere are packages in direcrory {0}\n".format(
|
||||||
|
patch_path))
|
||||||
else:
|
else:
|
||||||
print("\nThere are packages in directory {0}\n".format(patch_path))
|
print("\nThere are packages in directory {0}\n".format(
|
||||||
|
patch_path))
|
||||||
else:
|
else:
|
||||||
if os.uname()[4] == "x86_64":
|
if os.uname()[4] == "x86_64":
|
||||||
slack_arch = 64
|
slack_arch = 64
|
||||||
print("\nSlackware{0} '{1}' v{2} distribution is up to date\n".format(
|
print(
|
||||||
slack_arch, version, slack_ver()))
|
"\nSlackware{0} '{1}' v{2} distribution is up to date\n".format(
|
||||||
|
slack_arch, version, slack_ver()))
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print # new line at exit
|
print # new line at exit
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
|
@ -38,7 +38,7 @@ def split_package(package):
|
||||||
if "_slack" in package:
|
if "_slack" in package:
|
||||||
slack = "_slack" + slack_ver()
|
slack = "_slack" + slack_ver()
|
||||||
pkg = package[:-(len(slack) + 4)]
|
pkg = package[:-(len(slack) + 4)]
|
||||||
build = pkg.split("-")[-1]
|
build = pkg.split("-")[-1]
|
||||||
pkg_ver = pkg[:-(len(arch) + len(build))]
|
pkg_ver = pkg[:-(len(arch) + len(build))]
|
||||||
ver = pkg_ver.split("-")[-1]
|
ver = pkg_ver.split("-")[-1]
|
||||||
name = pkg_ver[:-(len(ver) + 1)]
|
name = pkg_ver[:-(len(ver) + 1)]
|
||||||
|
|
|
@ -36,5 +36,5 @@ def url_read(link):
|
||||||
print ("\nslpkg: error: connection refused\n")
|
print ("\nslpkg: error: connection refused\n")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print # new line at exit
|
print # new line at exit
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
Loading…
Reference in a new issue