mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-18 10:26:29 +01:00
Update metadata import
This commit is contained in:
parent
a96057888f
commit
47dc13f593
11 changed files with 100 additions and 97 deletions
|
@ -23,13 +23,13 @@
|
||||||
|
|
||||||
|
|
||||||
from repolist import RepoList
|
from repolist import RepoList
|
||||||
from __metadata__ import MetaData as _m
|
from __metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
def header():
|
def header():
|
||||||
"""help header message"""
|
"""help header message"""
|
||||||
print("\nslpkg - version {0} | Slackware release: {1}\n".format(
|
print("\nslpkg - version {0} | Slackware release: {1}\n".format(
|
||||||
_m.__version__, _m.slack_rel))
|
_meta_.__version__, _meta_.slack_rel))
|
||||||
|
|
||||||
|
|
||||||
def options():
|
def options():
|
||||||
|
@ -140,7 +140,7 @@ def usage(repo):
|
||||||
[-u [...]] [-o [...]] [-r [...]] [-d [...]]
|
[-u [...]] [-o [...]] [-r [...]] [-d [...]]
|
||||||
"""
|
"""
|
||||||
error_repo = ""
|
error_repo = ""
|
||||||
if repo and repo not in _m.repositories:
|
if repo and repo not in _meta_.repositories:
|
||||||
all_repos = RepoList().all_repos
|
all_repos = RepoList().all_repos
|
||||||
del RepoList().all_repos
|
del RepoList().all_repos
|
||||||
if repo in all_repos:
|
if repo in all_repos:
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
from utils import Utils
|
from utils import Utils
|
||||||
from __metadata__ import MetaData as _m
|
from __metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
class BlackList(object):
|
class BlackList(object):
|
||||||
|
@ -55,8 +55,8 @@ class BlackList(object):
|
||||||
print("\nPackages in blacklist:\n")
|
print("\nPackages in blacklist:\n")
|
||||||
for black in self.packages():
|
for black in self.packages():
|
||||||
if black:
|
if black:
|
||||||
print("{0}{1}{2}".format(_m.color["GREEN"], black,
|
print("{0}{1}{2}".format(_meta_.color["GREEN"], black,
|
||||||
_m.color["ENDC"]))
|
_meta_.color["ENDC"]))
|
||||||
self.quit = True
|
self.quit = True
|
||||||
if self.quit:
|
if self.quit:
|
||||||
print("") # new line at exit
|
print("") # new line at exit
|
||||||
|
@ -71,8 +71,8 @@ class BlackList(object):
|
||||||
with open(self.blackfile, "a") as black_conf:
|
with open(self.blackfile, "a") as black_conf:
|
||||||
for pkg in pkgs:
|
for pkg in pkgs:
|
||||||
if pkg not in blacklist:
|
if pkg not in blacklist:
|
||||||
print("{0}{1}{2}".format(_m.color["GREEN"], pkg,
|
print("{0}{1}{2}".format(_meta_.color["GREEN"], pkg,
|
||||||
_m.color["ENDC"]))
|
_meta_.color["ENDC"]))
|
||||||
black_conf.write(pkg + "\n")
|
black_conf.write(pkg + "\n")
|
||||||
self.quit = True
|
self.quit = True
|
||||||
black_conf.close()
|
black_conf.close()
|
||||||
|
@ -89,8 +89,8 @@ class BlackList(object):
|
||||||
if line not in pkgs:
|
if line not in pkgs:
|
||||||
remove.write(line + "\n")
|
remove.write(line + "\n")
|
||||||
else:
|
else:
|
||||||
print("{0}{1}{2}".format(_m.color["RED"], line,
|
print("{0}{1}{2}".format(_meta_.color["RED"], line,
|
||||||
_m.color["ENDC"]))
|
_meta_.color["ENDC"]))
|
||||||
self.quit = True
|
self.quit = True
|
||||||
remove.close()
|
remove.close()
|
||||||
if self.quit:
|
if self.quit:
|
||||||
|
|
|
@ -26,20 +26,21 @@ import sys
|
||||||
|
|
||||||
from md5sum import md5
|
from md5sum import md5
|
||||||
from messages import Msg
|
from messages import Msg
|
||||||
from __metadata__ import MetaData as _m
|
from __metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
def check_md5(pkg_md5, src_file):
|
def check_md5(pkg_md5, src_file):
|
||||||
"""
|
"""
|
||||||
MD5 Checksum
|
MD5 Checksum
|
||||||
"""
|
"""
|
||||||
if _m.checkmd5 in ["on", "ON"]:
|
if _meta_.checkmd5 in ["on", "ON"]:
|
||||||
print("")
|
print("")
|
||||||
md5s = md5(src_file)
|
md5s = md5(src_file)
|
||||||
if pkg_md5 != md5s:
|
if pkg_md5 != md5s:
|
||||||
Msg().template(78)
|
Msg().template(78)
|
||||||
print("| MD5SUM check for {0} [ {1}FAILED{2} ]".format(
|
print("| MD5SUM check for {0} [ {1}FAILED{2} ]".format(
|
||||||
src_file.split("/")[-1], _m.color["RED"], _m.color["ENDC"]))
|
src_file.split("/")[-1], _meta_.color["RED"],
|
||||||
|
_meta_.color["ENDC"]))
|
||||||
Msg().template(78)
|
Msg().template(78)
|
||||||
print("| Expected: {0}".format(md5s))
|
print("| Expected: {0}".format(md5s))
|
||||||
print("| Found: {0}".format(pkg_md5))
|
print("| Found: {0}".format(pkg_md5))
|
||||||
|
@ -50,6 +51,7 @@ def check_md5(pkg_md5, src_file):
|
||||||
else:
|
else:
|
||||||
Msg().template(78)
|
Msg().template(78)
|
||||||
print("| MD5SUM check for {0} [ {1}PASSED{2} ]".format(
|
print("| MD5SUM check for {0} [ {1}PASSED{2} ]".format(
|
||||||
src_file.split("/")[-1], _m.color["GREEN"], _m.color["ENDC"]))
|
src_file.split("/")[-1], _meta_.color["GREEN"],
|
||||||
|
_meta_.color["ENDC"]))
|
||||||
Msg().template(78)
|
Msg().template(78)
|
||||||
print("") # new line after pass checksum
|
print("") # new line after pass checksum
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from utils import Utils
|
from utils import Utils
|
||||||
from __metadata__ import MetaData as _m
|
from __metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
class Config(object):
|
class Config(object):
|
||||||
|
@ -63,8 +63,8 @@ class Config(object):
|
||||||
if not line.startswith("#") and line.split("=")[0] in conf_args:
|
if not line.startswith("#") and line.split("=")[0] in conf_args:
|
||||||
print(line)
|
print(line)
|
||||||
else:
|
else:
|
||||||
print("{0}{1}{2}".format(_m.color["CYAN"], line,
|
print("{0}{1}{2}".format(_meta_.color["CYAN"], line,
|
||||||
_m.color["ENDC"]))
|
_meta_.color["ENDC"]))
|
||||||
print("") # new line at end
|
print("") # new line at end
|
||||||
|
|
||||||
def edit(self, editor):
|
def edit(self, editor):
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
from utils import Utils
|
from utils import Utils
|
||||||
from messages import Msg
|
from messages import Msg
|
||||||
from __metadata__ import MetaData as _m
|
from __metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
class PkgDesc(object):
|
class PkgDesc(object):
|
||||||
|
@ -36,18 +36,19 @@ class PkgDesc(object):
|
||||||
self.COLOR = ""
|
self.COLOR = ""
|
||||||
self.lib = ""
|
self.lib = ""
|
||||||
color_text = {
|
color_text = {
|
||||||
"red": _m.color["RED"],
|
"red": _meta_.color["RED"],
|
||||||
"green": _m.color["GREEN"],
|
"green": _meta_.color["GREEN"],
|
||||||
"yellow": _m.color["YELLOW"],
|
"yellow": _meta_.color["YELLOW"],
|
||||||
"cyan": _m.color["CYAN"],
|
"cyan": _meta_.color["CYAN"],
|
||||||
"grey": _m.color["GREY"],
|
"grey": _meta_.color["GREY"],
|
||||||
"": ""
|
"": ""
|
||||||
}
|
}
|
||||||
self.COLOR = color_text[self.paint]
|
self.COLOR = color_text[self.paint]
|
||||||
if self.repo in _m.repositories and self.repo != "sbo":
|
if self.repo in _meta_.repositories and self.repo != "sbo":
|
||||||
self.lib = _m.lib_path + "{0}_repo/PACKAGES.TXT".format(self.repo)
|
self.lib = _meta_.lib_path + "{0}_repo/PACKAGES.TXT".format(
|
||||||
|
self.repo)
|
||||||
else:
|
else:
|
||||||
self.lib = _m.lib_path + "{0}_repo/SLACKBUILDS.TXT".format(
|
self.lib = _meta_.lib_path + "{0}_repo/SLACKBUILDS.TXT".format(
|
||||||
self.repo)
|
self.repo)
|
||||||
|
|
||||||
def view(self):
|
def view(self):
|
||||||
|
@ -58,7 +59,7 @@ class PkgDesc(object):
|
||||||
for line in PACKAGES_TXT.splitlines():
|
for line in PACKAGES_TXT.splitlines():
|
||||||
if line.startswith(self.name + ":"):
|
if line.startswith(self.name + ":"):
|
||||||
print(self.COLOR + line[len(self.name) + 1:] +
|
print(self.COLOR + line[len(self.name) + 1:] +
|
||||||
_m.color["ENDC"])
|
_meta_.color["ENDC"])
|
||||||
count += 1
|
count += 1
|
||||||
if count == 11:
|
if count == 11:
|
||||||
break
|
break
|
||||||
|
@ -67,7 +68,7 @@ class PkgDesc(object):
|
||||||
if (line.startswith(
|
if (line.startswith(
|
||||||
"SLACKBUILD SHORT DESCRIPTION: " + self.name + " (")):
|
"SLACKBUILD SHORT DESCRIPTION: " + self.name + " (")):
|
||||||
count += 1
|
count += 1
|
||||||
print(self.COLOR + line[31:] + _m.color["ENDC"])
|
print(self.COLOR + line[31:] + _meta_.color["ENDC"])
|
||||||
if count == 0:
|
if count == 0:
|
||||||
Msg().pkg_not_found("", self.name, "No matching", "\n")
|
Msg().pkg_not_found("", self.name, "No matching", "\n")
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -27,7 +27,7 @@ import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from messages import Msg
|
from messages import Msg
|
||||||
from __metadata__ import MetaData as _m
|
from __metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
class Download(object):
|
class Download(object):
|
||||||
|
@ -35,7 +35,7 @@ class Download(object):
|
||||||
def __init__(self, path, url):
|
def __init__(self, path, url):
|
||||||
self.path = path
|
self.path = path
|
||||||
self.url = url
|
self.url = url
|
||||||
self.wget_options = _m.wget_options
|
self.wget_options = _meta_.wget_options
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
"""
|
"""
|
||||||
|
@ -45,7 +45,8 @@ class Download(object):
|
||||||
for dwn in self.url:
|
for dwn in self.url:
|
||||||
self.file_name = dwn.split("/")[-1]
|
self.file_name = dwn.split("/")[-1]
|
||||||
print("\n[{0}/{1}][ {2}Download{3} ] --> {4}\n".format(
|
print("\n[{0}/{1}][ {2}Download{3} ] --> {4}\n".format(
|
||||||
dwn_count, len(self.url), _m.color["GREEN"], _m.color["ENDC"],
|
dwn_count, len(self.url), _meta_.color["GREEN"],
|
||||||
|
_meta_.color["ENDC"],
|
||||||
self.file_name))
|
self.file_name))
|
||||||
try:
|
try:
|
||||||
subprocess.call("wget {0} --directory-prefix={1} {2}".format(
|
subprocess.call("wget {0} --directory-prefix={1} {2}".format(
|
||||||
|
@ -61,7 +62,7 @@ class Download(object):
|
||||||
print("")
|
print("")
|
||||||
Msg().template(78)
|
Msg().template(78)
|
||||||
print("| Download '{0}' file {1}[ FAILED ]{2}".format(
|
print("| Download '{0}' file {1}[ FAILED ]{2}".format(
|
||||||
self.file_name, _m.color["RED"], _m.color["ENDC"]))
|
self.file_name, _meta_.color["RED"], _meta_.color["ENDC"]))
|
||||||
Msg().template(78)
|
Msg().template(78)
|
||||||
print("")
|
print("")
|
||||||
if not Msg().answer() in ["y", "Y"]:
|
if not Msg().answer() in ["y", "Y"]:
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
from slack.mirrors import mirrors
|
from slack.mirrors import mirrors
|
||||||
|
|
||||||
from url_read import URL
|
from url_read import URL
|
||||||
from __metadata__ import MetaData as _m
|
from __metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
def pkg_checksum(binary, repo):
|
def pkg_checksum(binary, repo):
|
||||||
|
@ -33,14 +33,14 @@ def pkg_checksum(binary, repo):
|
||||||
Return checksum from CHECKSUMS.md5 file by repository
|
Return checksum from CHECKSUMS.md5 file by repository
|
||||||
"""
|
"""
|
||||||
md5, end = "None", "/"
|
md5, end = "None", "/"
|
||||||
if repo == "slack_patches" and _m.slack_rel == "stable":
|
if repo == "slack_patches" and _meta_.slack_rel == "stable":
|
||||||
CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "patches/")).reading()
|
CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "patches/")).reading()
|
||||||
elif repo == "slack_patches" and _m.slack_rel == "current":
|
elif repo == "slack_patches" and _meta_.slack_rel == "current":
|
||||||
CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "")).reading()
|
CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "")).reading()
|
||||||
elif repo == "slpkg":
|
elif repo == "slpkg":
|
||||||
CHECKSUMS_md5 = URL(_m.CHECKSUMS_link).reading()
|
CHECKSUMS_md5 = URL(_meta_.CHECKSUMS_link).reading()
|
||||||
else:
|
else:
|
||||||
lib = "{0}{1}_repo/CHECKSUMS.md5".format(_m.lib_path, repo)
|
lib = "{0}{1}_repo/CHECKSUMS.md5".format(_meta_.lib_path, repo)
|
||||||
f = open(lib, "r")
|
f = open(lib, "r")
|
||||||
CHECKSUMS_md5 = f.read()
|
CHECKSUMS_md5 = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
|
|
|
@ -29,7 +29,7 @@ from url_read import URL
|
||||||
from toolbar import status
|
from toolbar import status
|
||||||
from repositories import Repo
|
from repositories import Repo
|
||||||
from file_size import FileSize
|
from file_size import FileSize
|
||||||
from __metadata__ import MetaData as _m
|
from __metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
from slack.mirrors import mirrors
|
from slack.mirrors import mirrors
|
||||||
from slack.slack_version import slack_ver
|
from slack.slack_version import slack_ver
|
||||||
|
@ -38,13 +38,13 @@ from slack.slack_version import slack_ver
|
||||||
class Initialization(object):
|
class Initialization(object):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.conf_path = _m.conf_path
|
self.conf_path = _meta_.conf_path
|
||||||
self.log_path = _m.log_path
|
self.log_path = _meta_.log_path
|
||||||
self.lib_path = _m.lib_path
|
self.lib_path = _meta_.lib_path
|
||||||
self.tmp_path = _m.tmp_path
|
self.tmp_path = _meta_.tmp_path
|
||||||
self.build_path = _m.build_path
|
self.build_path = _meta_.build_path
|
||||||
self.slpkg_tmp_packages = _m.slpkg_tmp_packages
|
self.slpkg_tmp_packages = _meta_.slpkg_tmp_packages
|
||||||
self.slpkg_tmp_patches = _m.slpkg_tmp_patches
|
self.slpkg_tmp_patches = _meta_.slpkg_tmp_patches
|
||||||
if not os.path.exists(self.conf_path):
|
if not os.path.exists(self.conf_path):
|
||||||
os.mkdir(self.conf_path)
|
os.mkdir(self.conf_path)
|
||||||
if not os.path.exists(self.log_path):
|
if not os.path.exists(self.log_path):
|
||||||
|
@ -384,12 +384,12 @@ class Initialization(object):
|
||||||
elif arch == "arm":
|
elif arch == "arm":
|
||||||
ar = "arm"
|
ar = "arm"
|
||||||
packages_txt = "{0}slacke{1}/slackware{2}-{3}/{4}".format(
|
packages_txt = "{0}slacke{1}/slackware{2}-{3}/{4}".format(
|
||||||
repo, _m.slacke_sub_repo[1:-1], ar, slack_ver(), lib_file)
|
repo, _meta_.slacke_sub_repo[1:-1], ar, slack_ver(), lib_file)
|
||||||
# filelist_txt = ""
|
# filelist_txt = ""
|
||||||
checksums_md5 = "{0}slacke{1}/slackware{2}-{3}/{4}".format(
|
checksums_md5 = "{0}slacke{1}/slackware{2}-{3}/{4}".format(
|
||||||
repo, _m.slacke_sub_repo[1:-1], ar, slack_ver(), md5_file)
|
repo, _meta_.slacke_sub_repo[1:-1], ar, slack_ver(), md5_file)
|
||||||
changelog_txt = "{0}slacke{1}/slackware{2}-{3}/{4}".format(
|
changelog_txt = "{0}slacke{1}/slackware{2}-{3}/{4}".format(
|
||||||
repo, _m.slacke_sub_repo[1:-1], ar, slack_ver(), log_file)
|
repo, _meta_.slacke_sub_repo[1:-1], ar, slack_ver(), log_file)
|
||||||
self.write(lib, lib_file, packages_txt)
|
self.write(lib, lib_file, packages_txt)
|
||||||
self.write(lib, md5_file, checksums_md5)
|
self.write(lib, md5_file, checksums_md5)
|
||||||
self.write(log, log_file, changelog_txt)
|
self.write(log, log_file, changelog_txt)
|
||||||
|
@ -555,7 +555,7 @@ class Initialization(object):
|
||||||
Remove all package lists with changelog and checksums files
|
Remove all package lists with changelog and checksums files
|
||||||
and create lists again
|
and create lists again
|
||||||
"""
|
"""
|
||||||
for repo in _m.repositories:
|
for repo in _meta_.repositories:
|
||||||
changelogs = "{0}{1}{2}".format(self.log_path, repo,
|
changelogs = "{0}{1}{2}".format(self.log_path, repo,
|
||||||
"/ChangeLog.txt")
|
"/ChangeLog.txt")
|
||||||
if os.path.isfile(changelogs):
|
if os.path.isfile(changelogs):
|
||||||
|
@ -578,16 +578,16 @@ class Update(object):
|
||||||
Update all repositories lists
|
Update all repositories lists
|
||||||
"""
|
"""
|
||||||
print("\nCheck and update repositories:\n")
|
print("\nCheck and update repositories:\n")
|
||||||
for repo in _m.repositories:
|
for repo in _meta_.repositories:
|
||||||
sys.stdout.write("{0}Update repository {1} ...{2}".format(
|
sys.stdout.write("{0}Update repository {1} ...{2}".format(
|
||||||
_m.color["GREY"], repo, _m.color["ENDC"]))
|
_meta_.color["GREY"], repo, _meta_.color["ENDC"]))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
if repo in _m.default_repositories:
|
if repo in _meta_.default_repositories:
|
||||||
exec("{0}.{1}()".format(self._init, repo))
|
exec("{0}.{1}()".format(self._init, repo))
|
||||||
else:
|
else:
|
||||||
Initialization().custom(repo)
|
Initialization().custom(repo)
|
||||||
sys.stdout.write("{0}Done{1}\n".format(_m.color["GREY"],
|
sys.stdout.write("{0}Done{1}\n".format(_meta_.color["GREY"],
|
||||||
_m.color["ENDC"]))
|
_meta_.color["ENDC"]))
|
||||||
print("") # new line at end
|
print("") # new line at end
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
@ -598,11 +598,11 @@ def check_exists_repositories():
|
||||||
"""
|
"""
|
||||||
update = False
|
update = False
|
||||||
pkg_list = "PACKAGES.TXT"
|
pkg_list = "PACKAGES.TXT"
|
||||||
for repo in _m.repositories:
|
for repo in _meta_.repositories:
|
||||||
pkg_list = "PACKAGES.TXT"
|
pkg_list = "PACKAGES.TXT"
|
||||||
if repo == "sbo":
|
if repo == "sbo":
|
||||||
pkg_list = "SLACKBUILDS.TXT"
|
pkg_list = "SLACKBUILDS.TXT"
|
||||||
if not os.path.isfile("{0}{1}{2}".format(_m.lib_path, repo,
|
if not os.path.isfile("{0}{1}{2}".format(_meta_.lib_path, repo,
|
||||||
"_repo/{0}".format(pkg_list))):
|
"_repo/{0}".format(pkg_list))):
|
||||||
update = True
|
update = True
|
||||||
if update:
|
if update:
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from slpkg.__metadata__ import MetaData as _m
|
from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
from slpkg.pkg.find import find_package
|
from slpkg.pkg.find import find_package
|
||||||
|
|
||||||
|
@ -35,8 +35,8 @@ def write_deps(deps_dict):
|
||||||
into directory `/var/log/slpkg/dep/`
|
into directory `/var/log/slpkg/dep/`
|
||||||
"""
|
"""
|
||||||
for name, dependencies in deps_dict.iteritems():
|
for name, dependencies in deps_dict.iteritems():
|
||||||
if find_package(name + "-", _m.pkg_path):
|
if find_package(name + "-", _meta_.pkg_path):
|
||||||
dep_path = _m.log_path + "dep/"
|
dep_path = _meta_.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):
|
||||||
|
|
|
@ -44,7 +44,7 @@ from init import (
|
||||||
Initialization,
|
Initialization,
|
||||||
check_exists_repositories
|
check_exists_repositories
|
||||||
)
|
)
|
||||||
from __metadata__ import MetaData as _m
|
from __metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
from pkg.build import BuildPackage
|
from pkg.build import BuildPackage
|
||||||
from pkg.manager import PackageManager
|
from pkg.manager import PackageManager
|
||||||
|
@ -82,7 +82,7 @@ class ArgParse(object):
|
||||||
elif (len(self.args) >= 3 and
|
elif (len(self.args) >= 3 and
|
||||||
self.args[0] in ["-s", "--sync", "-t", "--tracking", "-p",
|
self.args[0] in ["-s", "--sync", "-t", "--tracking", "-p",
|
||||||
"--print", "-F", "--FIND"] and
|
"--print", "-F", "--FIND"] and
|
||||||
self.args[1] in _m.repositories and
|
self.args[1] in _meta_.repositories and
|
||||||
self.args[2].endswith(".pkg")):
|
self.args[2].endswith(".pkg")):
|
||||||
self.packages = Utils().read_file_pkg(self.args[2])
|
self.packages = Utils().read_file_pkg(self.args[2])
|
||||||
elif (len(self.args) == 3 and self.args[0] in ["-q", "--queue",
|
elif (len(self.args) == 3 and self.args[0] in ["-q", "--queue",
|
||||||
|
@ -165,7 +165,7 @@ class ArgParse(object):
|
||||||
""" auto built tool """
|
""" auto built tool """
|
||||||
options = ["-a", "--autobuild"]
|
options = ["-a", "--autobuild"]
|
||||||
if len(self.args) == 3 and self.args[0] in options:
|
if len(self.args) == 3 and self.args[0] in options:
|
||||||
BuildPackage(self.args[1], self.args[2:], _m.path).build()
|
BuildPackage(self.args[1], self.args[2:], _meta_.path).build()
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ class ArgParse(object):
|
||||||
options = ["-l", "--list"]
|
options = ["-l", "--list"]
|
||||||
flag = ["--index", "--installed"]
|
flag = ["--index", "--installed"]
|
||||||
if (len(self.args) == 3 and self.args[0] in options and
|
if (len(self.args) == 3 and self.args[0] in options and
|
||||||
self.args[1] in _m.repositories):
|
self.args[1] in _meta_.repositories):
|
||||||
if self.args[2] == flag[0]:
|
if self.args[2] == flag[0]:
|
||||||
PackageManager(binary=None).package_list(self.args[1],
|
PackageManager(binary=None).package_list(self.args[1],
|
||||||
INDEX=True,
|
INDEX=True,
|
||||||
|
@ -186,11 +186,11 @@ class ArgParse(object):
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
elif (len(self.args) == 2 and self.args[0] in options and
|
elif (len(self.args) == 2 and self.args[0] in options and
|
||||||
self.args[1] in _m.repositories):
|
self.args[1] in _meta_.repositories):
|
||||||
PackageManager(None).package_list(self.args[1], INDEX=False,
|
PackageManager(None).package_list(self.args[1], INDEX=False,
|
||||||
installed=False)
|
installed=False)
|
||||||
elif (len(self.args) > 1 and self.args[0] in options and
|
elif (len(self.args) > 1 and self.args[0] in options and
|
||||||
self.args[1] not in _m.repositories):
|
self.args[1] not in _meta_.repositories):
|
||||||
usage(self.args[1])
|
usage(self.args[1])
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
@ -211,12 +211,12 @@ class ArgParse(object):
|
||||||
self.args.pop(3)
|
self.args.pop(3)
|
||||||
if (len(self.args) == 3 and self.args[0] in options and
|
if (len(self.args) == 3 and self.args[0] in options and
|
||||||
self.args[2] == flag[0]):
|
self.args[2] == flag[0]):
|
||||||
if (self.args[1] in _m.repositories and
|
if (self.args[1] in _meta_.repositories and
|
||||||
self.args[1] not in ["slack", "sbo"]):
|
self.args[1] not in ["slack", "sbo"]):
|
||||||
BinaryInstall(pkg_upgrade(self.args[1], skip),
|
BinaryInstall(pkg_upgrade(self.args[1], skip),
|
||||||
self.args[1], resolve).start(if_upgrade=True)
|
self.args[1], resolve).start(if_upgrade=True)
|
||||||
elif self.args[1] == "slack":
|
elif self.args[1] == "slack":
|
||||||
if _m.only_installed in ["on", "ON"]:
|
if _meta_.only_installed in ["on", "ON"]:
|
||||||
BinaryInstall(pkg_upgrade("slack", skip),
|
BinaryInstall(pkg_upgrade("slack", skip),
|
||||||
"slack", resolve).start(if_upgrade=True)
|
"slack", resolve).start(if_upgrade=True)
|
||||||
else:
|
else:
|
||||||
|
@ -236,7 +236,8 @@ class ArgParse(object):
|
||||||
if self.args[-1] == flag[0]:
|
if self.args[-1] == flag[0]:
|
||||||
resolve = False
|
resolve = False
|
||||||
if len(self.args) >= 3 and self.args[0] in options:
|
if len(self.args) >= 3 and self.args[0] in options:
|
||||||
if self.args[1] in _m.repositories and self.args[1] not in ["sbo"]:
|
if (self.args[1] in _meta_.repositories and
|
||||||
|
self.args[1] not in ["sbo"]):
|
||||||
BinaryInstall(self.packages, self.args[1], resolve).start(
|
BinaryInstall(self.packages, self.args[1], resolve).start(
|
||||||
if_upgrade=False)
|
if_upgrade=False)
|
||||||
elif self.args[1] == "sbo":
|
elif self.args[1] == "sbo":
|
||||||
|
@ -256,10 +257,10 @@ class ArgParse(object):
|
||||||
if self.args[2].endswith(".pkg"):
|
if self.args[2].endswith(".pkg"):
|
||||||
packages = self.packages[0]
|
packages = self.packages[0]
|
||||||
if (len(self.args) == 3 and self.args[0] in options and
|
if (len(self.args) == 3 and self.args[0] in options and
|
||||||
self.args[1] in _m.repositories):
|
self.args[1] in _meta_.repositories):
|
||||||
track_dep(packages, self.args[1])
|
track_dep(packages, self.args[1])
|
||||||
elif (len(self.args) > 1 and self.args[0] in options and
|
elif (len(self.args) > 1 and self.args[0] in options and
|
||||||
self.args[1] not in _m.repositories):
|
self.args[1] not in _meta_.repositories):
|
||||||
usage(self.args[1])
|
usage(self.args[1])
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
@ -271,7 +272,7 @@ class ArgParse(object):
|
||||||
if len(self.packages) > 1:
|
if len(self.packages) > 1:
|
||||||
packages = self.packages[0]
|
packages = self.packages[0]
|
||||||
if (len(self.args) == 2 and self.args[0] in options and
|
if (len(self.args) == 2 and self.args[0] in options and
|
||||||
"sbo" in _m.repositories):
|
"sbo" in _meta_.repositories):
|
||||||
SBoNetwork(packages).view()
|
SBoNetwork(packages).view()
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
@ -371,17 +372,17 @@ class ArgParse(object):
|
||||||
if len(self.packages) > 1:
|
if len(self.packages) > 1:
|
||||||
packages = self.packages[0]
|
packages = self.packages[0]
|
||||||
if (len(self.args) == 3 and self.args[0] in options and
|
if (len(self.args) == 3 and self.args[0] in options and
|
||||||
self.args[1] in _m.repositories):
|
self.args[1] in _meta_.repositories):
|
||||||
PkgDesc(packages, self.args[1], "").view()
|
PkgDesc(packages, self.args[1], "").view()
|
||||||
elif (len(self.args) == 4 and self.args[0] in options and
|
elif (len(self.args) == 4 and self.args[0] in options and
|
||||||
self.args[3].startswith(flag[0])):
|
self.args[3].startswith(flag[0])):
|
||||||
tag = self.args[3][len(flag[0]):]
|
tag = self.args[3][len(flag[0]):]
|
||||||
if self.args[1] in _m.repositories and tag in colors:
|
if self.args[1] in _meta_.repositories and tag in colors:
|
||||||
PkgDesc(packages, self.args[1], tag).view()
|
PkgDesc(packages, self.args[1], tag).view()
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
elif (len(self.args) > 1 and self.args[0] in options and
|
elif (len(self.args) > 1 and self.args[0] in options and
|
||||||
self.args[1] not in _m.repositories):
|
self.args[1] not in _meta_.repositories):
|
||||||
usage(self.args[1])
|
usage(self.args[1])
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
@ -405,16 +406,15 @@ class ArgParse(object):
|
||||||
def congiguration(self):
|
def congiguration(self):
|
||||||
""" manage slpkg configuration file """
|
""" manage slpkg configuration file """
|
||||||
options = ["-g", "--config"]
|
options = ["-g", "--config"]
|
||||||
command = ["print", "edit"]
|
command = ["print", "edit="]
|
||||||
if (len(self.args) == 2 and self.args[0] in options and
|
if (len(self.args) == 2 and self.args[0] in options and
|
||||||
self.args[1].startswith(command[0])):
|
self.args[1].startswith(command[1])):
|
||||||
editor = self.args[1][len(command[1]):]
|
editor = self.args[1][len(command[1]):]
|
||||||
if self.args[1] == command[0]:
|
print editor
|
||||||
Config().view()
|
Config().edit(editor)
|
||||||
elif editor:
|
elif (len(self.args) == 2 and self.args[0] in options and
|
||||||
Config().edit(editor)
|
self.args[1] == (command[0])):
|
||||||
else:
|
Config().view()
|
||||||
usage("")
|
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from __metadata__ import MetaData as _m
|
from __metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
from slpkg.pkg.find import find_package
|
from slpkg.pkg.find import find_package
|
||||||
|
|
||||||
|
@ -62,13 +62,12 @@ class Msg(object):
|
||||||
Print error message if build failed
|
Print error message if build failed
|
||||||
"""
|
"""
|
||||||
self.template(78)
|
self.template(78)
|
||||||
print("| Build package {0} [ {1}FAILED{2} ]".format(prgnam,
|
print("| Build package {0} [ {1}FAILED{2} ]".format(
|
||||||
_m.color["RED"],
|
prgnam, _meta_.color["RED"], _meta_.color["ENDC"]))
|
||||||
_m.color["ENDC"]))
|
|
||||||
self.template(78)
|
self.template(78)
|
||||||
print("| See log file in '{0}/var/log/slpkg/sbo/build_logs{1}' "
|
print("| See log file in '{0}/var/log/slpkg/sbo/build_logs{1}' "
|
||||||
"directory or read README".format(_m.color["CYAN"],
|
"directory or read README".format(_meta_.color["CYAN"],
|
||||||
_m.color["ENDC"]))
|
_meta_.color["ENDC"]))
|
||||||
print("| file: {0}{1}".format(sbo_url, "README"))
|
print("| file: {0}{1}".format(sbo_url, "README"))
|
||||||
self.template(78)
|
self.template(78)
|
||||||
print # new line at end
|
print # new line at end
|
||||||
|
@ -83,8 +82,8 @@ class Msg(object):
|
||||||
"""
|
"""
|
||||||
Message checking
|
Message checking
|
||||||
"""
|
"""
|
||||||
sys.stdout.write("{0}Checking ...{1}".format(_m.color["GREY"],
|
sys.stdout.write("{0}Checking ...{1}".format(_meta_.color["GREY"],
|
||||||
_m.color["ENDC"]))
|
_meta_.color["ENDC"]))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
def reading(self):
|
def reading(self):
|
||||||
|
@ -92,7 +91,7 @@ class Msg(object):
|
||||||
Message reading
|
Message reading
|
||||||
"""
|
"""
|
||||||
sys.stdout.write("{0}Reading package lists ...{1}".format(
|
sys.stdout.write("{0}Reading package lists ...{1}".format(
|
||||||
_m.color["GREY"], _m.color["ENDC"]))
|
_meta_.color["GREY"], _meta_.color["ENDC"]))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
def resolving(self):
|
def resolving(self):
|
||||||
|
@ -100,15 +99,15 @@ class Msg(object):
|
||||||
Message resolving
|
Message resolving
|
||||||
"""
|
"""
|
||||||
sys.stdout.write("{0}Resolving dependencies ...{1}".format(
|
sys.stdout.write("{0}Resolving dependencies ...{1}".format(
|
||||||
_m.color["GREY"], _m.color["ENDC"]))
|
_meta_.color["GREY"], _meta_.color["ENDC"]))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
def done(self):
|
def done(self):
|
||||||
"""
|
"""
|
||||||
Message done
|
Message done
|
||||||
"""
|
"""
|
||||||
sys.stdout.write("{0}Done{1}\n".format(_m.color["GREY"],
|
sys.stdout.write("{0}Done{1}\n".format(_meta_.color["GREY"],
|
||||||
_m.color["ENDC"]))
|
_meta_.color["ENDC"]))
|
||||||
|
|
||||||
def pkg(self, count):
|
def pkg(self, count):
|
||||||
"""
|
"""
|
||||||
|
@ -141,8 +140,8 @@ class Msg(object):
|
||||||
"""
|
"""
|
||||||
Message answer
|
Message answer
|
||||||
"""
|
"""
|
||||||
if _m.default_answer == "y":
|
if _meta_.default_answer == "y":
|
||||||
answer = _m.default_answer
|
answer = _meta_.default_answer
|
||||||
else:
|
else:
|
||||||
answer = raw_input("Would you like to continue [Y/n]? ")
|
answer = raw_input("Would you like to continue [Y/n]? ")
|
||||||
return answer
|
return answer
|
||||||
|
@ -159,7 +158,7 @@ class Msg(object):
|
||||||
self.template(78)
|
self.template(78)
|
||||||
for installed in (install + upgrade):
|
for installed in (install + upgrade):
|
||||||
name = "-".join(installed.split("-")[:-1])
|
name = "-".join(installed.split("-")[:-1])
|
||||||
if find_package(installed, _m.pkg_path):
|
if find_package(installed, _meta_.pkg_path):
|
||||||
if installed in upgrade:
|
if installed in upgrade:
|
||||||
print("| Package {0} upgraded successfully".format(name))
|
print("| Package {0} upgraded successfully".format(name))
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue