mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-27 09:58:10 +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/
|
||||||
|
|
|
@ -38,4 +38,3 @@ from slpkg import main
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
|
@ -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.
|
||||||
|
@ -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()
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
|
|
||||||
def md5sum(source):
|
def md5sum(source):
|
||||||
'''
|
'''
|
||||||
Calculate the md5 checksum
|
Calculate the md5 checksum
|
||||||
|
|
|
@ -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,7 +40,8 @@ class Download(object):
|
||||||
Check if file already download the skip or continue
|
Check if file already download the skip or continue
|
||||||
download if before stoped.
|
download if before stoped.
|
||||||
'''
|
'''
|
||||||
print("\n{0}[ Download ] -->{1} {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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
@ -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()
|
||||||
|
|
|
@ -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
|
||||||
|
@ -44,6 +43,7 @@ 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 = [
|
||||||
|
@ -90,10 +90,14 @@ def main():
|
||||||
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,13 +115,15 @@ 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])
|
||||||
|
@ -128,7 +135,8 @@ def main():
|
||||||
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":
|
||||||
|
@ -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,48 +54,53 @@ 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):
|
||||||
'''
|
'''
|
||||||
Print template
|
Print template
|
||||||
'''
|
'''
|
||||||
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,
|
||||||
|
" " * (17-len(version)), ARCH_COLOR, arch, ENDC,
|
||||||
" " * (13-len(arch)), "SBo"))
|
" " * (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
|
||||||
|
@ -43,7 +43,7 @@ def build_package(script, sources, path):
|
||||||
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/"
|
||||||
|
@ -90,7 +90,8 @@ def build_package(script, sources, path):
|
||||||
shutil.copy2(src, prgnam)
|
shutil.copy2(src, prgnam)
|
||||||
os.chdir(path + prgnam)
|
os.chdir(path + prgnam)
|
||||||
subprocess.call("chmod +x {0}.SlackBuild".format(prgnam), shell=True)
|
subprocess.call("chmod +x {0}.SlackBuild".format(prgnam), shell=True)
|
||||||
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,7 +100,7 @@ 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()
|
||||||
|
@ -110,13 +111,16 @@ def build_package(script, sources, path):
|
||||||
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,7 +128,8 @@ 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")
|
||||||
|
|
|
@ -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
|
||||||
|
@ -81,7 +80,8 @@ class PackageManager(object):
|
||||||
'''
|
'''
|
||||||
for pkg in self.binary:
|
for pkg in self.binary:
|
||||||
try:
|
try:
|
||||||
print(subprocess.check_output("upgradepkg --reinstall {0}".format(
|
print(
|
||||||
|
subprocess.check_output("upgradepkg --reinstall {0}".format(
|
||||||
pkg), shell=True))
|
pkg), shell=True))
|
||||||
print("Completed!\n")
|
print("Completed!\n")
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
|
@ -108,7 +108,9 @@ 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"
|
||||||
|
@ -120,7 +122,8 @@ class PackageManager(object):
|
||||||
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(
|
||||||
|
"\nAre you sure to remove {0} {1} [Y/n]? ".format(
|
||||||
str(len(removed)), msg))
|
str(len(removed)), msg))
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print # new line at exit
|
print # new line at exit
|
||||||
|
@ -136,10 +139,11 @@ class PackageManager(object):
|
||||||
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)
|
||||||
|
@ -148,26 +152,30 @@ class PackageManager(object):
|
||||||
"\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:
|
||||||
|
@ -188,7 +196,7 @@ 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:
|
||||||
|
@ -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,7 +264,8 @@ 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
|
||||||
|
raw_input("Press [ {0}Enter{1} ] >> Next page ".format(
|
||||||
CYAN, ENDC))
|
CYAN, ENDC))
|
||||||
page += 50
|
page += 50
|
||||||
print # new line at end
|
print # new line at end
|
||||||
|
|
|
@ -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
|
||||||
|
@ -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:
|
||||||
|
@ -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,7 +155,8 @@ 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)
|
||||||
|
@ -163,7 +164,6 @@ class QueuePkgs(object):
|
||||||
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
|
||||||
|
@ -54,7 +54,7 @@ def sbo_check():
|
||||||
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
|
||||||
[
|
[
|
||||||
|
@ -94,7 +94,8 @@ def sbo_check():
|
||||||
# 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)
|
||||||
|
@ -112,8 +113,9 @@ def sbo_check():
|
||||||
# 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.
|
||||||
|
requires.reverse()
|
||||||
# Many packages use the same dependencies, in this loop
|
# Many packages use the same dependencies, in this loop
|
||||||
# creates a new list by removing duplicate dependencies but
|
# creates a new list by removing duplicate dependencies but
|
||||||
# without spoiling the line must be installed.
|
# without spoiling the line must be installed.
|
||||||
|
@ -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,9 +219,11 @@ 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(
|
||||||
|
GREEN, ENDC, name))
|
||||||
# Use this list to pick out what
|
# Use this list to pick out what
|
||||||
# packages will be installed
|
# packages will be installed
|
||||||
installed.append(name)
|
installed.append(name)
|
||||||
|
@ -233,7 +243,8 @@ def sbo_check():
|
||||||
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")
|
||||||
|
|
|
@ -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,6 +32,7 @@ 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
|
||||||
|
|
|
@ -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):
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -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,11 +35,14 @@ 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() + "/")
|
||||||
|
|
|
@ -24,14 +24,15 @@
|
||||||
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
|
||||||
|
@ -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,
|
||||||
|
@ -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(
|
||||||
|
"| Package", " " * 30, "Version",
|
||||||
" " * 10, "Arch", " " * 9, "Repository"))
|
" " * 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
|
||||||
|
@ -169,16 +173,17 @@ def sbo_build(name):
|
||||||
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,11 +214,14 @@ 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/`
|
||||||
|
@ -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,7 +261,8 @@ 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(
|
||||||
|
"| Package", " " * 30, "Version",
|
||||||
" " * 10, "Arch", " " * 9, "Repository"))
|
" " * 10, "Arch", " " * 9, "Repository"))
|
||||||
template(78)
|
template(78)
|
||||||
print("Matching:")
|
print("Matching:")
|
||||||
|
@ -284,6 +294,7 @@ def sbo_build(name):
|
||||||
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
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
@ -71,7 +71,8 @@ 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))
|
||||||
|
|
|
@ -25,7 +25,7 @@ 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
|
||||||
|
@ -36,10 +36,10 @@ 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):
|
||||||
|
@ -51,7 +51,7 @@ def sbo_network(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_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
|
||||||
|
@ -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,10 +116,10 @@ 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
|
||||||
|
@ -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,
|
||||||
|
@ -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,11 +127,11 @@ 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)
|
||||||
|
@ -152,7 +159,8 @@ def install(slack_pkg, version):
|
||||||
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,9 +190,11 @@ 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")
|
||||||
|
|
|
@ -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
|
||||||
|
@ -89,11 +89,12 @@ def patches(version):
|
||||||
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)
|
||||||
|
@ -102,17 +103,19 @@ def patches(version):
|
||||||
# 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,11 +139,11 @@ 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)
|
||||||
|
@ -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,13 +194,16 @@ 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(
|
||||||
|
"\nSlackware{0} '{1}' v{2} distribution is up to date\n".format(
|
||||||
slack_arch, version, slack_ver()))
|
slack_arch, version, slack_ver()))
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print # new line at exit
|
print # new line at exit
|
||||||
|
|
Loading…
Reference in a new issue