mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-17 06:11:35 +01:00
updated source code
This commit is contained in:
parent
086316ffdf
commit
63c5e6210c
3 changed files with 33 additions and 18 deletions
|
@ -48,10 +48,10 @@ def sbo_check():
|
|||
sys.stdout.write("Reading package lists ...")
|
||||
sys.stdout.flush()
|
||||
initialization()
|
||||
sbo_list = []
|
||||
index, toolbar_width = 0, 3
|
||||
GREEN, RED, ENDC = colors.GREEN, colors.RED, colors.ENDC
|
||||
pkg_name, sbo_ver, pkg_for_upg = [], [], []
|
||||
sbo_list, pkg_arch = [], []
|
||||
upg_name, pkg_for_upg, upg_ver, upg_arch = [], [], [], []
|
||||
for pkg in os.listdir(pkg_path):
|
||||
if pkg.endswith("_SBo"):
|
||||
sbo_list.append(pkg)
|
||||
|
@ -77,10 +77,10 @@ def sbo_check():
|
|||
name = name[:-(len(pkg_version) + 1)]
|
||||
sbo_version = sbo_version_pkg(name)
|
||||
if sbo_version > pkg_version:
|
||||
pkg_name.append(name)
|
||||
upg_name.append(name)
|
||||
pkg_for_upg.append("{0}-{1}".format(name, pkg_version))
|
||||
sbo_ver.append(sbo_version)
|
||||
pkg_arch.append(arch)
|
||||
upg_ver.append(sbo_version)
|
||||
upg_arch.append(arch)
|
||||
sys.stdout.write("Done\n")
|
||||
if pkg_for_upg:
|
||||
print("\nThese packages need upgrading:\n")
|
||||
|
@ -88,9 +88,9 @@ def sbo_check():
|
|||
print "| Package", " "*27, "New version", " "*5, "Arch", " "*7, "Repository"
|
||||
template(78)
|
||||
print("Upgrading:")
|
||||
for upg, ver, arch in zip(pkg_for_upg, sbo_ver, pkg_arch):
|
||||
print " ", RED + upg + ENDC, " "*(34-len(upg)), GREEN + ver + ENDC, \
|
||||
" "*(16-len(ver)), arch, " "*(11-len(arch)), "SBo"
|
||||
for upg, ver, arch in zip(pkg_for_upg, upg_ver, upg_arch):
|
||||
print " ", RED + upg + ENDC, " " * (34-len(upg)), GREEN + ver + ENDC, \
|
||||
" " * (16-len(ver)), arch, " " * (11-len(arch)), "SBo"
|
||||
msg_pkg = "package"
|
||||
if len(pkg_for_upg) > 1:
|
||||
msg_pkg = msg_pkg + "s"
|
||||
|
@ -102,7 +102,7 @@ def sbo_check():
|
|||
if not os.path.exists(build_path):
|
||||
os.mkdir(build_path)
|
||||
os.chdir(build_path)
|
||||
for name, version, arch in zip(pkg_name, sbo_ver, pkg_arch):
|
||||
for name, version, arch in zip(upg_name, upg_ver, upg_arch):
|
||||
prgnam = ("{0}-{1}".format(name, version))
|
||||
sbo_url = sbo_search_pkg(name)
|
||||
sbo_dwn = sbo_slackbuild_dwn(sbo_url)
|
||||
|
@ -122,7 +122,7 @@ def sbo_check():
|
|||
pkg_upgrade(binary)
|
||||
print("Completed!\n")
|
||||
else:
|
||||
print("\nAll SBo packages are up to date\n")
|
||||
print("\nTotal {0} SBo packages are up to date:\n".format(len(sbo_list)))
|
||||
else:
|
||||
sys.stdout.write("Done\n")
|
||||
print("\nNo SBo packages found\n")
|
||||
|
|
|
@ -25,10 +25,11 @@ import os
|
|||
|
||||
from url_read import url_read
|
||||
from __metadata__ import arch, lib_path
|
||||
from search import sbo_search_pkg
|
||||
|
||||
def sbo_source_dwn(name):
|
||||
'''
|
||||
Grep sources downloads links
|
||||
Grab sources downloads links
|
||||
'''
|
||||
if arch == "x86_64":
|
||||
for line in open(lib_path + "sbo_repo/SLACKBUILDS.TXT", "r"):
|
||||
|
@ -47,21 +48,35 @@ def sbo_source_dwn(name):
|
|||
return line[21:].strip()
|
||||
|
||||
def sbo_requires_pkg(sbo_url, name):
|
||||
'''
|
||||
Grab package requirements
|
||||
'''
|
||||
read_info = url_read(sbo_url + name + ".info")
|
||||
for line in read_info.splitlines():
|
||||
if line.startswith("REQUIRES=\""):
|
||||
return line[10:-1].strip().split()
|
||||
|
||||
def sbo_build_tag(sbo_url, name):
|
||||
# This feature is not yet used
|
||||
# because the program is doing heavy on search.
|
||||
# Looking for the best option to be able to use
|
||||
# the BUILD tag
|
||||
'''
|
||||
Grep package requirements
|
||||
Grab .SlackBuild BUILD tag
|
||||
'''
|
||||
read_info = url_read(sbo_url + name + ".info")
|
||||
read_info = url_read(sbo_url + name + ".SlackBuild")
|
||||
for line in read_info.splitlines():
|
||||
if line.startswith("REQUIRES=\""):
|
||||
return line[10:-1].strip().split()
|
||||
if line.startswith("BUILD=${BUILD:"):
|
||||
return line[15:-1].strip().split()
|
||||
|
||||
def sbo_version_pkg(name):
|
||||
'''
|
||||
Grep package verion
|
||||
Grab package verion
|
||||
'''
|
||||
for line in open(lib_path + "sbo_repo/SLACKBUILDS.TXT", "r"):
|
||||
if line.startswith("SLACKBUILD NAME: "):
|
||||
sbo_name = line[17:].strip()
|
||||
if line.startswith("SLACKBUILD VERSION: "):
|
||||
if sbo_name == name:
|
||||
sbo_url = sbo_search_pkg(name)
|
||||
return line[20:].strip()
|
||||
|
|
|
@ -52,7 +52,7 @@ def sbo_build(name):
|
|||
dependencies_list = sbo_dependencies_pkg(name)
|
||||
try:
|
||||
if dependencies_list is not None:
|
||||
pkg_sum = 0
|
||||
pkg_sum = 0
|
||||
arch = os.uname()[4]
|
||||
sbo_ver, pkg_arch = [], []
|
||||
requires, dependencies = [], []
|
||||
|
@ -166,7 +166,7 @@ def sbo_build(name):
|
|||
src_link = sbo_source_dwn(pkg).split()
|
||||
script = get_file(sbo_link, "/")
|
||||
print("\n{0}Start -->{1} {2}\n".format(colors.GREEN, colors.ENDC, pkg))
|
||||
subprocess.call("wget -c {0}".format(sbo_link), shell=True)
|
||||
subprocess.call("wget -N {0}".format(sbo_link), shell=True)
|
||||
sources = []
|
||||
for src in src_link:
|
||||
subprocess.call("wget -N {0}".format(src), shell=True)
|
||||
|
|
Loading…
Reference in a new issue