code stringlengths 52 7.75k | docs stringlengths 1 5.85k |
|---|---|
def add(self, repo, url):
repo_name = []
if not url.endswith("/"):
url = url + "/"
for line in self.custom_repositories_list.splitlines():
line = line.lstrip()
if line and not line.startswith("#"):
repo_name.append(line.split()[0])
... | Write custom repository name and url in a file |
def remove(self, repo):
rem_repo = False
with open(self.custom_repo_file, "w") as repos:
for line in self.custom_repositories_list.splitlines():
repo_name = line.split()[0]
if repo_name != repo:
repos.write(line + "\n")
... | Remove custom repository |
def custom_repository(self):
custom_dict_repo = {}
for line in self.custom_repositories_list.splitlines():
line = line.lstrip()
if not line.startswith("#"):
custom_dict_repo[line.split()[0]] = line.split()[1]
return custom_dict_repo | Return dictionary with repo name and url (used external) |
def default_repository(self):
default_dict_repo = {}
for line in self.default_repositories_list.splitlines():
line = line.lstrip()
if not line.startswith("#"):
if line.split()[0] in self.DEFAULT_REPOS_NAMES:
default_dict_repo[line.spli... | Return dictionary with default repo name and url |
def slack(self):
default = "http://mirrors.slackware.com/slackware/"
if self.meta.arch.startswith("arm"):
default = "http://ftp.arm.slackware.com/slackwarearm/"
if os.path.isfile("/etc/slpkg/slackware-mirrors"):
mirrors = Utils().read_file(
self.m... | Official slackware repository |
def check_md5(pkg_md5, src_file):
if _meta_.checkmd5 in ["on", "ON"]:
print("")
md5s = md5(src_file)
if pkg_md5 != md5s:
Msg().template(78)
print("| MD5SUM check for {0} [ {1}FAILED{2} ]".format(
src_file.split("/")[-1], _meta_.color["RED"],
... | MD5 Checksum |
def view(self):
if self.sbo_url and self.name not in self.blacklist:
self.prgnam = ("{0}-{1}".format(self.name, self.sbo_version))
self.view_sbo()
while True:
self.read_choice()
choice = {
"r": self.choice_README,
... | View SlackBuild package, read or install them
from slackbuilds.org |
def case_insensitive(self):
if "--case-ins" in self.flag:
data_dict = Utils().case_sensitive(self.data)
for key, value in data_dict.iteritems():
if key == self.name.lower():
self.name = value | Matching packages distinguish between uppercase and
lowercase |
def read_choice(self):
commands = {
"r": "README",
"R": "README",
"s": "{0}.SlackBuild".format(self.name),
"S": "{0}.SlackBuild".format(self.name),
"f": "{0}.info".format(self.name),
"F": "{0}.info".format(self.name),
"... | Return choice |
def choice_README(self):
README = ReadSBo(self.sbo_url).readme("README")
fill = self.fill_pager(README)
self.pager(README + fill) | View README file |
def choice_SlackBuild(self):
SlackBuild = ReadSBo(self.sbo_url).slackbuild(self.name, ".SlackBuild")
fill = self.fill_pager(SlackBuild)
self.pager(SlackBuild + fill) | View .SlackBuild file |
def choice_info(self):
info = ReadSBo(self.sbo_url).info(self.name, ".info")
fill = self.fill_pager(info)
self.pager(info + fill) | View .info file |
def choice_doinst(self):
if "doinst.sh" in self.sbo_files.split():
doinst_sh = ReadSBo(self.sbo_url).doinst("doinst.sh")
fill = self.fill_pager(doinst_sh)
self.pager(doinst_sh + fill) | View doinst.sh file |
def choice_download(self):
Download(path="", url=self.dwn_srcs, repo="sbo").start()
raise SystemExit() | Download script.tar.gz and sources |
def choice_install(self):
pkg_security([self.name])
if not find_package(self.prgnam, self.meta.pkg_path):
self.build()
self.install()
delete(self.build_folder)
raise SystemExit()
else:
self.msg.template(78)
self.msg... | Download, build and install package |
def with_checklist(self):
data = []
if self.name == "ALL":
data = self.data
else:
for name in self.data:
if self.name in name:
data.append(name)
if data:
text = "Press 'spacebar' to choose SlackBuild for vie... | Using dialog and checklist option |
def fill_pager(self, page):
tty_size = os.popen("stty size", "r").read().split()
rows = int(tty_size[0]) - 1
lines = sum(1 for line in page.splitlines())
diff = rows - lines
fill = "\n" * diff
if diff > 0:
return fill
else:
return ... | Fix pager spaces |
def error_uns(self):
self.FAULT = ""
UNST = ["UNSUPPORTED", "UNTESTED"]
if "".join(self.source_dwn) in UNST:
self.FAULT = "".join(self.source_dwn) | Check if package supported by arch
before proceed to install |
def build(self):
pkg_security([self.name])
self.error_uns()
if self.FAULT:
print("")
self.msg.template(78)
print("| Package {0} {1} {2} {3}".format(self.prgnam, self.red,
self.FAULT, self.endc))
... | Only build and create Slackware package |
def install(self):
binary = slack_package(self.prgnam)
print("[ {0}Installing{1} ] --> {2}".format(self.green, self.endc,
self.name))
PackageManager(binary).upgrade(flag="--install-new") | Install SBo package found in /tmp directory. |
def packages(self):
queue_list = []
for read in self.queued.splitlines():
read = read.lstrip()
if not read.startswith("#"):
queue_list.append(read.replace("\n", ""))
return queue_list | Return queue list from /var/lib/queue/queue_list
file. |
def listed(self):
print("\nPackages in the queue:\n")
for pkg in self.packages():
if pkg:
print("{0}{1}{2}".format(self.meta.color["GREEN"], pkg,
self.meta.color["ENDC"]))
self.quit = True
if self.quit:... | Print packages from queue |
def add(self, pkgs):
queue_list = self.packages()
pkgs = list(OrderedDict.fromkeys(pkgs))
print("\nAdd packages in the queue:\n")
with open(self.queue_list, "a") as queue:
for pkg in pkgs:
find = sbo_search_pkg(pkg)
if pkg not in queue... | Add packages in queue if not exist |
def remove(self, pkgs):
print("\nRemove packages from the queue:\n")
with open(self.queue_list, "w") as queue:
for line in self.queued.splitlines():
if line not in pkgs:
queue.write(line + "\n")
else:
print("{0}... | Remove packages from queue |
def build(self):
packages = self.packages()
if packages:
for pkg in packages:
if not os.path.exists(self.meta.build_path):
os.mkdir(self.meta.build_path)
if not os.path.exists(self._SOURCES):
os.mkdir(self._SOUR... | Build packages from queue |
def install(self):
packages = self.packages()
if packages:
print("") # new line at start
for pkg in packages:
ver = SBoGrep(pkg).version()
prgnam = "{0}-{1}".format(pkg, ver)
if find_package(prgnam, self.meta.output):
... | Install packages from queue |
def pkg_upgrade(repo, skip, flag):
Msg().checking()
PACKAGES_TXT = RepoInit(repo).fetch()[0]
pkgs_for_upgrade = []
# name = data[0]
# location = data[1]
# size = data[2]
# unsize = data[3]
data = repo_data(PACKAGES_TXT, repo, flag="")
for pkg in installed():
status(0.000... | Checking packages for upgrade |
def split_package(package):
name = ver = arch = build = []
split = package.split("-")
if len(split) > 2:
build = split[-1]
build_a, build_b = "", ""
build_a = build[:1]
if build[1:2].isdigit():
build_b = build[1:2]
build = build_a + build_b
ar... | Split package in name, version
arch and build tag. |
def remove_repositories(repositories, default_repositories):
repos = []
for repo in repositories:
if repo in default_repositories:
repos.append(repo)
return repos | Remove no default repositories |
def update_repositories(repositories, conf_path):
repo_file = "{0}custom-repositories".format(conf_path)
if os.path.isfile(repo_file):
f = open(repo_file, "r")
repositories_list = f.read()
f.close()
for line in repositories_list.splitlines():
line = line.lstrip()... | Upadate with user custom repositories |
def grab_sub_repo(repositories, repos):
for i, repo in enumerate(repositories):
if repos in repo:
sub = repositories[i].replace(repos, "")
repositories[i] = repos
return sub
return "" | Grab SUB_REPOSITORY |
def names(self):
pkg_names = []
for line in self.SLACKBUILDS_TXT.splitlines():
if line.startswith(self.line_name):
pkg_names.append(line[17:].strip())
return pkg_names | Grab all packages name |
def source(self):
source, source64, = "", ""
for line in self.SLACKBUILDS_TXT.splitlines():
if line.startswith(self.line_name):
sbo_name = line[17:].strip()
if line.startswith(self.line_down):
if sbo_name == self.name and line[21:].strip()... | Grab sources downloads links |
def _select_source_arch(self, source, source64):
src = ""
if self.meta.arch == "x86_64":
if source64:
src = source64
else:
src = source
if self.meta.skip_unst in self.answer and source64 in self.unst:
src = sour... | Return sources by arch |
def requires(self):
for line in self.SLACKBUILDS_TXT.splitlines():
if line.startswith(self.line_name):
sbo_name = line[17:].strip()
if line.startswith(self.line_req):
if sbo_name == self.name:
return line[21:].strip().split() | Grab package requirements |
def version(self):
for line in self.SLACKBUILDS_TXT.splitlines():
if line.startswith(self.line_name):
sbo_name = line[17:].strip()
if line.startswith(self.line_ver):
if sbo_name == self.name:
return line[20:].strip() | Grab package version |
def checksum(self):
md5sum, md5sum64, = [], []
for line in self.SLACKBUILDS_TXT.splitlines():
if line.startswith(self.line_name):
sbo_name = line[17:].strip()
if line.startswith(self.line_md5_64):
if sbo_name == self.name and line[26:].str... | Grab checksum string |
def _select_md5sum_arch(self, md5sum, md5sum64):
if md5sum and md5sum64:
if self.meta.arch == "x86_64":
return md5sum64
else:
return md5sum
if md5sum:
return md5sum
else:
return md5sum64 | Return checksums by arch |
def description(self):
for line in self.SLACKBUILDS_TXT.splitlines():
if line.startswith(self.line_name):
sbo_name = line[17:].strip()
if line.startswith(self.line_des):
if sbo_name == self.name:
return line[31:].strip() | Grab package verion |
def files(self):
for line in self.SLACKBUILDS_TXT.splitlines():
if line.startswith(self.line_name):
sbo_name = line[17:].strip()
if line.startswith(self.line_files):
if sbo_name == self.name:
return line[18:].strip() | Grab files |
def check_exists_repositories(repo):
pkg_list = "PACKAGES.TXT"
if repo == "sbo":
pkg_list = "SLACKBUILDS.TXT"
if check_for_local_repos(repo) is True:
pkg_list = "PACKAGES.TXT"
return ""
if not os.path.isfile("{0}{1}{2}".format(
_meta_.lib_path, repo, "_repo/{0}".... | Checking if repositories exists by PACKAGES.TXT file |
def check_for_local_repos(repo):
repos_dict = Repo().default_repository()
if repo in repos_dict:
repo_url = repos_dict[repo]
if repo_url.startswith("file:///"):
return True | Check if repository is local |
def conrad(self):
repo = self.def_repos_dict["conrad"]
log = self.log_path + "conrad/"
lib = self.lib_path + "conrad_repo/"
repo_name = log[:-1].split("/")[-1]
lib_file = "PACKAGES.TXT"
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "Change... | Creating slackers local library |
def down(self, path, link, repo):
filename = link.split("/")[-1]
if not os.path.isfile(path + filename):
Download(path, link.split(), repo).start() | Download files |
def remote(self, *args):
log_path = args[0]
ChangeLog_txt = args[1]
lib_path = args[2]
PACKAGES_TXT = args[3]
CHECKSUMS_MD5 = args[4]
FILELIST_TXT = args[5]
repo = args[6]
if self.checks_logs(log_path, ChangeLog_txt):
# remove old fil... | Remove and recreate files |
def merge(self, path, outfile, infiles):
with open(path + outfile, 'w') as out_f:
for i in infiles:
if os.path.isfile("{0}{1}".format(path, i)):
with open(path + i, "r") as in_f:
for line in in_f:
out_f.... | Merge files |
def file_remove(self, path, filename):
if os.path.isfile(path + filename):
os.remove(path + filename) | Check if filename exists and remove |
def checks_logs(self, log_path, url):
local = ""
filename = url.split("/")[-1]
server = FileSize(url).server()
if os.path.isfile(log_path + filename):
local = FileSize(log_path + filename).local()
if server != local:
return True
return Fal... | Checks ChangeLog.txt for changes |
def upgrade(self, only):
repositories = self.meta.repositories
if only:
repositories = only
for repo in repositories:
changelogs = "{0}{1}{2}".format(self.log_path, repo,
"/ChangeLog.txt")
if os.path.isfile(... | Remove all package lists with changelog and checksums files
and create lists again |
def repository(self, only):
print("\nCheck and update repositories:\n")
default = self.meta.default_repositories
enabled = self.meta.repositories
if only:
enabled = only
for repo in enabled:
if check_for_local_repos(repo) is True:
... | Update repositories lists |
def checklist(self):
choice = []
for item in self.data:
choice.append((item, "", self.status))
code, self.tags = self.d.checklist(
text=self.text, height=20, width=65, list_height=13,
choices=choice, title=self.title, backtitle=self.backtitle)
... | Run dialog checklist |
def buildlist(self, enabled):
choice = []
for item in self.data:
choice.append((item, False))
for item in enabled:
choice.append((item, True))
items = [(tag, tag, sta) for (tag, sta) in choice]
code, self.tags = self.d.buildlist(
text=... | Run dialog buildlist |
def unicode_to_string(self):
for tag in self.tags:
self.ununicode.append(str(tag)) | Convert unicode in string |
def sbo_upgrade(skip, flag):
Msg().checking()
upgrade_names = []
data = SBoGrep(name="").names()
blacklist = BlackList().packages(pkgs=data, repo="sbo")
for pkg in sbo_list():
status(0.02)
name = split_package(pkg)[0]
ver = split_package(pkg)[1]
if (name in data ... | Return packages for upgrade |
def sbo_list():
sbo_packages = []
for pkg in os.listdir(_meta_.pkg_path):
if pkg.endswith("_SBo"):
sbo_packages.append(pkg)
return sbo_packages | Return all SBo packages |
def delete_package(path, packages):
if _meta_.del_all in ["on", "ON"]:
for pkg in packages:
os.remove(path + pkg) | Remove downloaded packages |
def repository_data(self, repo):
sum_pkgs, size, unsize, last_upd = 0, [], [], ""
for line in (Utils().read_file(
self.meta.lib_path + repo + "_repo/PACKAGES.TXT").splitlines()):
if line.startswith("PACKAGES.TXT;"):
last_upd = line[14:].strip()
... | Grap data packages |
def delete(build_folder):
if _meta_.del_build in ["on", "ON"] and os.path.exists(build_folder):
shutil.rmtree(build_folder) | Delete build directory and all its contents. |
def store(self):
data = repo_data(self.PACKAGES_TXT, "slack", self.flag)
black = BlackList().packages(pkgs=data[0], repo="slack")
for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]):
status(0.0003)
repo_pkg_name = split_package(name)[0]
... | Store and return packages for upgrading |
def dialog_checklist(self):
data = []
for upg in self.upgrade_all:
data.append(upg[:-4])
text = "Press 'spacebar' to unchoose packages from upgrade"
title = " Upgrade "
backtitle = "{0} {1}".format(self.meta.__all__,
self.... | Create checklist to choose packages for upgrade |
def views(self):
for upg, size in sorted(zip(self.upgrade_all, self.comp_sum)):
pkg_repo = split_package(upg[:-4])
color = self.meta.color["RED"]
pkg_inst = GetFromInstalled(pkg_repo[0]).name()
if pkg_repo[0] == pkg_inst:
color = self.meta... | Views packages |
def upgrade(self):
for pkg in self.upgrade_all:
check_md5(pkg_checksum(pkg, "slack_patches"), self.patch_path + pkg)
pkg_ver = "{0}-{1}".format(split_package(pkg)[0],
split_package(pkg)[1])
if find_package(split_package(pkg)[0] ... | Upgrade packages |
def kernel(self):
for core in self.upgrade_all:
if "kernel" in core:
if self.meta.default_answer in ["y", "Y"]:
answer = self.meta.default_answer
else:
print("")
self.msg.template(78)
... | Check if kernel upgraded if true
then reinstall "lilo" |
def slackpkg_update(self):
NEW_ChangeLog_txt = URL(mirrors("ChangeLog.txt", "")).reading()
if os.path.isfile(self.meta.slackpkg_lib_path + "ChangeLog.txt.old"):
os.remove(self.meta.slackpkg_lib_path + "ChangeLog.txt.old")
if os.path.isfile(self.meta.slackpkg_lib_path + "Chan... | This replace slackpkg ChangeLog.txt file with new
from Slackware official mirrors after update distribution. |
def update_lists(self):
print("{0}Update the package lists ?{1}".format(
self.meta.color["GREEN"], self.meta.color["ENDC"]))
print("=" * 79)
if self.msg.answer() in ["y", "Y"]:
Update().repository(["slack"]) | Update packages list and ChangeLog.txt file after
upgrade distribution |
def choose_upg(packages):
selected_packages, data = [], []
if packages:
for pkg in packages:
name = GetFromInstalled(pkg).name()
ver = GetFromInstalled(pkg).version()
binary = "{0}{1}".format(name, ver)
installed = find_package(binary + _meta_.sp, _me... | Create checklist to choose packages for upgrade |
def log_head(path, log_file, log_time):
with open(path + log_file, "w") as log:
log.write("#" * 79 + "\n\n")
log.write("File : " + log_file + "\n")
log.write("Path : " + path + "\n")
log.write("Date : " + time.strftime("%d/%m/%Y") + "\n")
log.write("Time : " + log_time +... | write headers to log file |
def log_end(path, log_file, sum_time):
with open(path + log_file, "a") as log:
log.seek(2)
log.write("#" * 79 + "\n\n")
log.write("Time : " + time.strftime("%H:%M:%S") + "\n")
log.write("Total build time : {0}\n".format(sum_time))
log.write(" " * 38 + "E N D\n\n")
... | append END tag to a log file |
def build_time(start_time):
diff_time = round(time.time() - start_time, 2)
if diff_time <= 59.99:
sum_time = str(diff_time) + " Sec"
elif diff_time > 59.99 and diff_time <= 3599.99:
sum_time = round(diff_time / 60, 2)
sum_time_list = re.findall(r"\d+", str(sum_time))
sum... | Calculate build time per package |
def _create_md5_dict(self):
self.sbo_md5 = {}
md5_lists = SBoGrep(self.prgnam).checksum()
for src, md5 in zip(self.sources, md5_lists):
self.sbo_md5[src] = md5 | Create md5 dictionary per source |
def _makeflags(self):
if self.meta.makeflags in ["on", "ON"]:
cpus = multiprocessing.cpu_count()
os.environ["MAKEFLAGS"] = "-j{0}".format(cpus) | Set variable MAKEFLAGS with the numbers of
processors |
def _pass_variable(self):
pass_var = []
for var in os.environ.keys():
expVAR = var.split("_")
if expVAR[0] == self.prgnam.upper() and expVAR[1] != "PATH":
pass_var.append("{0}={1}".format(expVAR[1], os.environ[var]))
return pass_var | Return enviroment variables |
def _delete_sbo_tar_gz(self):
if not self.auto and os.path.isfile(self.meta.build_path + self.script):
os.remove(self.meta.build_path + self.script) | Delete slackbuild tar.gz file after untar |
def _delete_dir(self):
if not self.auto and os.path.isdir(self.meta.build_path + self.prgnam):
shutil.rmtree(self.meta.build_path + self.prgnam) | Delete old folder if exists before start build |
def get_black(self):
blacklist = []
for read in self.black_conf.splitlines():
read = read.lstrip()
if not read.startswith("#"):
blacklist.append(read.replace("\n", ""))
return blacklist | Return blacklist packages from /etc/slpkg/blacklist
configuration file. |
def listed(self):
print("\nPackages in the blacklist:\n")
for black in self.get_black():
if black:
print("{0}{1}{2}".format(self.meta.color["GREEN"], black,
self.meta.color["ENDC"]))
self.quit = True
if... | Print blacklist packages |
def add(self, pkgs):
blacklist = self.get_black()
pkgs = set(pkgs)
print("\nAdd packages in the blacklist:\n")
with open(self.blackfile, "a") as black_conf:
for pkg in pkgs:
if pkg not in blacklist:
print("{0}{1}{2}".format(self.me... | Add blacklist packages if not exist |
def remove(self, pkgs):
print("\nRemove packages from the blacklist:\n")
with open(self.blackfile, "w") as remove:
for line in self.black_conf.splitlines():
if line not in pkgs:
remove.write(line + "\n")
else:
p... | Remove packages from blacklist |
def packages(self, pkgs, repo):
self.black = []
for bl in self.get_black():
pr = bl.split(":")
for pkg in pkgs:
self.__priority(pr, repo, pkg)
self.__blackpkg(bl, repo, pkg)
return self.black | Return packages in blacklist or by repository |
def __priority(self, pr, repo, pkg):
if (pr[0] == repo and pr[1].startswith("*") and
pr[1].endswith("*")):
if pr[1][1:-1] in pkg:
self.black.append(self.__add(repo, pkg))
elif pr[0] == repo and pr[1].endswith("*"):
if pkg.startswith(pr[1][... | Add packages in blacklist by priority |
def __blackpkg(self, bl, repo, pkg):
if bl.startswith("*") and bl.endswith("*"):
if bl[1:-1] in pkg:
self.black.append(self.__add(repo, pkg))
elif bl.endswith("*"):
if pkg.startswith(bl[:-1]):
self.black.append(self.__add(repo, pkg))
... | Add packages in blacklist |
def view(self):
print("") # new line at start
description, count = "", 0
if self.repo == "sbo":
description = SBoGrep(self.name).description()
else:
PACKAGES_TXT = Utils().read_file(self.lib)
for line in PACKAGES_TXT.splitlines():
... | Print package description by repository |
def start(self):
dwn_count = 1
self._directory_prefix()
for dwn in self.url:
# get file name from url and fix passing char '+'
self.file_name = dwn.split("/")[-1].replace("%2B", "+")
if dwn.startswith("file:///"):
source_dir = dwn[7:-... | Download files using wget or other downloader.
Optional curl, aria2c and httpie |
def _make_tarfile(self, output_filename, source_dir):
with tarfile.open(output_filename, "w:gz") as tar:
tar.add(source_dir, arcname=os.path.basename(source_dir)) | Create .tar.gz file |
def _directory_prefix(self):
if self.downder == "wget":
self.dir_prefix = "--directory-prefix="
elif self.downder == "aria2c":
self.dir_prefix = "--dir=" | Downloader options for specific directory |
def _check_if_downloaded(self):
if not os.path.isfile(self.path + self.file_name):
print("")
self.msg.template(78)
print("| Download '{0}' file [ {1}FAILED{2} ]".format(
self.file_name, self.meta.color["RED"],
self.meta.color["ENDC"]))... | Check if file downloaded |
def _check_certificate(self):
if (self.file_name.startswith("jdk-") and self.repo == "sbo" and
self.downder == "wget"):
certificate = (' --no-check-certificate --header="Cookie: '
'oraclelicense=accept-securebackup-cookie"')
self.msg.te... | Check for certificates options for wget |
def slack_package(prgnam):
binaries, cache, binary = [], "0", ""
for pkg in find_package(prgnam, _meta_.output):
if pkg.startswith(prgnam) and pkg[:-4].endswith("_SBo"):
binaries.append(pkg)
for bins in binaries:
if LooseVersion(bins) > LooseVersion(cache):
binar... | Return maximum binary Slackware package from output directory |
def server(self):
try:
tar = urllib2.urlopen(self.registry)
meta = tar.info()
return int(meta.getheaders("Content-Length")[0])
except (urllib2.URLError, IndexError):
return " " | Returns the size of remote files |
def units(comp_sum, uncomp_sum):
compressed = round((sum(map(float, comp_sum)) / 1024), 2)
uncompressed = round((sum(map(float, uncomp_sum)) / 1024), 2)
comp_unit = uncomp_unit = "Mb"
if compressed > 1024:
compressed = round((compressed / 1024), 2)
comp_unit = "Gb"
if uncompress... | Calculate package size |
def status(sec):
if _meta_.prg_bar in ["on", "ON"]:
syms = ["|", "/", "-", "\\"]
for sym in syms:
sys.stdout.write("\b{0}{1}{2}".format(_meta_.color["GREY"], sym,
_meta_.color["ENDC"]))
sys.stdout.flush()
time... | Toolbar progressive status |
def update_deps(self):
onelist, dependencies = [], []
onelist = Utils().dimensional_list(self.deps)
dependencies = Utils().remove_dbs(onelist)
for dep in dependencies:
deps = Requires(self.flag).sbo(dep)
self.deps_dict[dep] = self.one_for_all(deps) | Update dependencies dictionary with all package |
def continue_to_install(self):
if (self.count_uni > 0 or self.count_upg > 0 or
"--download-only" in self.flag or "--rebuild" in self.flag):
if self.master_packages and self.msg.answer() in ["y", "Y"]:
installs, upgraded = self.build_install()
... | Continue to install ? |
def clear_masters(self):
self.master_packages = Utils().remove_dbs(self.master_packages)
for mas in self.master_packages:
if mas in self.dependencies:
self.master_packages.remove(mas) | Clear master slackbuilds if already exist in dependencies
or if added to install two or more times |
def matching(self):
for sbo in self.package_not_found:
for pkg in self.data:
if sbo in pkg and pkg not in self.blacklist:
self.package_found.append(pkg) | Return found matching SBo packages |
def sbo_version_source(self, slackbuilds):
sbo_versions, sources = [], []
for sbo in slackbuilds:
status(0.02)
sbo_ver = "{0}-{1}".format(sbo, SBoGrep(sbo).version())
sbo_versions.append(sbo_ver)
sources.append(SBoGrep(sbo).source())
retur... | Create sbo name with version |
def one_for_all(self, deps):
requires, dependencies = [], []
deps.reverse()
# Inverting the list brings the
# dependencies in order to be installed.
requires = Utils().dimensional_list(deps)
dependencies = Utils().remove_dbs(requires)
return dependencies | Because there are dependencies that depend on other
dependencies are created lists into other lists.
Thus creating this loop create one-dimensional list and
remove double packages from dependencies. |
def view_packages(self, *args):
ver = GetFromInstalled(args[1]).version()
print(" {0}{1}{2}{3} {4}{5} {6}{7}{8}{9}{10}{11:>11}{12}".format(
args[0], args[1] + ver, self.meta.color["ENDC"],
" " * (23-len(args[1] + ver)), args[2],
" " * (18-len(args[2])), args... | :View slackbuild packages with version and arch
args[0] package color
args[1] package
args[2] version
args[3] arch |
def tag(self, sbo):
# split sbo name with version and get name
sbo_name = "-".join(sbo.split("-")[:-1])
find = GetFromInstalled(sbo_name).name()
if find_package(sbo, self.meta.pkg_path):
paint = self.meta.color["GREEN"]
self.count_ins += 1
if ... | Tag with color green if package already installed,
color yellow for packages to upgrade and color red
if not installed. |
def select_arch(self, src):
arch = self.arch
for item in self.unst:
if item in src:
arch = item
return arch | Looks if sources unsupported or untested
from arch else select arch. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.