mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-10 20:01:54 +01:00
Merge branch 'develop'
This commit is contained in:
commit
49608c5604
62 changed files with 449 additions and 399 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
4.0.0 - 29/05/2022
|
||||||
|
Added:
|
||||||
|
- sqlite3 database replaced the sbo repository
|
||||||
|
- python package 'progress' added as dependency
|
||||||
|
|
||||||
3.9.9 - 24/05/2022
|
3.9.9 - 24/05/2022
|
||||||
Updated:
|
Updated:
|
||||||
- Stderr error output to auto-install packages
|
- Stderr error output to auto-install packages
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
***********
|
***********
|
||||||
slpkg 3.9.9
|
slpkg 4.0.0
|
||||||
***********
|
***********
|
||||||
|
|
||||||
Slpkg is a powerful software package manager that installs, updates, and removes packages on
|
Slpkg is a powerful software package manager that installs, updates, and removes packages on
|
||||||
|
@ -35,9 +35,9 @@ Install from the official third party `SBo repository <https://slackbuilds.org/r
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ wget slpkg-3.9.9.tar.gz
|
$ wget slpkg-4.0.0.tar.gz
|
||||||
$ tar xvf slpkg-3.9.9.tar.gz
|
$ tar xvf slpkg-4.0.0.tar.gz
|
||||||
$ cd slpkg-3.9.9
|
$ cd slpkg-4.0.0
|
||||||
$ ./install.sh
|
$ ./install.sh
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
# Python 3.7+
|
# Python 3.7+
|
||||||
# GNU wget
|
# GNU wget
|
||||||
# GNU coreutils
|
# GNU coreutils
|
||||||
|
# sqlite3
|
||||||
|
# progress
|
||||||
#
|
#
|
||||||
# [OPTIONAL]
|
# [OPTIONAL]
|
||||||
# aria2 (alternative downloader)
|
# aria2 (alternative downloader)
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -33,7 +33,7 @@ except ImportError:
|
||||||
|
|
||||||
docs_requires = []
|
docs_requires = []
|
||||||
tests_requires = []
|
tests_requires = []
|
||||||
install_requires = []
|
install_requires = ["progress>=1.6"]
|
||||||
optional_requires = [
|
optional_requires = [
|
||||||
"pythondialog>=3.5.1",
|
"pythondialog>=3.5.1",
|
||||||
"pygraphviz>=1.3.1"
|
"pygraphviz>=1.3.1"
|
||||||
|
|
|
@ -31,8 +31,7 @@ CURRENT = "current"
|
||||||
|
|
||||||
|
|
||||||
def remove_repositories(repositories, default_repositories):
|
def remove_repositories(repositories, default_repositories):
|
||||||
"""
|
"""Removes no default repositories
|
||||||
Remove no default repositories
|
|
||||||
"""
|
"""
|
||||||
for repo in repositories:
|
for repo in repositories:
|
||||||
if repo in default_repositories:
|
if repo in default_repositories:
|
||||||
|
@ -40,8 +39,7 @@ def remove_repositories(repositories, default_repositories):
|
||||||
|
|
||||||
|
|
||||||
def update_repositories(repositories, conf_path):
|
def update_repositories(repositories, conf_path):
|
||||||
"""
|
"""Upadate with user custom repositories
|
||||||
Upadate with user custom repositories
|
|
||||||
"""
|
"""
|
||||||
repo_file = f"{conf_path}custom-repositories"
|
repo_file = f"{conf_path}custom-repositories"
|
||||||
if os.path.isfile(repo_file):
|
if os.path.isfile(repo_file):
|
||||||
|
@ -56,8 +54,7 @@ def update_repositories(repositories, conf_path):
|
||||||
|
|
||||||
|
|
||||||
def grab_sub_repo(repositories, repos):
|
def grab_sub_repo(repositories, repos):
|
||||||
"""
|
"""Grabs SUB_REPOSITORY
|
||||||
Grab SUB_REPOSITORY
|
|
||||||
"""
|
"""
|
||||||
for i, repo in enumerate(repositories):
|
for i, repo in enumerate(repositories):
|
||||||
if repos in repo:
|
if repos in repo:
|
||||||
|
@ -68,8 +65,7 @@ def grab_sub_repo(repositories, repos):
|
||||||
|
|
||||||
|
|
||||||
def select_slack_release(slack_rel):
|
def select_slack_release(slack_rel):
|
||||||
"""
|
"""Warning message if Slackware release not defined or
|
||||||
Warning message if Slackware release not defined or
|
|
||||||
defined wrong
|
defined wrong
|
||||||
"""
|
"""
|
||||||
if slack_rel not in [STABLE, CURRENT]:
|
if slack_rel not in [STABLE, CURRENT]:
|
||||||
|
@ -81,7 +77,7 @@ class MetaData:
|
||||||
|
|
||||||
__all__ = "slpkg"
|
__all__ = "slpkg"
|
||||||
__author__ = "dslackw"
|
__author__ = "dslackw"
|
||||||
__version_info__ = (3, 9, 9)
|
__version_info__ = (4, 0, 0)
|
||||||
__version__ = "{0}.{1}.{2}".format(*__version_info__)
|
__version__ = "{0}.{1}.{2}".format(*__version_info__)
|
||||||
__license__ = "GNU General Public License v3 (GPLv3)"
|
__license__ = "GNU General Public License v3 (GPLv3)"
|
||||||
__email__ = "d.zlatanidis@gmail.com"
|
__email__ = "d.zlatanidis@gmail.com"
|
||||||
|
@ -137,7 +133,7 @@ class MetaData:
|
||||||
"slonly", "ktown", "multi", "slacke", "salix",
|
"slonly", "ktown", "multi", "slacke", "salix",
|
||||||
"slackl", "rested", "msb", "csb", "connos", "mles"]
|
"slackl", "rested", "msb", "csb", "connos", "mles"]
|
||||||
|
|
||||||
# read value from configuration file
|
# reads values from the configuration file
|
||||||
repositories = []
|
repositories = []
|
||||||
for files in ["slpkg.conf", "repositories.conf"]:
|
for files in ["slpkg.conf", "repositories.conf"]:
|
||||||
if os.path.isfile(f"{conf_path}{files}"):
|
if os.path.isfile(f"{conf_path}{files}"):
|
||||||
|
@ -152,7 +148,7 @@ class MetaData:
|
||||||
elif files == "repositories.conf":
|
elif files == "repositories.conf":
|
||||||
repositories.append(line)
|
repositories.append(line)
|
||||||
|
|
||||||
# Set values from configuration file
|
# Sets values from the configuration file
|
||||||
slack_rel = _conf_slpkg["RELEASE"]
|
slack_rel = _conf_slpkg["RELEASE"]
|
||||||
slackware_version = _conf_slpkg["SLACKWARE_VERSION"]
|
slackware_version = _conf_slpkg["SLACKWARE_VERSION"]
|
||||||
comp_arch = _conf_slpkg["COMP_ARCH"]
|
comp_arch = _conf_slpkg["COMP_ARCH"]
|
||||||
|
@ -183,22 +179,22 @@ class MetaData:
|
||||||
# SBo downloading sources path
|
# SBo downloading sources path
|
||||||
SBo_SOURCES = build_path + "_SOURCES/"
|
SBo_SOURCES = build_path + "_SOURCES/"
|
||||||
|
|
||||||
# Remove any gaps
|
# Removes any gaps
|
||||||
repositories = [repo.strip() for repo in repositories]
|
repositories = [repo.strip() for repo in repositories]
|
||||||
|
|
||||||
# Check Slackware release
|
# Checks Slackware release
|
||||||
slack_rel = select_slack_release(slack_rel)
|
slack_rel = select_slack_release(slack_rel)
|
||||||
|
|
||||||
# Grap sub repositories
|
# Grabs sub repositories
|
||||||
ktown_kde_repo = grab_sub_repo(repositories, "ktown")
|
ktown_kde_repo = grab_sub_repo(repositories, "ktown")
|
||||||
slacke_sub_repo = grab_sub_repo(repositories, "slacke")
|
slacke_sub_repo = grab_sub_repo(repositories, "slacke")
|
||||||
msb_sub_repo = grab_sub_repo(repositories, "msb")
|
msb_sub_repo = grab_sub_repo(repositories, "msb")
|
||||||
mles_sub_repo = grab_sub_repo(repositories, "mles")
|
mles_sub_repo = grab_sub_repo(repositories, "mles")
|
||||||
|
|
||||||
# remove no default repositories
|
# removes no default repositories
|
||||||
repositories = list(remove_repositories(repositories,
|
repositories = list(remove_repositories(repositories,
|
||||||
default_repositories))
|
default_repositories))
|
||||||
# add custom repositories
|
# adds custom repositories
|
||||||
update_repositories(repositories, conf_path)
|
update_repositories(repositories, conf_path)
|
||||||
|
|
||||||
color = {
|
color = {
|
||||||
|
@ -241,13 +237,16 @@ class MetaData:
|
||||||
# slackpkg lib path
|
# slackpkg lib path
|
||||||
slackpkg_lib_path = "/var/lib/slackpkg/"
|
slackpkg_lib_path = "/var/lib/slackpkg/"
|
||||||
|
|
||||||
|
# database name
|
||||||
|
db = "/database/database.slpkg"
|
||||||
|
|
||||||
# computer architecture
|
# computer architecture
|
||||||
if comp_arch in ["off", "OFF"]:
|
if comp_arch in ["off", "OFF"]:
|
||||||
arch = os.uname()[4]
|
arch = os.uname()[4]
|
||||||
else:
|
else:
|
||||||
arch = comp_arch
|
arch = comp_arch
|
||||||
|
|
||||||
# get sbo OUTPUT enviroment variable
|
# gets sbo OUTPUT enviroment variable
|
||||||
try:
|
try:
|
||||||
output = os.environ["OUTPUT"]
|
output = os.environ["OUTPUT"]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
|
|
@ -29,7 +29,7 @@ from slpkg.pkg.manager import PackageManager
|
||||||
|
|
||||||
|
|
||||||
class AutoInstall:
|
class AutoInstall:
|
||||||
"""Select Slackware command to install packages
|
"""Select the Slackware command to install packages
|
||||||
"""
|
"""
|
||||||
def __init__(self, packages):
|
def __init__(self, packages):
|
||||||
self.packages = packages
|
self.packages = packages
|
||||||
|
@ -69,7 +69,7 @@ class AutoInstall:
|
||||||
self.execute()
|
self.execute()
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
"""Execute Slackware command
|
"""Executes Slackware command
|
||||||
"""
|
"""
|
||||||
if self.choice in self.commands.keys():
|
if self.choice in self.commands.keys():
|
||||||
if self.choice == "i":
|
if self.choice == "i":
|
||||||
|
|
|
@ -65,6 +65,6 @@ def pkg_upgrade(repo, skip, flag):
|
||||||
|
|
||||||
|
|
||||||
def installed():
|
def installed():
|
||||||
"""Return all installed packages
|
"""Returns all installed packages
|
||||||
"""
|
"""
|
||||||
return find_package("", _meta_.pkg_path)
|
return find_package("", _meta_.pkg_path)
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Dependencies:
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
|
|
||||||
def binary(self, name, flag):
|
def binary(self, name, flag):
|
||||||
"""Build all dependencies of a package
|
"""Builds all dependencies of a package
|
||||||
"""
|
"""
|
||||||
if self.meta.rsl_deps in ["on", "ON"] and "--resolve-off" not in flag:
|
if self.meta.rsl_deps in ["on", "ON"] and "--resolve-off" not in flag:
|
||||||
sys.setrecursionlimit(10000)
|
sys.setrecursionlimit(10000)
|
||||||
|
|
|
@ -31,7 +31,7 @@ from slpkg.slack.slack_version import slack_ver
|
||||||
|
|
||||||
|
|
||||||
def repo_data(PACKAGES_TXT, repo, flag):
|
def repo_data(PACKAGES_TXT, repo, flag):
|
||||||
"""Grap data packages
|
"""Grabs data packages
|
||||||
"""
|
"""
|
||||||
(name, location, size, unsize,
|
(name, location, size, unsize,
|
||||||
rname, rlocation, rsize, runsize) = ([] for i in range(8))
|
rname, rlocation, rsize, runsize) = ([] for i in range(8))
|
||||||
|
@ -180,7 +180,7 @@ class Requires:
|
||||||
self.repo = repo
|
self.repo = repo
|
||||||
|
|
||||||
def get_deps(self):
|
def get_deps(self):
|
||||||
"""Grap package requirements from repositories
|
"""Grabs package requirements from repositories
|
||||||
"""
|
"""
|
||||||
if self.repo == "rlw":
|
if self.repo == "rlw":
|
||||||
dependencies = {}
|
dependencies = {}
|
||||||
|
|
|
@ -49,7 +49,7 @@ from slpkg.binary.dependency import Dependencies
|
||||||
|
|
||||||
|
|
||||||
class BinaryInstall(BlackList, Utils):
|
class BinaryInstall(BlackList, Utils):
|
||||||
"""Install binaries packages with all dependencies from
|
"""Installs binaries packages with all dependencies from
|
||||||
repository
|
repository
|
||||||
"""
|
"""
|
||||||
def __init__(self, packages, repo, flag):
|
def __init__(self, packages, repo, flag):
|
||||||
|
@ -94,8 +94,7 @@ class BinaryInstall(BlackList, Utils):
|
||||||
self.tmp_path += "/"
|
self.tmp_path += "/"
|
||||||
|
|
||||||
def start(self, is_upgrade):
|
def start(self, is_upgrade):
|
||||||
"""
|
"""Installs packages from official Slackware distribution
|
||||||
Install packages from official Slackware distribution
|
|
||||||
"""
|
"""
|
||||||
self.case_insensitive()
|
self.case_insensitive()
|
||||||
# fix if packages is for upgrade
|
# fix if packages is for upgrade
|
||||||
|
@ -175,7 +174,7 @@ class BinaryInstall(BlackList, Utils):
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
|
|
||||||
def if_all_installed(self):
|
def if_all_installed(self):
|
||||||
"""Check if all packages is already installed
|
"""Checks if all packages is already installed
|
||||||
"""
|
"""
|
||||||
count_inst = 0
|
count_inst = 0
|
||||||
for inst in (self.dep_install + self.install):
|
for inst in (self.dep_install + self.install):
|
||||||
|
@ -200,7 +199,7 @@ class BinaryInstall(BlackList, Utils):
|
||||||
self.packages[index] = value
|
self.packages[index] = value
|
||||||
|
|
||||||
def update_deps(self):
|
def update_deps(self):
|
||||||
"""Update dependencies dictionary with all package
|
"""Updates dependencies dictionary with all package
|
||||||
"""
|
"""
|
||||||
for dep in self.dependencies:
|
for dep in self.dependencies:
|
||||||
deps = self.dimensional_list(Dependencies(
|
deps = self.dimensional_list(Dependencies(
|
||||||
|
@ -219,7 +218,7 @@ class BinaryInstall(BlackList, Utils):
|
||||||
self.packages = packages
|
self.packages = packages
|
||||||
|
|
||||||
def install_packages(self):
|
def install_packages(self):
|
||||||
"""Install or upgrade packages
|
"""Installs or upgrades packages
|
||||||
"""
|
"""
|
||||||
installs, upgraded = [], []
|
installs, upgraded = [], []
|
||||||
for inst in (self.dep_install + self.install):
|
for inst in (self.dep_install + self.install):
|
||||||
|
@ -259,7 +258,7 @@ class BinaryInstall(BlackList, Utils):
|
||||||
check_md5(pkg_checksum(install, self.repo), self.tmp_path + install)
|
check_md5(pkg_checksum(install, self.repo), self.tmp_path + install)
|
||||||
|
|
||||||
def resolving_deps(self):
|
def resolving_deps(self):
|
||||||
"""Return package dependencies
|
"""Returns package dependencies
|
||||||
"""
|
"""
|
||||||
requires = []
|
requires = []
|
||||||
if (self.meta.rsl_deps in ["on", "ON"] and
|
if (self.meta.rsl_deps in ["on", "ON"] and
|
||||||
|
@ -274,7 +273,7 @@ class BinaryInstall(BlackList, Utils):
|
||||||
return self.remove_dbs(requires)
|
return self.remove_dbs(requires)
|
||||||
|
|
||||||
def _fix_deps_repos(self, dependencies):
|
def _fix_deps_repos(self, dependencies):
|
||||||
"""Fix store deps include in repository
|
"""Fixes store deps include in the repository
|
||||||
"""
|
"""
|
||||||
for dep in dependencies:
|
for dep in dependencies:
|
||||||
if dep in self.repo_pkg_names:
|
if dep in self.repo_pkg_names:
|
||||||
|
@ -311,7 +310,7 @@ class BinaryInstall(BlackList, Utils):
|
||||||
return [pkg_sum, res_sum, upg_sum, uni_sum]
|
return [pkg_sum, res_sum, upg_sum, uni_sum]
|
||||||
|
|
||||||
def top_view(self):
|
def top_view(self):
|
||||||
"""Print packages status bar
|
"""Prints packages status bar
|
||||||
"""
|
"""
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print(f"| Package{' ' * 17}New Version{' ' * 8}Arch{' ' * 4}"
|
print(f"| Package{' ' * 17}New Version{' ' * 8}Arch{' ' * 4}"
|
||||||
|
@ -319,7 +318,7 @@ class BinaryInstall(BlackList, Utils):
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
|
|
||||||
def store(self, packages):
|
def store(self, packages):
|
||||||
"""Store and return packages for install
|
"""Stores and returns packages for install
|
||||||
"""
|
"""
|
||||||
dwn, install, comp_sum, uncomp_sum = ([] for i in range(4))
|
dwn, install, comp_sum, uncomp_sum = ([] for i in range(4))
|
||||||
# name = data[0]
|
# name = data[0]
|
||||||
|
|
|
@ -31,7 +31,7 @@ from slpkg.slack.slack_version import slack_ver
|
||||||
|
|
||||||
|
|
||||||
class RepoInit(Utils):
|
class RepoInit(Utils):
|
||||||
"""Return PACKAGES.TXT and mirror by repository
|
"""Returns PACKAGES.TXT and mirror by repository
|
||||||
"""
|
"""
|
||||||
def __init__(self, repo):
|
def __init__(self, repo):
|
||||||
self.repo = repo
|
self.repo = repo
|
||||||
|
|
|
@ -28,7 +28,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
def search_pkg(name, repo):
|
def search_pkg(name, repo):
|
||||||
"""Search if package exists in PACKAGES.TXT file
|
"""Searching if the package exists in PACKAGES.TXT file
|
||||||
and return the name.
|
and return the name.
|
||||||
"""
|
"""
|
||||||
utils = Utils()
|
utils = Utils()
|
||||||
|
|
|
@ -30,7 +30,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
class BlackList(Utils):
|
class BlackList(Utils):
|
||||||
"""Blacklist class to add, remove or listed packages
|
"""Blacklist class to add, remove or list packages
|
||||||
in blacklist file."""
|
in blacklist file."""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.green = _meta_.color["GREEN"]
|
self.green = _meta_.color["GREEN"]
|
||||||
|
@ -56,8 +56,8 @@ class BlackList(Utils):
|
||||||
yield black
|
yield black
|
||||||
|
|
||||||
def black_filter(self):
|
def black_filter(self):
|
||||||
"""Return all the installed files that start
|
"""Returns all the installed files that start
|
||||||
by the name*
|
by the name
|
||||||
"""
|
"""
|
||||||
for read in self.black_conf.splitlines():
|
for read in self.black_conf.splitlines():
|
||||||
read = read.lstrip()
|
read = read.lstrip()
|
||||||
|
@ -65,7 +65,7 @@ class BlackList(Utils):
|
||||||
yield read.replace("\n", "")
|
yield read.replace("\n", "")
|
||||||
|
|
||||||
def black_listed(self):
|
def black_listed(self):
|
||||||
"""Print blacklist packages
|
"""Prints blacklist packages
|
||||||
"""
|
"""
|
||||||
print("Packages in the blacklist:")
|
print("Packages in the blacklist:")
|
||||||
for black in list(self.black_filter()):
|
for black in list(self.black_filter()):
|
||||||
|
@ -74,7 +74,7 @@ class BlackList(Utils):
|
||||||
print()
|
print()
|
||||||
|
|
||||||
def black_add(self, pkgs):
|
def black_add(self, pkgs):
|
||||||
"""Add blacklist packages if not exist
|
"""Adds blacklist packages if not exist
|
||||||
"""
|
"""
|
||||||
blacklist = list(self.black_filter())
|
blacklist = list(self.black_filter())
|
||||||
pkgs = set(pkgs)
|
pkgs = set(pkgs)
|
||||||
|
@ -87,7 +87,7 @@ class BlackList(Utils):
|
||||||
print()
|
print()
|
||||||
|
|
||||||
def black_remove(self, pkgs):
|
def black_remove(self, pkgs):
|
||||||
"""Remove packages from blacklist
|
"""Removes packages from blacklist
|
||||||
"""
|
"""
|
||||||
print("Remove packages from the blacklist:")
|
print("Remove packages from the blacklist:")
|
||||||
with open(self.blackfile, "w") as remove:
|
with open(self.blackfile, "w") as remove:
|
||||||
|
|
|
@ -29,7 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
def clean_tmp():
|
def clean_tmp():
|
||||||
"""Delete packages and sources from tmp/ directory
|
"""Deletes packages and sources from tmp/ directory
|
||||||
"""
|
"""
|
||||||
tmps = [_meta_.tmp_path, # /tmp/slpkg/
|
tmps = [_meta_.tmp_path, # /tmp/slpkg/
|
||||||
_meta_.build_path, # /tmp/slpkg/build/
|
_meta_.build_path, # /tmp/slpkg/build/
|
||||||
|
|
|
@ -30,7 +30,7 @@ from slpkg.sbo.greps import SBoGrep
|
||||||
|
|
||||||
|
|
||||||
class PkgDesc(Utils):
|
class PkgDesc(Utils):
|
||||||
"""Print package description from the repository
|
"""Prints package description from the repository
|
||||||
"""
|
"""
|
||||||
def __init__(self, name, repo, paint):
|
def __init__(self, name, repo, paint):
|
||||||
self.name = name
|
self.name = name
|
||||||
|
@ -51,7 +51,7 @@ class PkgDesc(Utils):
|
||||||
self.lib = f"{self.meta.lib_path}{self.repo}_repo/PACKAGES.TXT"
|
self.lib = f"{self.meta.lib_path}{self.repo}_repo/PACKAGES.TXT"
|
||||||
|
|
||||||
def view(self):
|
def view(self):
|
||||||
"""Print package description by repository
|
"""Prints package description by repository
|
||||||
"""
|
"""
|
||||||
description, count = "", 0
|
description, count = "", 0
|
||||||
if self.repo == "sbo":
|
if self.repo == "sbo":
|
||||||
|
|
|
@ -28,7 +28,7 @@ import os
|
||||||
|
|
||||||
|
|
||||||
class DialogUtil:
|
class DialogUtil:
|
||||||
"""Create dialog checklist
|
"""Creates dialog checklist
|
||||||
"""
|
"""
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
self.imp_dialog()
|
self.imp_dialog()
|
||||||
|
@ -48,7 +48,7 @@ class DialogUtil:
|
||||||
self.d = Dialog(dialog="dialog", autowidgetsize=True)
|
self.d = Dialog(dialog="dialog", autowidgetsize=True)
|
||||||
|
|
||||||
def checklist(self):
|
def checklist(self):
|
||||||
"""Run dialog checklist
|
"""Runs dialog checklist
|
||||||
"""
|
"""
|
||||||
choice = []
|
choice = []
|
||||||
for item in self.data:
|
for item in self.data:
|
||||||
|
@ -63,7 +63,7 @@ class DialogUtil:
|
||||||
self.exit()
|
self.exit()
|
||||||
|
|
||||||
def buildlist(self, enabled):
|
def buildlist(self, enabled):
|
||||||
"""Run dialog buildlist
|
"""Runs dialog buildlist
|
||||||
"""
|
"""
|
||||||
choice = []
|
choice = []
|
||||||
for item in self.data:
|
for item in self.data:
|
||||||
|
@ -81,7 +81,7 @@ class DialogUtil:
|
||||||
self.exit()
|
self.exit()
|
||||||
|
|
||||||
def exit(self):
|
def exit(self):
|
||||||
"""Exit from dialog
|
"""Exits from dialog
|
||||||
"""
|
"""
|
||||||
self.clear_screen()
|
self.clear_screen()
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
|
@ -92,7 +92,7 @@ class DialogUtil:
|
||||||
os.system("clear")
|
os.system("clear")
|
||||||
|
|
||||||
def unicode_to_string(self):
|
def unicode_to_string(self):
|
||||||
"""Convert unicode in string
|
"""Converts unicode in string
|
||||||
"""
|
"""
|
||||||
for tag in self.tags:
|
for tag in self.tags:
|
||||||
self.ununicode.append(str(tag))
|
self.ununicode.append(str(tag))
|
||||||
|
|
|
@ -51,7 +51,7 @@ class Download(Utils):
|
||||||
self.downder_options = self.meta.downder_options
|
self.downder_options = self.meta.downder_options
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
"""Download files using wget or other downloader.
|
"""Download files using wget or other downloaders.
|
||||||
Optional curl, aria2c and httpie
|
Optional curl, aria2c and httpie
|
||||||
"""
|
"""
|
||||||
dwn_count = 1
|
dwn_count = 1
|
||||||
|
@ -82,7 +82,7 @@ class Download(Utils):
|
||||||
dwn_count += 1
|
dwn_count += 1
|
||||||
|
|
||||||
def _make_tarfile(self, output_filename, source_dir):
|
def _make_tarfile(self, output_filename, source_dir):
|
||||||
"""Create .tar.gz file
|
"""Creates .tar.gz file
|
||||||
"""
|
"""
|
||||||
with tarfile.open(output_filename, "w:gz") as tar:
|
with tarfile.open(output_filename, "w:gz") as tar:
|
||||||
tar.add(source_dir, arcname=os.path.basename(source_dir))
|
tar.add(source_dir, arcname=os.path.basename(source_dir))
|
||||||
|
@ -96,7 +96,7 @@ class Download(Utils):
|
||||||
self.dir_prefix = "--dir="
|
self.dir_prefix = "--dir="
|
||||||
|
|
||||||
def _check_if_downloaded(self):
|
def _check_if_downloaded(self):
|
||||||
"""Check if file downloaded
|
"""Checks if file downloaded
|
||||||
"""
|
"""
|
||||||
if not os.path.isfile(self.path + self.file_name):
|
if not os.path.isfile(self.path + self.file_name):
|
||||||
print()
|
print()
|
||||||
|
@ -109,7 +109,7 @@ class Download(Utils):
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
|
|
||||||
def _check_certificate(self):
|
def _check_certificate(self):
|
||||||
"""Check for certificates options for wget
|
"""Checks for certificates options for wget
|
||||||
"""
|
"""
|
||||||
if (self.file_name.startswith("jdk-") and self.repo == "sbo" and
|
if (self.file_name.startswith("jdk-") and self.repo == "sbo" and
|
||||||
self.downder == "wget"):
|
self.downder == "wget"):
|
||||||
|
|
|
@ -29,7 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
class FileSize:
|
class FileSize:
|
||||||
"""Check local or remote file size
|
"""Checks local or remote file size
|
||||||
"""
|
"""
|
||||||
def __init__(self, registry):
|
def __init__(self, registry):
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
|
|
|
@ -47,7 +47,7 @@ class Graph:
|
||||||
]
|
]
|
||||||
|
|
||||||
def dependencies(self, deps_dict):
|
def dependencies(self, deps_dict):
|
||||||
"""Generate graph file with depenndencies map tree
|
"""Generates graph file with dependencies map tree
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
import pygraphviz as pgv
|
import pygraphviz as pgv
|
||||||
|
@ -75,7 +75,7 @@ class Graph:
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
|
|
||||||
def check_file(self):
|
def check_file(self):
|
||||||
"""Check for file format and type
|
"""Checks for file format and type
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
image_type = f".{self.image.split('.')[1]}"
|
image_type = f".{self.image.split('.')[1]}"
|
||||||
|
@ -87,7 +87,7 @@ class Graph:
|
||||||
raise SystemExit("slpkg: Error: Image file suffix missing")
|
raise SystemExit("slpkg: Error: Image file suffix missing")
|
||||||
|
|
||||||
def graph_easy(self):
|
def graph_easy(self):
|
||||||
"""Draw ascii diagram. graph-easy perl module require
|
"""Drawing ascii diagram. graph-easy perl module requires
|
||||||
"""
|
"""
|
||||||
if not os.path.isfile("/usr/bin/graph-easy"):
|
if not os.path.isfile("/usr/bin/graph-easy"):
|
||||||
print("Require 'graph-easy': Install with 'slpkg -s sbo"
|
print("Require 'graph-easy': Install with 'slpkg -s sbo"
|
||||||
|
@ -99,7 +99,7 @@ class Graph:
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
|
|
||||||
def remove_dot(self):
|
def remove_dot(self):
|
||||||
"""Remove .dot files
|
"""Removes .dot files
|
||||||
"""
|
"""
|
||||||
if os.path.isfile(f"{self.image}.dot"):
|
if os.path.isfile(f"{self.image}.dot"):
|
||||||
os.remove(f"{self.image}.dot")
|
os.remove(f"{self.image}.dot")
|
||||||
|
|
|
@ -29,7 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
def pkg_checksum(binary, repo):
|
def pkg_checksum(binary, repo):
|
||||||
"""Return checksum from CHECKSUMS.md5 file by repository
|
"""Returns checksum from CHECKSUMS.md5 file by repository
|
||||||
"""
|
"""
|
||||||
md5 = "None"
|
md5 = "None"
|
||||||
if repo == "slack_patches" and _meta_.slack_rel == "stable":
|
if repo == "slack_patches" and _meta_.slack_rel == "stable":
|
||||||
|
|
|
@ -31,7 +31,7 @@ from slpkg.pkg.find import find_package
|
||||||
|
|
||||||
|
|
||||||
class PackageHealth:
|
class PackageHealth:
|
||||||
"""Health check installed packages
|
"""Health check for the installed packages
|
||||||
"""
|
"""
|
||||||
def __init__(self, mode):
|
def __init__(self, mode):
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
|
@ -46,7 +46,7 @@ class PackageHealth:
|
||||||
self.cn = 0
|
self.cn = 0
|
||||||
|
|
||||||
def packages(self):
|
def packages(self):
|
||||||
"""Get all installed packages from /var/log/packages/ path
|
"""Gets all installed packages from /var/log/packages/ path
|
||||||
"""
|
"""
|
||||||
self.installed = find_package("", self.pkg_path)
|
self.installed = find_package("", self.pkg_path)
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class PackageHealth:
|
||||||
raise SystemExit("\n")
|
raise SystemExit("\n")
|
||||||
|
|
||||||
def test(self):
|
def test(self):
|
||||||
"""Get started test each package and read file list
|
"""Starts testing each package and reading the file list
|
||||||
"""
|
"""
|
||||||
self.packages()
|
self.packages()
|
||||||
self.cf = 0
|
self.cf = 0
|
||||||
|
@ -86,7 +86,7 @@ class PackageHealth:
|
||||||
self.results()
|
self.results()
|
||||||
|
|
||||||
def results(self):
|
def results(self):
|
||||||
"""Print results
|
"""Prints results
|
||||||
"""
|
"""
|
||||||
print()
|
print()
|
||||||
per = int(round((float(self.cf) / (self.cf + self.cn)) * 100))
|
per = int(round((float(self.cf) / (self.cf + self.cn)) * 100))
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import sqlite3
|
||||||
|
from models.models import Database
|
||||||
|
|
||||||
from slpkg.utils import Utils
|
from slpkg.utils import Utils
|
||||||
from slpkg.repositories import Repo
|
from slpkg.repositories import Repo
|
||||||
|
@ -36,15 +38,13 @@ from slpkg.slack.slack_version import slack_ver
|
||||||
|
|
||||||
|
|
||||||
class Initialization(Utils):
|
class Initialization(Utils):
|
||||||
"""Slpkg initialization start all from here. Create local
|
"""Slpkg initialization starts all from here.
|
||||||
package lists and update or upgrade these.
|
Creates local package lists and updates or upgrades these.
|
||||||
"""
|
"""
|
||||||
def __init__(self, check):
|
def __init__(self, check):
|
||||||
self.check = check
|
self.check = check
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
self.arch = _meta_.arch
|
self.arch = _meta_.arch
|
||||||
self.slack_ver = slack_ver()
|
|
||||||
self.def_repos_dict = Repo().default_repository()
|
|
||||||
self.conf_path = self.meta.conf_path
|
self.conf_path = self.meta.conf_path
|
||||||
self.log_path = self.meta.log_path
|
self.log_path = self.meta.log_path
|
||||||
self.lib_path = self.meta.lib_path
|
self.lib_path = self.meta.lib_path
|
||||||
|
@ -53,6 +53,8 @@ class Initialization(Utils):
|
||||||
self._SOURCES = self.meta.SBo_SOURCES
|
self._SOURCES = self.meta.SBo_SOURCES
|
||||||
self.slpkg_tmp_packages = self.meta.slpkg_tmp_packages
|
self.slpkg_tmp_packages = self.meta.slpkg_tmp_packages
|
||||||
self.slpkg_tmp_patches = self.meta.slpkg_tmp_patches
|
self.slpkg_tmp_patches = self.meta.slpkg_tmp_patches
|
||||||
|
self.slack_ver = slack_ver()
|
||||||
|
self.def_repos_dict = Repo().default_repository()
|
||||||
self.constructing()
|
self.constructing()
|
||||||
|
|
||||||
def constructing(self):
|
def constructing(self):
|
||||||
|
@ -74,6 +76,15 @@ class Initialization(Utils):
|
||||||
|
|
||||||
self.make_dir(paths_basic)
|
self.make_dir(paths_basic)
|
||||||
self.make_dirs(paths_extra)
|
self.make_dirs(paths_extra)
|
||||||
|
self.database()
|
||||||
|
|
||||||
|
def database(self):
|
||||||
|
"""Initializing the database
|
||||||
|
"""
|
||||||
|
db_lib = self.lib_path + self.meta.db
|
||||||
|
self.make_dirs([db_lib])
|
||||||
|
self.con = sqlite3.connect(db_lib)
|
||||||
|
self.cur = self.con.cursor()
|
||||||
|
|
||||||
def make_dir(self, path: list):
|
def make_dir(self, path: list):
|
||||||
for p in path:
|
for p in path:
|
||||||
|
@ -86,7 +97,7 @@ class Initialization(Utils):
|
||||||
os.makedirs(p)
|
os.makedirs(p)
|
||||||
|
|
||||||
def custom(self, name):
|
def custom(self, name):
|
||||||
"""Creating user select repository local library
|
"""Creating user custom repository local library
|
||||||
"""
|
"""
|
||||||
repo = Repo().custom_repository()[name]
|
repo = Repo().custom_repository()[name]
|
||||||
log = self.log_path + name + "/"
|
log = self.log_path + name + "/"
|
||||||
|
@ -588,14 +599,14 @@ class Initialization(Utils):
|
||||||
FILELIST_TXT, repo_name)
|
FILELIST_TXT, repo_name)
|
||||||
|
|
||||||
def down(self, path, link, repo):
|
def down(self, path, link, repo):
|
||||||
"""Download files
|
"""Downloads files
|
||||||
"""
|
"""
|
||||||
filename = link.split("/")[-1]
|
filename = link.split("/")[-1]
|
||||||
if not os.path.isfile(path + filename):
|
if not os.path.isfile(path + filename):
|
||||||
Download(path, link.split(), repo).start()
|
Download(path, link.split(), repo).start()
|
||||||
|
|
||||||
def remote(self, *args):
|
def remote(self, *args):
|
||||||
"""Remove and recreate files
|
"""Removes and recreates files
|
||||||
"""
|
"""
|
||||||
log_path = args[0]
|
log_path = args[0]
|
||||||
ChangeLog_txt = args[1]
|
ChangeLog_txt = args[1]
|
||||||
|
@ -626,9 +637,12 @@ class Initialization(Utils):
|
||||||
self.down(lib_path, CHECKSUMS_MD5, repo)
|
self.down(lib_path, CHECKSUMS_MD5, repo)
|
||||||
self.down(lib_path, FILELIST_TXT, repo)
|
self.down(lib_path, FILELIST_TXT, repo)
|
||||||
self.down(log_path, ChangeLog_txt, repo)
|
self.down(log_path, ChangeLog_txt, repo)
|
||||||
|
if repo == 'sbo':
|
||||||
|
self.cur.execute("DROP TABLE IF EXISTS sbo")
|
||||||
|
self.con.commit()
|
||||||
|
|
||||||
def merge(self, path, outfile, infiles):
|
def merge(self, path, outfile, infiles):
|
||||||
"""Merge files
|
"""Merging files
|
||||||
"""
|
"""
|
||||||
code = "utf-8"
|
code = "utf-8"
|
||||||
with open(path + outfile, 'w', encoding=code) as out_f:
|
with open(path + outfile, 'w', encoding=code) as out_f:
|
||||||
|
@ -641,7 +655,7 @@ class Initialization(Utils):
|
||||||
out_f.write(line)
|
out_f.write(line)
|
||||||
|
|
||||||
def file_remove(self, path, filename):
|
def file_remove(self, path, filename):
|
||||||
"""Check if filename exists and remove
|
"""Checks if filename exists and removes
|
||||||
"""
|
"""
|
||||||
if os.path.isfile(path + filename):
|
if os.path.isfile(path + filename):
|
||||||
os.remove(path + filename)
|
os.remove(path + filename)
|
||||||
|
@ -704,7 +718,7 @@ class Update:
|
||||||
self.error = f"{self.red}Error{self.endc}\n"
|
self.error = f"{self.red}Error{self.endc}\n"
|
||||||
|
|
||||||
def run(self, repos):
|
def run(self, repos):
|
||||||
"""Update repositories lists
|
"""Updates repositories lists
|
||||||
"""
|
"""
|
||||||
print("\nCheck and update repositories:\n")
|
print("\nCheck and update repositories:\n")
|
||||||
default = self.meta.default_repositories
|
default = self.meta.default_repositories
|
||||||
|
@ -728,8 +742,17 @@ class Update:
|
||||||
else:
|
else:
|
||||||
print(self.error, end="")
|
print(self.error, end="")
|
||||||
print() # new line at end
|
print() # new line at end
|
||||||
|
self.check_db()
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
|
|
||||||
|
def check_db(self):
|
||||||
|
"""Checking if the table exists
|
||||||
|
"""
|
||||||
|
sbo_db = Database("sbo", "SLACKBUILDS.TXT")
|
||||||
|
if sbo_db.table_exists() == 0:
|
||||||
|
sbo_db.create_sbo_table()
|
||||||
|
sbo_db.insert_sbo_table()
|
||||||
|
|
||||||
def done_msg(self, repo):
|
def done_msg(self, repo):
|
||||||
print(f"{self.grey}Check repository "
|
print(f"{self.grey}Check repository "
|
||||||
f"[{self.cyan}{repo}{self.grey}] ... "
|
f"[{self.cyan}{repo}{self.grey}] ... "
|
||||||
|
@ -749,7 +772,7 @@ def check_exists_repositories(repo):
|
||||||
|
|
||||||
|
|
||||||
def check_for_local_repos(repo):
|
def check_for_local_repos(repo):
|
||||||
"""Check if repository is local
|
"""Checks if repository is local
|
||||||
"""
|
"""
|
||||||
repos_dict = Repo().default_repository()
|
repos_dict = Repo().default_repository()
|
||||||
if repo in repos_dict:
|
if repo in repos_dict:
|
||||||
|
|
|
@ -32,7 +32,7 @@ from slpkg.pkg.find import find_package
|
||||||
|
|
||||||
|
|
||||||
def library(repo):
|
def library(repo):
|
||||||
"""Load packages from slpkg library and from local
|
"""Loads packages from slpkg library and from local
|
||||||
"""
|
"""
|
||||||
utils = Utils()
|
utils = Utils()
|
||||||
pkg_list, packages = [], ""
|
pkg_list, packages = [], ""
|
||||||
|
@ -59,7 +59,7 @@ def library(repo):
|
||||||
|
|
||||||
|
|
||||||
class Regex:
|
class Regex:
|
||||||
"""Grap packages with simple regex using asterisk *
|
"""Graps packages with simple regex using asterisk *
|
||||||
with options: starts with string*
|
with options: starts with string*
|
||||||
ends with *string
|
ends with *string
|
||||||
include *string*
|
include *string*
|
||||||
|
@ -90,7 +90,7 @@ class Regex:
|
||||||
return lib
|
return lib
|
||||||
|
|
||||||
def add(self, repo, pkg):
|
def add(self, repo, pkg):
|
||||||
"""Split packages by repository
|
"""Splits packages by repository
|
||||||
"""
|
"""
|
||||||
if repo == "sbo":
|
if repo == "sbo":
|
||||||
return pkg
|
return pkg
|
||||||
|
|
|
@ -30,8 +30,8 @@ from slpkg.pkg.find import find_package
|
||||||
|
|
||||||
|
|
||||||
def write_deps(deps_dict):
|
def write_deps(deps_dict):
|
||||||
"""Write dependencies in a log file
|
"""Writes dependencies in a log file
|
||||||
into directory `/var/log/slpkg/dep/`
|
into the directory `/var/log/slpkg/dep/`
|
||||||
"""
|
"""
|
||||||
for name, dependencies in deps_dict.items():
|
for name, dependencies in deps_dict.items():
|
||||||
if find_package(f"{name}-", _meta_.pkg_path):
|
if find_package(f"{name}-", _meta_.pkg_path):
|
||||||
|
|
|
@ -25,12 +25,12 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from slpkg.clean import clean_tmp
|
|
||||||
from slpkg.load import Regex
|
from slpkg.load import Regex
|
||||||
from slpkg.desc import PkgDesc
|
from slpkg.desc import PkgDesc
|
||||||
from slpkg.messages import Msg
|
from slpkg.messages import Msg
|
||||||
from slpkg.config import Config
|
from slpkg.config import Config
|
||||||
from slpkg.checks import Updates
|
from slpkg.checks import Updates
|
||||||
|
from slpkg.clean import clean_tmp
|
||||||
from slpkg.repoinfo import RepoInfo
|
from slpkg.repoinfo import RepoInfo
|
||||||
from slpkg.repolist import RepoList
|
from slpkg.repolist import RepoList
|
||||||
from slpkg.repositories import Repo
|
from slpkg.repositories import Repo
|
||||||
|
@ -99,7 +99,7 @@ class ArgParse(BlackList):
|
||||||
"-f", "--find"
|
"-f", "--find"
|
||||||
]
|
]
|
||||||
|
|
||||||
# checking if repositories exists
|
# checking if the repositories exist
|
||||||
enabled_repos = _meta_.repositories
|
enabled_repos = _meta_.repositories
|
||||||
|
|
||||||
if len(self.args) > 1:
|
if len(self.args) > 1:
|
||||||
|
@ -126,7 +126,7 @@ class ArgParse(BlackList):
|
||||||
usage("", 1)
|
usage("", 1)
|
||||||
|
|
||||||
def command_update(self):
|
def command_update(self):
|
||||||
"""Update package lists repositories
|
"""Updates package lists repositories
|
||||||
"""
|
"""
|
||||||
update = Update()
|
update = Update()
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ class ArgParse(BlackList):
|
||||||
usage("", 1)
|
usage("", 1)
|
||||||
|
|
||||||
def command_upgrade(self):
|
def command_upgrade(self):
|
||||||
"""Recreate repositories package lists
|
"""Recreates repositories package lists
|
||||||
"""
|
"""
|
||||||
upgrade = Upgrade()
|
upgrade = Upgrade()
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ class ArgParse(BlackList):
|
||||||
usage("", 1)
|
usage("", 1)
|
||||||
|
|
||||||
def command_repo_add(self):
|
def command_repo_add(self):
|
||||||
"""Add custom repositories
|
"""Adds custom repositories
|
||||||
"""
|
"""
|
||||||
if len(self.args) == 3 and self.args[0] == "repo-add":
|
if len(self.args) == 3 and self.args[0] == "repo-add":
|
||||||
Repo().add(self.args[1], self.args[2])
|
Repo().add(self.args[1], self.args[2])
|
||||||
|
@ -193,7 +193,7 @@ class ArgParse(BlackList):
|
||||||
usage("", 1)
|
usage("", 1)
|
||||||
|
|
||||||
def command_repo_remove(self):
|
def command_repo_remove(self):
|
||||||
"""Remove custom repositories
|
"""Removes custom repositories
|
||||||
"""
|
"""
|
||||||
if len(self.args) == 2 and self.args[0] == "repo-remove":
|
if len(self.args) == 2 and self.args[0] == "repo-remove":
|
||||||
Repo().remove(self.args[1])
|
Repo().remove(self.args[1])
|
||||||
|
@ -214,7 +214,7 @@ class ArgParse(BlackList):
|
||||||
usage("", 1)
|
usage("", 1)
|
||||||
|
|
||||||
def command_health(self):
|
def command_health(self):
|
||||||
"""Check package health
|
"""Checks package health
|
||||||
"""
|
"""
|
||||||
if len(self.args) == 1 and self.args[0] == "health":
|
if len(self.args) == 1 and self.args[0] == "health":
|
||||||
PackageHealth(mode="").test()
|
PackageHealth(mode="").test()
|
||||||
|
@ -225,7 +225,7 @@ class ArgParse(BlackList):
|
||||||
usage("", 1)
|
usage("", 1)
|
||||||
|
|
||||||
def command_deps_status(self):
|
def command_deps_status(self):
|
||||||
"""Print dependencies status
|
"""Prints dependencies status
|
||||||
"""
|
"""
|
||||||
image = ""
|
image = ""
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ class ArgParse(BlackList):
|
||||||
usage("", 1)
|
usage("", 1)
|
||||||
|
|
||||||
def command_new_config(self):
|
def command_new_config(self):
|
||||||
"""Manage .new configuration files
|
"""Manages .new configuration files
|
||||||
"""
|
"""
|
||||||
if len(self.args) == 1 and self.args[0] == "new-config":
|
if len(self.args) == 1 and self.args[0] == "new-config":
|
||||||
NewConfig().run()
|
NewConfig().run()
|
||||||
|
@ -307,7 +307,7 @@ class ArgParse(BlackList):
|
||||||
usage("", 1)
|
usage("", 1)
|
||||||
|
|
||||||
def pkg_upgrade(self):
|
def pkg_upgrade(self):
|
||||||
"""Check and upgrade packages by repository
|
"""Checks and upgrade packages by repository
|
||||||
"""
|
"""
|
||||||
options = [
|
options = [
|
||||||
"-c",
|
"-c",
|
||||||
|
@ -322,7 +322,7 @@ class ArgParse(BlackList):
|
||||||
]
|
]
|
||||||
flag, skip = self.__pkg_upgrade_flags(flags)
|
flag, skip = self.__pkg_upgrade_flags(flags)
|
||||||
|
|
||||||
# Remove --checklist flag from args so that works with
|
# Removes --checklist flag from args so that works with
|
||||||
# both conditions
|
# both conditions
|
||||||
# if flags[3] in self.args:
|
# if flags[3] in self.args:
|
||||||
# self.args.remove(flags[3])
|
# self.args.remove(flags[3])
|
||||||
|
@ -351,7 +351,7 @@ class ArgParse(BlackList):
|
||||||
usage("", 1)
|
usage("", 1)
|
||||||
|
|
||||||
def __pkg_upgrade_flags(self, flags):
|
def __pkg_upgrade_flags(self, flags):
|
||||||
"""Manage flags for package upgrade option
|
"""Manages flags for the package upgrade option
|
||||||
"""
|
"""
|
||||||
# Check for typos or unssuported flags
|
# Check for typos or unssuported flags
|
||||||
for arg in self.args[2:]:
|
for arg in self.args[2:]:
|
||||||
|
@ -373,7 +373,7 @@ class ArgParse(BlackList):
|
||||||
return flag, skip
|
return flag, skip
|
||||||
|
|
||||||
def pkg_install(self):
|
def pkg_install(self):
|
||||||
"""Install packages by repository
|
"""Installs packages by repository
|
||||||
"""
|
"""
|
||||||
flag = []
|
flag = []
|
||||||
options = [
|
options = [
|
||||||
|
@ -451,7 +451,7 @@ class ArgParse(BlackList):
|
||||||
usage("", 1)
|
usage("", 1)
|
||||||
|
|
||||||
def sbo_network(self):
|
def sbo_network(self):
|
||||||
"""View slackbuilds packages
|
"""Views slackbuilds packages
|
||||||
"""
|
"""
|
||||||
flag = []
|
flag = []
|
||||||
options = [
|
options = [
|
||||||
|
@ -479,7 +479,7 @@ class ArgParse(BlackList):
|
||||||
usage("sbo", 1)
|
usage("sbo", 1)
|
||||||
|
|
||||||
def pkg_blacklist(self):
|
def pkg_blacklist(self):
|
||||||
"""Manage blacklist packages
|
"""Manages blacklist packages
|
||||||
"""
|
"""
|
||||||
options = [
|
options = [
|
||||||
"-b",
|
"-b",
|
||||||
|
@ -509,7 +509,7 @@ class ArgParse(BlackList):
|
||||||
usage("", 1)
|
usage("", 1)
|
||||||
|
|
||||||
def pkg_queue(self):
|
def pkg_queue(self):
|
||||||
"""Manage packages in queue
|
"""Manages packages in queue
|
||||||
"""
|
"""
|
||||||
queue = QueuePkgs()
|
queue = QueuePkgs()
|
||||||
options = [
|
options = [
|
||||||
|
@ -555,7 +555,7 @@ class ArgParse(BlackList):
|
||||||
usage("", 1)
|
usage("", 1)
|
||||||
|
|
||||||
def bin_install(self):
|
def bin_install(self):
|
||||||
"""Install Slackware binary packages
|
"""Installs Slackware binary packages
|
||||||
"""
|
"""
|
||||||
packages = self.args[1:]
|
packages = self.args[1:]
|
||||||
options = [
|
options = [
|
||||||
|
@ -583,7 +583,7 @@ class ArgParse(BlackList):
|
||||||
usage("", 1)
|
usage("", 1)
|
||||||
|
|
||||||
def bin_upgrade(self):
|
def bin_upgrade(self):
|
||||||
"""Install-upgrade Slackware binary packages
|
"""Installs, upgrades Slackware binary packages
|
||||||
"""
|
"""
|
||||||
packages = self.args[1:]
|
packages = self.args[1:]
|
||||||
options = [
|
options = [
|
||||||
|
@ -651,7 +651,7 @@ class ArgParse(BlackList):
|
||||||
usage("", 1)
|
usage("", 1)
|
||||||
|
|
||||||
def bin_find(self):
|
def bin_find(self):
|
||||||
"""Find installed packages
|
"""Finds installed packages
|
||||||
"""
|
"""
|
||||||
flag = []
|
flag = []
|
||||||
options = [
|
options = [
|
||||||
|
@ -681,7 +681,7 @@ class ArgParse(BlackList):
|
||||||
usage("", 1)
|
usage("", 1)
|
||||||
|
|
||||||
def pkg_desc(self):
|
def pkg_desc(self):
|
||||||
"""Print slack-desc by repository
|
"""Prints slack-desc by repository
|
||||||
"""
|
"""
|
||||||
options = [
|
options = [
|
||||||
"-p",
|
"-p",
|
||||||
|
@ -722,7 +722,7 @@ class ArgParse(BlackList):
|
||||||
usage("", 1)
|
usage("", 1)
|
||||||
|
|
||||||
def pkg_find(self):
|
def pkg_find(self):
|
||||||
"""Find packages from all enabled repositories
|
"""Finds packages from all the enabled repositories
|
||||||
"""
|
"""
|
||||||
flag = []
|
flag = []
|
||||||
options = [
|
options = [
|
||||||
|
@ -743,7 +743,7 @@ class ArgParse(BlackList):
|
||||||
usage("", 1)
|
usage("", 1)
|
||||||
|
|
||||||
def pkg_contents(self):
|
def pkg_contents(self):
|
||||||
"""Print packages contents
|
"""Prints packages contents
|
||||||
"""
|
"""
|
||||||
packages = self.args[1:]
|
packages = self.args[1:]
|
||||||
options = [
|
options = [
|
||||||
|
@ -757,7 +757,7 @@ class ArgParse(BlackList):
|
||||||
usage("", 1)
|
usage("", 1)
|
||||||
|
|
||||||
def congiguration(self):
|
def congiguration(self):
|
||||||
"""Manage slpkg configuration file
|
"""Manages slpkg configuration file
|
||||||
"""
|
"""
|
||||||
options = [
|
options = [
|
||||||
"-g",
|
"-g",
|
||||||
|
@ -770,7 +770,7 @@ class ArgParse(BlackList):
|
||||||
]
|
]
|
||||||
conf = Config()
|
conf = Config()
|
||||||
if (len(self.args) == 2 and self.args[0] in options
|
if (len(self.args) == 2 and self.args[0] in options
|
||||||
and self.args[1] in options):
|
and self.args[1] in command):
|
||||||
|
|
||||||
if self.args[1] == command[0]:
|
if self.args[1] == command[0]:
|
||||||
conf.view()
|
conf.view()
|
||||||
|
@ -782,7 +782,7 @@ class ArgParse(BlackList):
|
||||||
usage("", 1)
|
usage("", 1)
|
||||||
|
|
||||||
def auto_detect(self, args):
|
def auto_detect(self, args):
|
||||||
"""Check for already Slackware binary packages exist
|
"""Checks for already Slackware binary packages
|
||||||
"""
|
"""
|
||||||
suffixes = [
|
suffixes = [
|
||||||
".tgz",
|
".tgz",
|
||||||
|
|
|
@ -39,23 +39,15 @@ class Msg:
|
||||||
self.endc = _meta_.color["ENDC"]
|
self.endc = _meta_.color["ENDC"]
|
||||||
|
|
||||||
def pkg_not_found(self, bol, pkg, message, eol):
|
def pkg_not_found(self, bol, pkg, message, eol):
|
||||||
"""Print message when package not found
|
|
||||||
"""
|
|
||||||
print(f"{bol}No such package {pkg}: {message}{eol}")
|
print(f"{bol}No such package {pkg}: {message}{eol}")
|
||||||
|
|
||||||
def pkg_found(self, prgnam):
|
def pkg_found(self, prgnam):
|
||||||
"""Print message when package found
|
|
||||||
"""
|
|
||||||
print(f"| Package {prgnam} is already installed")
|
print(f"| Package {prgnam} is already installed")
|
||||||
|
|
||||||
def pkg_installed(self, pkg):
|
def pkg_installed(self, pkg):
|
||||||
"""Print message when package installed
|
|
||||||
"""
|
|
||||||
print(f"| Package {pkg} installed")
|
print(f"| Package {pkg} installed")
|
||||||
|
|
||||||
def build_FAILED(self, prgnam):
|
def build_FAILED(self, prgnam):
|
||||||
"""Print error message if build failed
|
|
||||||
"""
|
|
||||||
self.template(78)
|
self.template(78)
|
||||||
print(f"| Some error on the package {prgnam} "
|
print(f"| Some error on the package {prgnam} "
|
||||||
f"[ {self.red}FAILED{self.endc} ]")
|
f"[ {self.red}FAILED{self.endc} ]")
|
||||||
|
@ -67,59 +59,41 @@ class Msg:
|
||||||
print() # new line at end
|
print() # new line at end
|
||||||
|
|
||||||
def template(self, max_len):
|
def template(self, max_len):
|
||||||
"""Print template
|
|
||||||
"""
|
|
||||||
print("+" + "=" * max_len)
|
print("+" + "=" * max_len)
|
||||||
|
|
||||||
def checking(self):
|
def checking(self):
|
||||||
"""Message checking
|
|
||||||
"""
|
|
||||||
print(f"{self.grey}Checking...{self.endc} ", end="", flush=True)
|
print(f"{self.grey}Checking...{self.endc} ", end="", flush=True)
|
||||||
|
|
||||||
def reading(self):
|
def reading(self):
|
||||||
"""Message reading
|
|
||||||
"""
|
|
||||||
print(f"{self.grey}Reading package lists...{self.endc} ",
|
print(f"{self.grey}Reading package lists...{self.endc} ",
|
||||||
end="", flush=True)
|
end="", flush=True)
|
||||||
|
|
||||||
def resolving(self):
|
def resolving(self):
|
||||||
"""Message resolving
|
|
||||||
"""
|
|
||||||
print(f"{self.grey}Resolving dependencies...{self.endc} ",
|
print(f"{self.grey}Resolving dependencies...{self.endc} ",
|
||||||
end="", flush=True)
|
end="", flush=True)
|
||||||
|
|
||||||
def done(self):
|
def done(self):
|
||||||
"""Message done
|
|
||||||
"""
|
|
||||||
print(f"\b{self.green}Done{self.endc}\n", end="")
|
print(f"\b{self.green}Done{self.endc}\n", end="")
|
||||||
|
|
||||||
def pkg(self, count):
|
def pkg(self, count):
|
||||||
"""Print singular plural
|
|
||||||
"""
|
|
||||||
message = "package"
|
message = "package"
|
||||||
if count > 1:
|
if count > 1:
|
||||||
message = message + "s"
|
message = message + "s"
|
||||||
return message
|
return message
|
||||||
|
|
||||||
def not_found(self, if_upgrade):
|
def not_found(self, if_upgrade):
|
||||||
"""Message not found packages
|
|
||||||
"""
|
|
||||||
if if_upgrade:
|
if if_upgrade:
|
||||||
print("\nNot found packages for upgrade\n")
|
print("\nNot found packages for upgrade\n")
|
||||||
else:
|
else:
|
||||||
print("\nNot found packages for installation\n")
|
print("\nNot found packages for installation\n")
|
||||||
|
|
||||||
def upg_inst(self, if_upgrade):
|
def upg_inst(self, if_upgrade):
|
||||||
"""Message installing or upgrading
|
|
||||||
"""
|
|
||||||
if not if_upgrade:
|
if not if_upgrade:
|
||||||
print("Installing:")
|
print("Installing:")
|
||||||
else:
|
else:
|
||||||
print("Upgrading:")
|
print("Upgrading:")
|
||||||
|
|
||||||
def answer(self):
|
def answer(self):
|
||||||
"""Message answer
|
|
||||||
"""
|
|
||||||
if self.meta.default_answer in ["y", "Y"]:
|
if self.meta.default_answer in ["y", "Y"]:
|
||||||
answer = self.meta.default_answer
|
answer = self.meta.default_answer
|
||||||
else:
|
else:
|
||||||
|
@ -130,8 +104,6 @@ class Msg:
|
||||||
return answer
|
return answer
|
||||||
|
|
||||||
def security_pkg(self, pkg):
|
def security_pkg(self, pkg):
|
||||||
"""Warning message for some special reasons
|
|
||||||
"""
|
|
||||||
print()
|
print()
|
||||||
self.template(78)
|
self.template(78)
|
||||||
print(f"| {' ' * 27}{self.red}*** WARNING ***{self.endc}")
|
print(f"| {' ' * 27}{self.red}*** WARNING ***{self.endc}")
|
||||||
|
@ -143,9 +115,6 @@ class Msg:
|
||||||
print()
|
print()
|
||||||
|
|
||||||
def reference(self, install, upgrade):
|
def reference(self, install, upgrade):
|
||||||
"""Reference list with packages installed
|
|
||||||
and upgraded
|
|
||||||
"""
|
|
||||||
self.template(78)
|
self.template(78)
|
||||||
print(f"| Total {len(install)} {self.pkg(len(install))} installed and "
|
print(f"| Total {len(install)} {self.pkg(len(install))} installed and "
|
||||||
f"{len(upgrade)} {self.pkg(len(upgrade))} upgraded")
|
f"{len(upgrade)} {self.pkg(len(upgrade))} upgraded")
|
||||||
|
@ -159,8 +128,6 @@ class Msg:
|
||||||
print()
|
print()
|
||||||
|
|
||||||
def matching(self, packages):
|
def matching(self, packages):
|
||||||
"""Message for matching packages
|
|
||||||
"""
|
|
||||||
print(f"\nNot found package with the name "
|
print(f"\nNot found package with the name "
|
||||||
f"[ {self.cyan}{''.join(packages)}{self.endc} ]. "
|
f"[ {self.cyan}{''.join(packages)}{self.endc} ]. "
|
||||||
"Matching packages:\nNOTE: Not dependencies are resolved\n")
|
"Matching packages:\nNOTE: Not dependencies are resolved\n")
|
||||||
|
|
0
slpkg/models/__init.py__
Normal file
0
slpkg/models/__init.py__
Normal file
103
slpkg/models/models.py
Normal file
103
slpkg/models/models.py
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# models.py file is part of slpkg.
|
||||||
|
|
||||||
|
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
|
||||||
|
# All rights reserved.
|
||||||
|
|
||||||
|
# Slpkg is a user-friendly package manager for Slackware installations
|
||||||
|
|
||||||
|
# https://gitlab.com/dslackw/slpkg
|
||||||
|
|
||||||
|
# Slpkg is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
import sqlite3
|
||||||
|
from progress.bar import Bar
|
||||||
|
from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
|
class Database:
|
||||||
|
|
||||||
|
def __init__(self, table_name, text_file):
|
||||||
|
self.lib_path = _meta_.lib_path
|
||||||
|
self.table_name = table_name
|
||||||
|
self.text_file = text_file
|
||||||
|
self.db = _meta_.db
|
||||||
|
self.con = sqlite3.connect(f"{self.lib_path}{self.db}")
|
||||||
|
self.cur = self.con.cursor()
|
||||||
|
|
||||||
|
def table_exists(self):
|
||||||
|
"""Checking if the table exists
|
||||||
|
"""
|
||||||
|
self.cur.execute("""SELECT count(name)
|
||||||
|
FROM sqlite_master
|
||||||
|
WHERE type='table'
|
||||||
|
AND name='{}'""".format(self.table_name))
|
||||||
|
return self.cur.fetchone()[0]
|
||||||
|
|
||||||
|
def create_sbo_table(self):
|
||||||
|
self.cur.execute("""CREATE TABLE IF NOT EXISTS {}
|
||||||
|
(name text, location text, files text, version text,
|
||||||
|
download text, download64 text, md5sum text,
|
||||||
|
md5sum64 text, requires text, short_desc text)
|
||||||
|
""".format(self.table_name))
|
||||||
|
self.con.commit()
|
||||||
|
|
||||||
|
def insert_sbo_table(self):
|
||||||
|
"""Grabbing data line by line and inserting them into the database
|
||||||
|
"""
|
||||||
|
self.sbo = [
|
||||||
|
"SLACKBUILD NAME:",
|
||||||
|
"SLACKBUILD LOCATION:",
|
||||||
|
"SLACKBUILD FILES:",
|
||||||
|
"SLACKBUILD VERSION:",
|
||||||
|
"SLACKBUILD DOWNLOAD:",
|
||||||
|
"SLACKBUILD DOWNLOAD_x86_64:",
|
||||||
|
"SLACKBUILD MD5SUM:",
|
||||||
|
"SLACKBUILD MD5SUM_x86_64:",
|
||||||
|
"SLACKBUILD REQUIRES:",
|
||||||
|
"SLACKBUILD SHORT DESCRIPTION:"
|
||||||
|
]
|
||||||
|
|
||||||
|
sbo_file = self.open_file(f"{self.lib_path}sbo_repo/SLACKBUILDS.TXT")
|
||||||
|
|
||||||
|
bar = Bar("Creating sbo database", max=len(sbo_file),
|
||||||
|
suffix="%(percent)d%% - %(eta)ds")
|
||||||
|
|
||||||
|
cache = [] # init cache
|
||||||
|
|
||||||
|
for i, line in enumerate(sbo_file, 1):
|
||||||
|
|
||||||
|
for s in self.sbo:
|
||||||
|
if line.startswith(s):
|
||||||
|
line = line.replace(s, "").strip()
|
||||||
|
cache.append(line)
|
||||||
|
|
||||||
|
if (i % 11) == 0:
|
||||||
|
values = [
|
||||||
|
(cache[0], cache[1], cache[2], cache[3], cache[4],
|
||||||
|
cache[5], cache[6], cache[7], cache[8], cache[9]),
|
||||||
|
]
|
||||||
|
self.cur.executemany("""INSERT INTO {} VALUES
|
||||||
|
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""".format(
|
||||||
|
self.table_name), values)
|
||||||
|
self.con.commit()
|
||||||
|
cache = [] # reset cache after 11 lines
|
||||||
|
bar.next()
|
||||||
|
bar.finish()
|
||||||
|
self.con.close()
|
||||||
|
|
||||||
|
def open_file(self, file):
|
||||||
|
with open(file, "r", encoding="utf-8") as f:
|
||||||
|
return f.readlines()
|
|
@ -32,7 +32,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
class NewConfig(Utils):
|
class NewConfig(Utils):
|
||||||
"""Manage .new configuration files
|
"""Manages .new configuration files
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
|
@ -47,7 +47,7 @@ class NewConfig(Utils):
|
||||||
self.news = []
|
self.news = []
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""print .new configuration files
|
"""prints .new configuration files
|
||||||
"""
|
"""
|
||||||
self.find_new()
|
self.find_new()
|
||||||
for n in self.news:
|
for n in self.news:
|
||||||
|
@ -59,7 +59,7 @@ class NewConfig(Utils):
|
||||||
self.choices()
|
self.choices()
|
||||||
|
|
||||||
def find_new(self):
|
def find_new(self):
|
||||||
"""Find all '.new' files from /etc/ folder
|
"""Finds all '.new' files from /etc/ folder
|
||||||
and subfolders
|
and subfolders
|
||||||
"""
|
"""
|
||||||
print("Search for .new configuration files:\n")
|
print("Search for .new configuration files:\n")
|
||||||
|
@ -97,14 +97,14 @@ class NewConfig(Utils):
|
||||||
self.prompt()
|
self.prompt()
|
||||||
|
|
||||||
def overwrite_all(self):
|
def overwrite_all(self):
|
||||||
"""Overwrite all .new files and keep
|
"""Overwrites all .new files and keep
|
||||||
old with suffix .old
|
old with suffix .old
|
||||||
"""
|
"""
|
||||||
for n in self.news:
|
for n in self.news:
|
||||||
self._overwrite(n)
|
self._overwrite(n)
|
||||||
|
|
||||||
def remove_all(self):
|
def remove_all(self):
|
||||||
"""Remove all .new files
|
"""Removes all .new files
|
||||||
"""
|
"""
|
||||||
for n in self.news:
|
for n in self.news:
|
||||||
self._remove(n)
|
self._remove(n)
|
||||||
|
@ -131,7 +131,7 @@ class NewConfig(Utils):
|
||||||
raise SystemExit("\n")
|
raise SystemExit("\n")
|
||||||
|
|
||||||
def question(self, n):
|
def question(self, n):
|
||||||
"""Choose what do to file by file
|
"""Chooses what do to file by file
|
||||||
"""
|
"""
|
||||||
print()
|
print()
|
||||||
prompt_ask = input(f"{n} [K/O/R/D/M/Q]? ")
|
prompt_ask = input(f"{n} [K/O/R/D/M/Q]? ")
|
||||||
|
@ -151,7 +151,7 @@ class NewConfig(Utils):
|
||||||
self.quit()
|
self.quit()
|
||||||
|
|
||||||
def _remove(self, n):
|
def _remove(self, n):
|
||||||
"""Remove one single file
|
"""Removes one single file
|
||||||
"""
|
"""
|
||||||
if os.path.isfile(n):
|
if os.path.isfile(n):
|
||||||
os.remove(n)
|
os.remove(n)
|
||||||
|
@ -159,7 +159,7 @@ class NewConfig(Utils):
|
||||||
print(f"File '{n}' removed")
|
print(f"File '{n}' removed")
|
||||||
|
|
||||||
def _overwrite(self, n):
|
def _overwrite(self, n):
|
||||||
"""Overwrite old file with new and keep file with suffix .old
|
"""Overwrites old file with new and keep file with suffix .old
|
||||||
"""
|
"""
|
||||||
if os.path.isfile(n[:-4]):
|
if os.path.isfile(n[:-4]):
|
||||||
shutil.copy2(n[:-4], n[:-4] + ".old")
|
shutil.copy2(n[:-4], n[:-4] + ".old")
|
||||||
|
@ -174,7 +174,7 @@ class NewConfig(Utils):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def diff(self, n):
|
def diff(self, n):
|
||||||
"""Print the differences between the two files
|
"""Prints the differences between the two files
|
||||||
"""
|
"""
|
||||||
if os.path.isfile(n[:-4]):
|
if os.path.isfile(n[:-4]):
|
||||||
diff1 = self.read_file(n[:-4]).splitlines()
|
diff1 = self.read_file(n[:-4]).splitlines()
|
||||||
|
@ -203,7 +203,7 @@ class NewConfig(Utils):
|
||||||
lines.append(a)
|
lines.append(a)
|
||||||
|
|
||||||
def merge(self, n):
|
def merge(self, n):
|
||||||
"""Merge new file into old
|
"""Merges new file into old
|
||||||
"""
|
"""
|
||||||
if os.path.isfile(n[:-4]):
|
if os.path.isfile(n[:-4]):
|
||||||
old = self.read_file(n[:-4]).splitlines()
|
old = self.read_file(n[:-4]).splitlines()
|
||||||
|
|
|
@ -41,7 +41,7 @@ from slpkg.sbo.greps import SBoGrep
|
||||||
|
|
||||||
|
|
||||||
class BuildPackage(Utils):
|
class BuildPackage(Utils):
|
||||||
"""Build SBo packages from source
|
"""Builds SBo packages from source
|
||||||
"""
|
"""
|
||||||
def __init__(self, script, sources, path, auto):
|
def __init__(self, script, sources, path, auto):
|
||||||
self.script = script
|
self.script = script
|
||||||
|
@ -66,10 +66,9 @@ class BuildPackage(Utils):
|
||||||
os.mkdir(self.build_logs)
|
os.mkdir(self.build_logs)
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
"""
|
"""Builds package from source and creates log
|
||||||
Build package from source and create log
|
|
||||||
file in path /var/log/slpkg/sbo/build_logs/.
|
file in path /var/log/slpkg/sbo/build_logs/.
|
||||||
Also check md5sum calculates.
|
Also checks the md5sum calculation.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
self._delete_dir()
|
self._delete_dir()
|
||||||
|
@ -115,7 +114,7 @@ class BuildPackage(Utils):
|
||||||
self.msg.pkg_not_found("\n", self.prgnam, "Wrong file", "\n")
|
self.msg.pkg_not_found("\n", self.prgnam, "Wrong file", "\n")
|
||||||
|
|
||||||
def _check_sources(self):
|
def _check_sources(self):
|
||||||
"""Fix filenames with char +
|
"""Fixes filenames with char +
|
||||||
"""
|
"""
|
||||||
new_sources = []
|
new_sources = []
|
||||||
for src in self.sources:
|
for src in self.sources:
|
||||||
|
@ -123,7 +122,7 @@ class BuildPackage(Utils):
|
||||||
self.sources = new_sources
|
self.sources = new_sources
|
||||||
|
|
||||||
def _create_md5_dict(self):
|
def _create_md5_dict(self):
|
||||||
"""Create md5 dictionary per source
|
"""Creates md5 dictionary per source
|
||||||
"""
|
"""
|
||||||
self.sbo_md5 = {}
|
self.sbo_md5 = {}
|
||||||
md5_lists = SBoGrep(self.prgnam).checksum()
|
md5_lists = SBoGrep(self.prgnam).checksum()
|
||||||
|
@ -131,7 +130,7 @@ class BuildPackage(Utils):
|
||||||
self.sbo_md5[src] = md5
|
self.sbo_md5[src] = md5
|
||||||
|
|
||||||
def _makeflags(self):
|
def _makeflags(self):
|
||||||
"""Set variable MAKEFLAGS with the numbers of
|
"""Sets variable MAKEFLAGS with the numbers of
|
||||||
processors
|
processors
|
||||||
"""
|
"""
|
||||||
if self.meta.makeflags in ["on", "ON"]:
|
if self.meta.makeflags in ["on", "ON"]:
|
||||||
|
@ -139,7 +138,7 @@ class BuildPackage(Utils):
|
||||||
os.environ["MAKEFLAGS"] = f"-j{cpus}"
|
os.environ["MAKEFLAGS"] = f"-j{cpus}"
|
||||||
|
|
||||||
def _pass_variable(self):
|
def _pass_variable(self):
|
||||||
"""Return enviroment variables
|
"""Returns enviroment variables
|
||||||
"""
|
"""
|
||||||
pass_var = []
|
pass_var = []
|
||||||
for var in os.environ.keys():
|
for var in os.environ.keys():
|
||||||
|
@ -149,21 +148,20 @@ class BuildPackage(Utils):
|
||||||
return pass_var
|
return pass_var
|
||||||
|
|
||||||
def _delete_sbo_tar_gz(self):
|
def _delete_sbo_tar_gz(self):
|
||||||
"""Delete slackbuild tar.gz file after untar
|
"""Deletes slackbuild tar.gz file after untar
|
||||||
"""
|
"""
|
||||||
if not self.auto and os.path.isfile(self.meta.build_path + self.script):
|
if not self.auto and os.path.isfile(self.meta.build_path + self.script):
|
||||||
os.remove(self.meta.build_path + self.script)
|
os.remove(self.meta.build_path + self.script)
|
||||||
|
|
||||||
def _delete_dir(self):
|
def _delete_dir(self):
|
||||||
"""Delete old folder if exists before start build
|
"""Deletes old folder if exists before start build
|
||||||
"""
|
"""
|
||||||
if not self.auto and os.path.isdir(self.meta.build_path + self.prgnam):
|
if not self.auto and os.path.isdir(self.meta.build_path + self.prgnam):
|
||||||
shutil.rmtree(self.meta.build_path + self.prgnam)
|
shutil.rmtree(self.meta.build_path + self.prgnam)
|
||||||
|
|
||||||
|
|
||||||
def log_head(path, log_file, log_time):
|
def log_head(path, log_file, log_time):
|
||||||
"""
|
"""Writes headers to log file
|
||||||
write headers to log file
|
|
||||||
"""
|
"""
|
||||||
with open(path + log_file, "w") as log:
|
with open(path + log_file, "w") as log:
|
||||||
log.write("#" * 79 + "\n\n")
|
log.write("#" * 79 + "\n\n")
|
||||||
|
@ -175,8 +173,7 @@ def log_head(path, log_file, log_time):
|
||||||
|
|
||||||
|
|
||||||
def log_end(path, log_file, sum_time):
|
def log_end(path, log_file, sum_time):
|
||||||
"""
|
"""Appends END tag to a log file
|
||||||
append END tag to a log file
|
|
||||||
"""
|
"""
|
||||||
with open(path + log_file, "a") as log:
|
with open(path + log_file, "a") as log:
|
||||||
log.seek(2)
|
log.seek(2)
|
||||||
|
@ -188,8 +185,7 @@ def log_end(path, log_file, sum_time):
|
||||||
|
|
||||||
|
|
||||||
def build_time(start_time):
|
def build_time(start_time):
|
||||||
"""
|
"""Calculates build time per package
|
||||||
Calculate build time per package
|
|
||||||
"""
|
"""
|
||||||
diff_time = round(time.time() - start_time, 2)
|
diff_time = round(time.time() - start_time, 2)
|
||||||
if diff_time <= 59.99:
|
if diff_time <= 59.99:
|
||||||
|
|
|
@ -29,7 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
class GetFromInstalled:
|
class GetFromInstalled:
|
||||||
"""Find and return version and package name from
|
"""Finds and returns version and package name from
|
||||||
already installed packages
|
already installed packages
|
||||||
"""
|
"""
|
||||||
def __init__(self, package):
|
def __init__(self, package):
|
||||||
|
@ -42,14 +42,14 @@ class GetFromInstalled:
|
||||||
self.find = file
|
self.find = file
|
||||||
|
|
||||||
def version(self):
|
def version(self):
|
||||||
"""Return version from installed packages
|
"""Returns version from installed packages
|
||||||
"""
|
"""
|
||||||
if self.find:
|
if self.find:
|
||||||
return split_package(self.find)[1]
|
return split_package(self.find)[1]
|
||||||
return self.find
|
return self.find
|
||||||
|
|
||||||
def name(self):
|
def name(self):
|
||||||
"""Return installed package name
|
"""Returns installed package name
|
||||||
"""
|
"""
|
||||||
if self.find:
|
if self.find:
|
||||||
return self.package
|
return self.package
|
||||||
|
|
|
@ -58,7 +58,7 @@ class PackageManager(Utils):
|
||||||
self.unit = "Kb"
|
self.unit = "Kb"
|
||||||
|
|
||||||
def install(self, flag):
|
def install(self, flag):
|
||||||
"""Install Slackware binary packages
|
"""Installs Slackware binary packages
|
||||||
"""
|
"""
|
||||||
for pkg in self.binary:
|
for pkg in self.binary:
|
||||||
try:
|
try:
|
||||||
|
@ -73,7 +73,7 @@ class PackageManager(Utils):
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
|
|
||||||
def upgrade(self, flag):
|
def upgrade(self, flag):
|
||||||
"""Upgrade Slackware binary packages with new
|
"""Upgrades Slackware binary packages with new
|
||||||
"""
|
"""
|
||||||
for pkg in self.binary:
|
for pkg in self.binary:
|
||||||
try:
|
try:
|
||||||
|
@ -95,7 +95,7 @@ class PackageManager(Utils):
|
||||||
self.msg.pkg_not_found(bol, pkg, message, eol)
|
self.msg.pkg_not_found(bol, pkg, message, eol)
|
||||||
|
|
||||||
def remove(self, flag, extra):
|
def remove(self, flag, extra):
|
||||||
"""Remove Slackware binary packages
|
"""Removes Slackware binary packages
|
||||||
"""
|
"""
|
||||||
self.flag = flag
|
self.flag = flag
|
||||||
self.extra = extra
|
self.extra = extra
|
||||||
|
@ -120,10 +120,9 @@ class PackageManager(Utils):
|
||||||
if remove_pkg in ["y", "Y"]:
|
if remove_pkg in ["y", "Y"]:
|
||||||
self._check_if_used(self.binary)
|
self._check_if_used(self.binary)
|
||||||
for rmv in self.removed:
|
for rmv in self.removed:
|
||||||
'''
|
'''If package build and install with "slpkg -s sbo <package>"
|
||||||
If package build and install with "slpkg -s sbo <package>"
|
then looks in the log file for dependencies "/var/log/slpkg/dep",
|
||||||
then look log file for dependencies in /var/log/slpkg/dep,
|
reads and removes all but remove only the package.
|
||||||
read and remove all else remove only the package.
|
|
||||||
'''
|
'''
|
||||||
if (os.path.isfile(self.dep_path + rmv) and
|
if (os.path.isfile(self.dep_path + rmv) and
|
||||||
self.meta.del_deps in ["on", "ON"] or
|
self.meta.del_deps in ["on", "ON"] or
|
||||||
|
@ -141,7 +140,7 @@ class PackageManager(Utils):
|
||||||
self._reference_rmvs(rmv_list)
|
self._reference_rmvs(rmv_list)
|
||||||
|
|
||||||
def _rmv_deps_answer(self):
|
def _rmv_deps_answer(self):
|
||||||
"""Remove dependencies answer
|
"""Removes dependencies answer
|
||||||
"""
|
"""
|
||||||
if self.meta.remove_deps_answer in ["y", "Y"]:
|
if self.meta.remove_deps_answer in ["y", "Y"]:
|
||||||
remove_dep = self.meta.remove_deps_answer
|
remove_dep = self.meta.remove_deps_answer
|
||||||
|
@ -156,7 +155,7 @@ class PackageManager(Utils):
|
||||||
return remove_dep
|
return remove_dep
|
||||||
|
|
||||||
def _get_removed(self):
|
def _get_removed(self):
|
||||||
"""Manage removed packages by extra options
|
"""Manages removed packages by extra options
|
||||||
"""
|
"""
|
||||||
extra = self.extra
|
extra = self.extra
|
||||||
removed, packages, pkg = [], [], ""
|
removed, packages, pkg = [], [], ""
|
||||||
|
@ -195,7 +194,7 @@ class PackageManager(Utils):
|
||||||
return removed, packages
|
return removed, packages
|
||||||
|
|
||||||
def _view_removed(self):
|
def _view_removed(self):
|
||||||
"""View packages before removed
|
"""Views packages before removed
|
||||||
"""
|
"""
|
||||||
print("Packages with name matching [ {0}{1}{2} ]\n".format(
|
print("Packages with name matching [ {0}{1}{2} ]\n".format(
|
||||||
self.cyan, ", ".join(self.binary), self.endc))
|
self.cyan, ", ".join(self.binary), self.endc))
|
||||||
|
@ -248,7 +247,7 @@ class PackageManager(Utils):
|
||||||
self.grey, round(self.size, 2), self.unit, self.endc))
|
self.grey, round(self.size, 2), self.unit, self.endc))
|
||||||
|
|
||||||
def _view_deps(self, path, package):
|
def _view_deps(self, path, package):
|
||||||
"""View dependencies before remove
|
"""Views dependencies before remove
|
||||||
"""
|
"""
|
||||||
self.size = 0
|
self.size = 0
|
||||||
packages = []
|
packages = []
|
||||||
|
@ -297,7 +296,7 @@ class PackageManager(Utils):
|
||||||
raise SystemExit(er)
|
raise SystemExit(er)
|
||||||
|
|
||||||
def _rmv_deps(self, dependencies, package):
|
def _rmv_deps(self, dependencies, package):
|
||||||
"""Remove dependencies
|
"""Removes dependencies
|
||||||
"""
|
"""
|
||||||
removes = []
|
removes = []
|
||||||
dependencies.append(package)
|
dependencies.append(package)
|
||||||
|
@ -310,7 +309,7 @@ class PackageManager(Utils):
|
||||||
return removes
|
return removes
|
||||||
|
|
||||||
def _rmv_pkg(self, package):
|
def _rmv_pkg(self, package):
|
||||||
"""Remove one signle package
|
"""Removes one signle package
|
||||||
"""
|
"""
|
||||||
removes = []
|
removes = []
|
||||||
if GetFromInstalled(package).name() and package not in self.skip:
|
if GetFromInstalled(package).name() and package not in self.skip:
|
||||||
|
@ -335,7 +334,7 @@ class PackageManager(Utils):
|
||||||
self.removed.remove(s)
|
self.removed.remove(s)
|
||||||
|
|
||||||
def _check_if_used(self, removes):
|
def _check_if_used(self, removes):
|
||||||
"""Check package if dependencies for another package
|
"""Checks package if dependencies for another package
|
||||||
before removed"""
|
before removed"""
|
||||||
if "--check-deps" in self.extra:
|
if "--check-deps" in self.extra:
|
||||||
package, dependency, pkg_dep = [], [], []
|
package, dependency, pkg_dep = [], [], []
|
||||||
|
@ -387,7 +386,7 @@ class PackageManager(Utils):
|
||||||
print() # new line at end
|
print() # new line at end
|
||||||
|
|
||||||
def find(self, flag):
|
def find(self, flag):
|
||||||
"""Find installed Slackware packages
|
"""Finds installed Slackware packages
|
||||||
"""
|
"""
|
||||||
matching, packages = 0, []
|
matching, packages = 0, []
|
||||||
pkg_cache, match_cache = "", ""
|
pkg_cache, match_cache = "", ""
|
||||||
|
@ -447,7 +446,7 @@ class PackageManager(Utils):
|
||||||
break
|
break
|
||||||
|
|
||||||
def display(self):
|
def display(self):
|
||||||
"""Print the Slackware packages contents
|
"""Prints the Slackware packages contents
|
||||||
"""
|
"""
|
||||||
for pkg in self.binary:
|
for pkg in self.binary:
|
||||||
name = GetFromInstalled(pkg).name()
|
name = GetFromInstalled(pkg).name()
|
||||||
|
@ -502,7 +501,7 @@ class PackageManager(Utils):
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
|
|
||||||
def _splitting_packages(self, pkg, repo, name):
|
def _splitting_packages(self, pkg, repo, name):
|
||||||
"""Return package name from repositories
|
"""Returns package name from repositories
|
||||||
"""
|
"""
|
||||||
if name and repo != "sbo":
|
if name and repo != "sbo":
|
||||||
pkg = split_package(pkg)[0]
|
pkg = split_package(pkg)[0]
|
||||||
|
@ -511,7 +510,7 @@ class PackageManager(Utils):
|
||||||
return pkg
|
return pkg
|
||||||
|
|
||||||
def list_greps(self, repo, packages):
|
def list_greps(self, repo, packages):
|
||||||
"""Grep packages
|
"""Grabs packages
|
||||||
"""
|
"""
|
||||||
pkg_list, pkg_size = [], []
|
pkg_list, pkg_size = [], []
|
||||||
for line in packages.splitlines():
|
for line in packages.splitlines():
|
||||||
|
@ -529,7 +528,7 @@ class PackageManager(Utils):
|
||||||
return pkg_list, pkg_size
|
return pkg_list, pkg_size
|
||||||
|
|
||||||
def list_lib(self, repo):
|
def list_lib(self, repo):
|
||||||
"""Return package lists
|
"""Returns package lists
|
||||||
"""
|
"""
|
||||||
packages = ""
|
packages = ""
|
||||||
if repo == "sbo":
|
if repo == "sbo":
|
||||||
|
@ -545,7 +544,7 @@ class PackageManager(Utils):
|
||||||
return packages
|
return packages
|
||||||
|
|
||||||
def list_color_tag(self, pkg):
|
def list_color_tag(self, pkg):
|
||||||
"""Tag with color installed packages
|
"""Tag with colour installed packages
|
||||||
"""
|
"""
|
||||||
name = GetFromInstalled(pkg).name()
|
name = GetFromInstalled(pkg).name()
|
||||||
find = f"{name}-"
|
find = f"{name}-"
|
||||||
|
@ -556,7 +555,7 @@ class PackageManager(Utils):
|
||||||
return pkg
|
return pkg
|
||||||
|
|
||||||
def list_of_installed(self, repo, name):
|
def list_of_installed(self, repo, name):
|
||||||
"""Return installed packages
|
"""Returns installed packages
|
||||||
"""
|
"""
|
||||||
all_installed_names = []
|
all_installed_names = []
|
||||||
all_installed_packages = find_package("", self.meta.pkg_path)
|
all_installed_packages = find_package("", self.meta.pkg_path)
|
||||||
|
@ -573,7 +572,7 @@ class PackageManager(Utils):
|
||||||
|
|
||||||
|
|
||||||
def alien_filter(packages, sizes):
|
def alien_filter(packages, sizes):
|
||||||
"""This filter avoid list double packages from
|
"""This filter avoids listing double packages from
|
||||||
alien repository
|
alien repository
|
||||||
"""
|
"""
|
||||||
cache, npkg, nsize = [], [], []
|
cache, npkg, nsize = [], [], []
|
||||||
|
|
|
@ -29,7 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
class FindFromRepos:
|
class FindFromRepos:
|
||||||
"""Find packages from all enabled repositories
|
"""Finds packages from all enabled repositories
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.cache = ""
|
self.cache = ""
|
||||||
|
@ -44,7 +44,7 @@ class FindFromRepos:
|
||||||
self.endc = self.meta.color["ENDC"]
|
self.endc = self.meta.color["ENDC"]
|
||||||
|
|
||||||
def find(self, pkg, flag):
|
def find(self, pkg, flag):
|
||||||
"""Start to find packages and print
|
"""Starts to find packages and print
|
||||||
"""
|
"""
|
||||||
print(f"Packages with name matching [ {self.cyan}"
|
print(f"Packages with name matching [ {self.cyan}"
|
||||||
f"{', '.join(pkg)}{self.endc} ]\n")
|
f"{', '.join(pkg)}{self.endc} ]\n")
|
||||||
|
@ -78,8 +78,7 @@ class FindFromRepos:
|
||||||
f"{self.count_repo} repositories.{self.endc}\n")
|
f"{self.count_repo} repositories.{self.endc}\n")
|
||||||
|
|
||||||
def sbo_version(self, repo, find):
|
def sbo_version(self, repo, find):
|
||||||
"""
|
"""Adds version to SBo packages
|
||||||
Add version to SBo packages
|
|
||||||
"""
|
"""
|
||||||
ver = ""
|
ver = ""
|
||||||
if repo == "sbo":
|
if repo == "sbo":
|
||||||
|
|
|
@ -30,7 +30,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
def delete_package(path, packages):
|
def delete_package(path, packages):
|
||||||
"""Delete downloaded packages
|
"""Deletes downloaded packages
|
||||||
"""
|
"""
|
||||||
if _meta_.del_all in ["on", "ON"]:
|
if _meta_.del_all in ["on", "ON"]:
|
||||||
for pkg in packages:
|
for pkg in packages:
|
||||||
|
@ -38,7 +38,7 @@ def delete_package(path, packages):
|
||||||
|
|
||||||
|
|
||||||
def delete_folder(folder):
|
def delete_folder(folder):
|
||||||
"""Delete folder with all files.
|
"""Deletes folder with all files.
|
||||||
"""
|
"""
|
||||||
if _meta_.del_folder in ["on", "ON"] and os.path.exists(folder):
|
if _meta_.del_folder in ["on", "ON"] and os.path.exists(folder):
|
||||||
shutil.rmtree(folder)
|
shutil.rmtree(folder)
|
||||||
|
|
|
@ -31,7 +31,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
class RepoEnable(Utils):
|
class RepoEnable(Utils):
|
||||||
"""Read repositories.conf file and update with new enabled or
|
"""Reads repositories.conf file and update with new enabled or
|
||||||
disabled repositories
|
disabled repositories
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -77,7 +77,7 @@ Keys: SPACE select or deselect the highlighted repositories,
|
||||||
self.reference()
|
self.reference()
|
||||||
|
|
||||||
def read_enabled(self):
|
def read_enabled(self):
|
||||||
"""Read enable repositories
|
"""Reads enabled repositories
|
||||||
"""
|
"""
|
||||||
for line in self.conf.splitlines():
|
for line in self.conf.splitlines():
|
||||||
line = line.lstrip()
|
line = line.lstrip()
|
||||||
|
@ -89,7 +89,7 @@ Keys: SPACE select or deselect the highlighted repositories,
|
||||||
self.tag_line = False
|
self.tag_line = False
|
||||||
|
|
||||||
def read_disabled(self):
|
def read_disabled(self):
|
||||||
"""Read disable repositories
|
"""Reads disabled repositories
|
||||||
"""
|
"""
|
||||||
for line in self.conf.splitlines():
|
for line in self.conf.splitlines():
|
||||||
line = line.lstrip()
|
line = line.lstrip()
|
||||||
|
@ -101,7 +101,7 @@ Keys: SPACE select or deselect the highlighted repositories,
|
||||||
self.tag_line = False
|
self.tag_line = False
|
||||||
|
|
||||||
def update_repos(self):
|
def update_repos(self):
|
||||||
"""Update repositories.conf file with enabled or disabled
|
"""Updates repositories.conf file with enabled or disabled
|
||||||
repositories
|
repositories
|
||||||
"""
|
"""
|
||||||
with open(f"{self.meta.conf_path}"
|
with open(f"{self.meta.conf_path}"
|
||||||
|
|
|
@ -56,8 +56,7 @@ class RepoInfo(Utils):
|
||||||
del RepoList().all_repos
|
del RepoList().all_repos
|
||||||
|
|
||||||
def view(self, repo):
|
def view(self, repo):
|
||||||
"""
|
"""Views repository information
|
||||||
View repository information
|
|
||||||
"""
|
"""
|
||||||
status = f"{self.red}disabled{self.endc}"
|
status = f"{self.red}disabled{self.endc}"
|
||||||
self.form["Status:"] = status
|
self.form["Status:"] = status
|
||||||
|
@ -109,7 +108,7 @@ class RepoInfo(Utils):
|
||||||
print(f"{self.green}{key}{self.endc} {value}")
|
print(f"{self.green}{key}{self.endc} {value}")
|
||||||
|
|
||||||
def repository_data(self, repo):
|
def repository_data(self, repo):
|
||||||
"""Grap data packages
|
"""Graps data packages
|
||||||
"""
|
"""
|
||||||
sum_pkgs, size, unsize, last_upd = 0, [], [], ""
|
sum_pkgs, size, unsize, last_upd = 0, [], [], ""
|
||||||
f = f"{self.meta.lib_path}{repo}_repo/PACKAGES.TXT"
|
f = f"{self.meta.lib_path}{repo}_repo/PACKAGES.TXT"
|
||||||
|
|
|
@ -29,7 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
class Repo(Utils):
|
class Repo(Utils):
|
||||||
"""Manage repositories configuration files
|
"""Manages repositories configuration files
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
|
@ -43,7 +43,7 @@ class Repo(Utils):
|
||||||
self.default_repository()
|
self.default_repository()
|
||||||
|
|
||||||
def add(self, repo, url):
|
def add(self, repo, url):
|
||||||
"""Write custom repository name and url in a file
|
"""Writes custom repository name and url in a file
|
||||||
"""
|
"""
|
||||||
repo_name = []
|
repo_name = []
|
||||||
if not url.endswith("/"):
|
if not url.endswith("/"):
|
||||||
|
@ -67,7 +67,7 @@ class Repo(Utils):
|
||||||
print(f"\nRepository '{repo}' successfully added\n")
|
print(f"\nRepository '{repo}' successfully added\n")
|
||||||
|
|
||||||
def remove(self, repo):
|
def remove(self, repo):
|
||||||
"""Remove custom repository
|
"""Removes custom repository
|
||||||
"""
|
"""
|
||||||
rem_repo = False
|
rem_repo = False
|
||||||
with open(self.custom_repo_file, "w") as repos:
|
with open(self.custom_repo_file, "w") as repos:
|
||||||
|
@ -83,7 +83,7 @@ class Repo(Utils):
|
||||||
print(f"\nRepository '{repo}' doesn't exist\n")
|
print(f"\nRepository '{repo}' doesn't exist\n")
|
||||||
|
|
||||||
def custom_repository(self):
|
def custom_repository(self):
|
||||||
"""Return dictionary with repo name and url (used external)
|
"""Returns dictionary with repo name and url (used external)
|
||||||
"""
|
"""
|
||||||
custom_dict_repo = {}
|
custom_dict_repo = {}
|
||||||
for line in self.custom_repositories_list.splitlines():
|
for line in self.custom_repositories_list.splitlines():
|
||||||
|
@ -93,7 +93,7 @@ class Repo(Utils):
|
||||||
return custom_dict_repo
|
return custom_dict_repo
|
||||||
|
|
||||||
def default_repository(self):
|
def default_repository(self):
|
||||||
"""Return dictionary with default repo name and url
|
"""Returns dictionary with default repo name and url
|
||||||
"""
|
"""
|
||||||
default_dict_repo = {}
|
default_dict_repo = {}
|
||||||
for line in self.default_repositories_list.splitlines():
|
for line in self.default_repositories_list.splitlines():
|
||||||
|
|
|
@ -41,20 +41,20 @@ class AutoBuild:
|
||||||
self.sbo_sources = []
|
self.sbo_sources = []
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""Build package and fix ordelist per checksum
|
"""Builds package and fix ordelist per checksum
|
||||||
"""
|
"""
|
||||||
self.files_exist()
|
self.files_exist()
|
||||||
self.info_file()
|
self.info_file()
|
||||||
sources = self.sources
|
sources = self.sources
|
||||||
if len(sources) > 1 and self.sbo_sources != sources:
|
if len(sources) > 1 and self.sbo_sources != sources:
|
||||||
sources = self.sbo_sources
|
sources = self.sbo_sources
|
||||||
# If the list does not have the same order use from .info
|
# If the list does not have the same order uses from .info
|
||||||
# order.
|
# order.
|
||||||
BuildPackage(self.script, sources, self.path, auto=True).build()
|
BuildPackage(self.script, sources, self.path, auto=True).build()
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
|
|
||||||
def info_file(self):
|
def info_file(self):
|
||||||
"""Grab sources from .info file and store filename
|
"""Grabs sources from .info file and stores filename
|
||||||
"""
|
"""
|
||||||
sources = SBoGrep(self.prgnam).source().split()
|
sources = SBoGrep(self.prgnam).source().split()
|
||||||
for source in sources:
|
for source in sources:
|
||||||
|
|
|
@ -30,7 +30,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
class BuildNumber(Utils):
|
class BuildNumber(Utils):
|
||||||
"""Get build number from SlackBuild script
|
"""Gets build number from SlackBuild script
|
||||||
"""
|
"""
|
||||||
def __init__(self, sbo_url, pkg):
|
def __init__(self, sbo_url, pkg):
|
||||||
self.sbo_url = sbo_url
|
self.sbo_url = sbo_url
|
||||||
|
|
|
@ -35,7 +35,7 @@ from slpkg.sbo.greps import SBoGrep
|
||||||
|
|
||||||
|
|
||||||
def sbo_upgrade(skip, flag):
|
def sbo_upgrade(skip, flag):
|
||||||
"""Return packages for upgrade
|
"""Returns packages for upgrade
|
||||||
"""
|
"""
|
||||||
msg = Msg()
|
msg = Msg()
|
||||||
black = BlackList()
|
black = BlackList()
|
||||||
|
@ -58,7 +58,7 @@ def sbo_upgrade(skip, flag):
|
||||||
|
|
||||||
|
|
||||||
def sbo_list():
|
def sbo_list():
|
||||||
"""Return all SBo packages
|
"""Returns all SBo packages
|
||||||
"""
|
"""
|
||||||
for pkg in os.listdir(_meta_.pkg_path):
|
for pkg in os.listdir(_meta_.pkg_path):
|
||||||
if pkg.endswith("_SBo"):
|
if pkg.endswith("_SBo"):
|
||||||
|
|
|
@ -23,12 +23,10 @@
|
||||||
|
|
||||||
|
|
||||||
class SBoLink:
|
class SBoLink:
|
||||||
"""Create slackbuild tar.gz archive from url
|
"""Creates slackbuild tar.gz archive from url
|
||||||
"""
|
"""
|
||||||
def __init__(self, sbo_url):
|
def __init__(self, sbo_url):
|
||||||
self.sbo_url = sbo_url
|
self.sbo_url = sbo_url
|
||||||
|
|
||||||
def tar_gz(self):
|
def tar_gz(self):
|
||||||
"""Return link slackbuild tar.gz archive
|
|
||||||
"""
|
|
||||||
return f"{self.sbo_url[:-1]}.tar.gz"
|
return f"{self.sbo_url[:-1]}.tar.gz"
|
||||||
|
|
|
@ -44,7 +44,7 @@ class Requires(BlackList):
|
||||||
|
|
||||||
@lru_cache
|
@lru_cache
|
||||||
def sbo(self, name):
|
def sbo(self, name):
|
||||||
"""Build all dependencies of a package
|
"""Builds all dependencies of a package
|
||||||
"""
|
"""
|
||||||
if (self.meta.rsl_deps in ["on", "ON"] and
|
if (self.meta.rsl_deps in ["on", "ON"] and
|
||||||
"--resolve-off" not in self.flag):
|
"--resolve-off" not in self.flag):
|
||||||
|
@ -53,8 +53,8 @@ class Requires(BlackList):
|
||||||
requires = SBoGrep(name).requires()
|
requires = SBoGrep(name).requires()
|
||||||
if requires:
|
if requires:
|
||||||
for req in requires:
|
for req in requires:
|
||||||
# avoid to add %README% as dependency and
|
# avoids adding %README% as dependency and if
|
||||||
# if require in blacklist
|
# requires in the blacklist
|
||||||
if "%README%" not in req and req not in self.blacklist:
|
if "%README%" not in req and req not in self.blacklist:
|
||||||
dependencies.append(req)
|
dependencies.append(req)
|
||||||
self.deep_check(tuple(dependencies))
|
self.deep_check(tuple(dependencies))
|
||||||
|
@ -64,7 +64,7 @@ class Requires(BlackList):
|
||||||
|
|
||||||
@lru_cache
|
@lru_cache
|
||||||
def deep_check(self, dependencies):
|
def deep_check(self, dependencies):
|
||||||
"""Checking if dependencies are finnished
|
"""Checking if dependencies are finished
|
||||||
"""
|
"""
|
||||||
if dependencies:
|
if dependencies:
|
||||||
self.dep_results.append(dependencies)
|
self.dep_results.append(dependencies)
|
||||||
|
|
|
@ -22,37 +22,29 @@
|
||||||
# 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 sqlite3
|
||||||
from slpkg.utils import Utils
|
from slpkg.utils import Utils
|
||||||
from slpkg.__metadata__ import MetaData as _meta_
|
from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
class SBoGrep(Utils):
|
class SBoGrep(Utils):
|
||||||
"""Grab data from SLACKBUILDS.TXT file
|
"""Grabs data from sbo database
|
||||||
"""
|
"""
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
arch64 = "x86_64"
|
self.db = self.meta.db
|
||||||
self.line_name = "SLACKBUILD NAME: "
|
self.arch64 = "x86_64"
|
||||||
self.line_files = "SLACKBUILD FILES: "
|
self.sbo_db = f"{self.meta.lib_path}{self.db}"
|
||||||
self.line_down = "SLACKBUILD DOWNLOAD: "
|
self.con = sqlite3.connect(self.sbo_db)
|
||||||
self.line_down_64 = f"SLACKBUILD DOWNLOAD_{arch64}: "
|
self.cur = self.con.cursor()
|
||||||
self.line_req = "SLACKBUILD REQUIRES: "
|
|
||||||
self.line_ver = "SLACKBUILD VERSION: "
|
|
||||||
self.line_md5 = "SLACKBUILD MD5SUM: "
|
|
||||||
self.line_md5_64 = f"SLACKBUILD MD5SUM_{arch64}: "
|
|
||||||
self.line_des = "SLACKBUILD SHORT DESCRIPTION: "
|
|
||||||
self.sbo_txt = self.meta.lib_path + "sbo_repo/SLACKBUILDS.TXT"
|
|
||||||
self.answer = ["y", "Y"]
|
|
||||||
self.unst = ["UNSUPPORTED", "UNTESTED"]
|
|
||||||
self.SLACKBUILDS_TXT = self.read_file(self.sbo_txt)
|
|
||||||
|
|
||||||
def _names_grabbing(self):
|
def _names_grabbing(self):
|
||||||
"""Generator that collecting all packages names
|
"""Generator that collecting all packages names
|
||||||
"""
|
"""
|
||||||
for line in self.SLACKBUILDS_TXT.splitlines():
|
names = self.cur.execute("SELECT name FROM sbo").fetchall()
|
||||||
if line.startswith(self.line_name):
|
for n in names:
|
||||||
yield line[17:].strip()
|
yield n[0]
|
||||||
|
|
||||||
def names(self):
|
def names(self):
|
||||||
"""Alias method convert generator and return
|
"""Alias method convert generator and return
|
||||||
|
@ -61,102 +53,67 @@ class SBoGrep(Utils):
|
||||||
return list(self._names_grabbing())
|
return list(self._names_grabbing())
|
||||||
|
|
||||||
def source(self):
|
def source(self):
|
||||||
"""Grab sources downloads links
|
"""Grabs sources downloads links
|
||||||
"""
|
"""
|
||||||
source, source64, = "", ""
|
source, source64 = self.cur.execute("""SELECT download, download64
|
||||||
for line in self.SLACKBUILDS_TXT.splitlines():
|
FROM sbo
|
||||||
if line.startswith(self.line_name):
|
WHERE name = '{}'""".format(
|
||||||
sbo_name = line[17:].strip()
|
self.name)).fetchone()
|
||||||
if line.startswith(self.line_down):
|
return self._sorting_arch(source, source64)
|
||||||
if sbo_name == self.name and line[21:].strip():
|
|
||||||
source = line[21:]
|
|
||||||
if line.startswith(self.line_down_64):
|
|
||||||
if sbo_name == self.name and line[28:].strip():
|
|
||||||
source64 = line[28:]
|
|
||||||
return self._select_source_arch(source, source64)
|
|
||||||
|
|
||||||
def _select_source_arch(self, source, source64):
|
|
||||||
"""Return sources by arch
|
|
||||||
"""
|
|
||||||
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 = source
|
|
||||||
else:
|
|
||||||
if source:
|
|
||||||
src = source
|
|
||||||
if self.meta.skip_unst in self.answer and source in self.unst:
|
|
||||||
src = source64
|
|
||||||
return src
|
|
||||||
|
|
||||||
def requires(self):
|
def requires(self):
|
||||||
"""Grab package requirements
|
"""Grabs package requirements
|
||||||
"""
|
"""
|
||||||
for line in self.SLACKBUILDS_TXT.splitlines():
|
requires = self.cur.execute("""SELECT requires
|
||||||
if line.startswith(self.line_name):
|
FROM sbo
|
||||||
sbo_name = line[17:].strip()
|
WHERE name = '{}'""".format(
|
||||||
if line.startswith(self.line_req):
|
self.name)).fetchone()
|
||||||
if sbo_name == self.name:
|
return requires[0].split()
|
||||||
return line[21:].strip().split()
|
|
||||||
|
|
||||||
def version(self):
|
def version(self):
|
||||||
"""Grab package version
|
"""Grabs package version
|
||||||
"""
|
"""
|
||||||
for line in self.SLACKBUILDS_TXT.splitlines():
|
version = self.cur.execute("""SELECT version
|
||||||
if line.startswith(self.line_name):
|
FROM sbo
|
||||||
sbo_name = line[17:].strip()
|
WHERE name = '{}'""".format(
|
||||||
if line.startswith(self.line_ver):
|
self.name)).fetchone()
|
||||||
if sbo_name == self.name:
|
return version[0]
|
||||||
return line[20:].strip()
|
|
||||||
|
|
||||||
def checksum(self):
|
def checksum(self):
|
||||||
"""Grab checksum string
|
"""Grabs checksum string
|
||||||
"""
|
"""
|
||||||
md5sum, md5sum64, = [], []
|
md5sum, md5sum64, = [], []
|
||||||
for line in self.SLACKBUILDS_TXT.splitlines():
|
mds5, md5s64 = self.cur.execute("""SELECT md5sum, md5sum64
|
||||||
if line.startswith(self.line_name):
|
FROM sbo
|
||||||
sbo_name = line[17:].strip()
|
WHERE name = '{}'""".format(
|
||||||
if line.startswith(self.line_md5_64):
|
self.name)).fetchone()
|
||||||
if sbo_name == self.name and line[26:].strip():
|
if mds5:
|
||||||
md5sum64 = line[26:].strip().split()
|
md5sum.append(mds5)
|
||||||
if line.startswith(self.line_md5):
|
if md5s64:
|
||||||
if sbo_name == self.name and line[19:].strip():
|
md5sum64.append(md5s64)
|
||||||
md5sum = line[19:].strip().split()
|
return self._sorting_arch(md5sum, md5sum64)
|
||||||
return self._select_md5sum_arch(md5sum, md5sum64)
|
|
||||||
|
|
||||||
def _select_md5sum_arch(self, md5sum, md5sum64):
|
|
||||||
"""Return checksums by arch
|
|
||||||
"""
|
|
||||||
if md5sum and md5sum64:
|
|
||||||
if self.meta.arch == "x86_64":
|
|
||||||
return md5sum64
|
|
||||||
else:
|
|
||||||
return md5sum
|
|
||||||
if md5sum:
|
|
||||||
return md5sum
|
|
||||||
else:
|
|
||||||
return md5sum64
|
|
||||||
|
|
||||||
def description(self):
|
def description(self):
|
||||||
"""Grab package version
|
"""Grabs package description
|
||||||
"""
|
"""
|
||||||
for line in self.SLACKBUILDS_TXT.splitlines():
|
desc = self.cur.execute("""SELECT short_desc
|
||||||
if line.startswith(self.line_name):
|
FROM sbo
|
||||||
sbo_name = line[17:].strip()
|
WHERE name = '{}'""".format(
|
||||||
if line.startswith(self.line_des):
|
self.name)).fetchone()
|
||||||
if sbo_name == self.name:
|
return desc[0]
|
||||||
return line[31:].strip()
|
|
||||||
|
|
||||||
def files(self):
|
def files(self):
|
||||||
"""Grab files
|
"""Grabs files
|
||||||
"""
|
"""
|
||||||
for line in self.SLACKBUILDS_TXT.splitlines():
|
files = self.cur.execute("""SELECT files
|
||||||
if line.startswith(self.line_name):
|
FROM sbo
|
||||||
sbo_name = line[17:].strip()
|
WHERE name = '{}'""".format(
|
||||||
if line.startswith(self.line_files):
|
self.name)).fetchone()
|
||||||
if sbo_name == self.name:
|
return files[0]
|
||||||
return line[18:].strip()
|
|
||||||
|
def _sorting_arch(self, arch, arch64):
|
||||||
|
"""Returns sources by arch
|
||||||
|
"""
|
||||||
|
if self.meta.arch == self.arch64 and arch64:
|
||||||
|
return arch64
|
||||||
|
return arch
|
||||||
|
|
|
@ -49,7 +49,7 @@ from slpkg.slack.slack_version import slack_ver
|
||||||
|
|
||||||
|
|
||||||
class SBoNetwork(BlackList, Utils):
|
class SBoNetwork(BlackList, Utils):
|
||||||
"""View SBo site in terminal and also read, build or
|
"""View SBo site in the terminal and also read, build or
|
||||||
install packages
|
install packages
|
||||||
"""
|
"""
|
||||||
def __init__(self, name, flag):
|
def __init__(self, name, flag):
|
||||||
|
@ -58,6 +58,8 @@ class SBoNetwork(BlackList, Utils):
|
||||||
self.flag = flag
|
self.flag = flag
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
self.msg = Msg()
|
self.msg = Msg()
|
||||||
|
self.data = SBoGrep(name="").names()
|
||||||
|
self.check_pkg_exist()
|
||||||
self.arch = SBoArch().get()
|
self.arch = SBoArch().get()
|
||||||
self.comp_tar = ".tar.gz"
|
self.comp_tar = ".tar.gz"
|
||||||
self.choice = ""
|
self.choice = ""
|
||||||
|
@ -71,7 +73,6 @@ class SBoNetwork(BlackList, Utils):
|
||||||
self.build_folder = self.meta.build_path
|
self.build_folder = self.meta.build_path
|
||||||
self._SOURCES = self.meta.SBo_SOURCES
|
self._SOURCES = self.meta.SBo_SOURCES
|
||||||
self.msg.reading()
|
self.msg.reading()
|
||||||
self.data = SBoGrep(name="").names()
|
|
||||||
self.case_insensitive()
|
self.case_insensitive()
|
||||||
if "--checklist" in self.flag:
|
if "--checklist" in self.flag:
|
||||||
self.with_checklist()
|
self.with_checklist()
|
||||||
|
@ -88,6 +89,11 @@ class SBoNetwork(BlackList, Utils):
|
||||||
if "--checklist" not in self.flag or not self.sbo_url and self.name:
|
if "--checklist" not in self.flag or not self.sbo_url and self.name:
|
||||||
self.msg.done()
|
self.msg.done()
|
||||||
|
|
||||||
|
def check_pkg_exist(self):
|
||||||
|
if self.name not in self.data:
|
||||||
|
self.msg.pkg_not_found("\n", self.name, "can't find", "\n")
|
||||||
|
raise SystemExit(1)
|
||||||
|
|
||||||
def view(self):
|
def view(self):
|
||||||
"""View SlackBuild package, read or install them
|
"""View SlackBuild package, read or install them
|
||||||
from slackbuilds.org
|
from slackbuilds.org
|
||||||
|
@ -224,7 +230,7 @@ class SBoNetwork(BlackList, Utils):
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
|
|
||||||
def choice_install(self):
|
def choice_install(self):
|
||||||
"""Download, build and install package
|
"""Download, build and install the package
|
||||||
"""
|
"""
|
||||||
pkg_security([self.name])
|
pkg_security([self.name])
|
||||||
if not find_package(self.prgnam, self.meta.pkg_path):
|
if not find_package(self.prgnam, self.meta.pkg_path):
|
||||||
|
@ -313,7 +319,7 @@ class SBoNetwork(BlackList, Utils):
|
||||||
pydoc.pager(text)
|
pydoc.pager(text)
|
||||||
|
|
||||||
def fill_pager(self, page):
|
def fill_pager(self, page):
|
||||||
"""Fix pager spaces
|
"""Fixes pager spaces
|
||||||
"""
|
"""
|
||||||
tty_size = os.popen("stty size", "r").read().split()
|
tty_size = os.popen("stty size", "r").read().split()
|
||||||
rows = int(tty_size[0]) - 1
|
rows = int(tty_size[0]) - 1
|
||||||
|
@ -326,8 +332,8 @@ class SBoNetwork(BlackList, Utils):
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
def error_uns(self):
|
def error_uns(self):
|
||||||
"""Check if package supported by arch
|
"""Checks if the package supported by an arch
|
||||||
before proceed to install
|
before proceeding to install
|
||||||
"""
|
"""
|
||||||
self.FAULT = ""
|
self.FAULT = ""
|
||||||
UNST = ["UNSUPPORTED", "UNTESTED"]
|
UNST = ["UNSUPPORTED", "UNTESTED"]
|
||||||
|
@ -335,7 +341,7 @@ class SBoNetwork(BlackList, Utils):
|
||||||
self.FAULT = "".join(self.source_dwn)
|
self.FAULT = "".join(self.source_dwn)
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
"""Only build and create Slackware package
|
"""Builds slackware package
|
||||||
"""
|
"""
|
||||||
pkg_security([self.name])
|
pkg_security([self.name])
|
||||||
self.error_uns()
|
self.error_uns()
|
||||||
|
@ -363,7 +369,7 @@ class SBoNetwork(BlackList, Utils):
|
||||||
slack_package(self.prgnam) # check if build
|
slack_package(self.prgnam) # check if build
|
||||||
|
|
||||||
def install(self):
|
def install(self):
|
||||||
"""Install SBo package found in /tmp directory.
|
"""Installs SBo package found in /tmp directory.
|
||||||
"""
|
"""
|
||||||
binary = slack_package(self.prgnam)
|
binary = slack_package(self.prgnam)
|
||||||
print(f"[ {self.green}Installing{self.endc} ] --> {self.name}")
|
print(f"[ {self.green}Installing{self.endc} ] --> {self.name}")
|
||||||
|
|
|
@ -40,7 +40,7 @@ from slpkg.sbo.slack_find import slack_package
|
||||||
|
|
||||||
|
|
||||||
class QueuePkgs(Utils):
|
class QueuePkgs(Utils):
|
||||||
"""Manage SBo packages, add or remove for building or
|
"""Manages SBo packages, add or removes for building or
|
||||||
installation
|
installation
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -57,7 +57,7 @@ class QueuePkgs(Utils):
|
||||||
"""Creating the directories and the queue file
|
"""Creating the directories and the queue file
|
||||||
"""
|
"""
|
||||||
queue_file = [
|
queue_file = [
|
||||||
"# In this file you can create a list of\n",
|
"# In this file, you can create a list of\n",
|
||||||
"# packages you want to build or install.\n",
|
"# packages you want to build or install.\n",
|
||||||
"#\n"]
|
"#\n"]
|
||||||
if not os.path.exists(self.meta.lib_path):
|
if not os.path.exists(self.meta.lib_path):
|
||||||
|
@ -71,7 +71,7 @@ class QueuePkgs(Utils):
|
||||||
self.queued = self.read_file(self.queue_list)
|
self.queued = self.read_file(self.queue_list)
|
||||||
|
|
||||||
def packages(self):
|
def packages(self):
|
||||||
"""Return queue list from /var/lib/queue/queue_list
|
"""Returns queue list from /var/lib/queue/queue_list
|
||||||
file.
|
file.
|
||||||
"""
|
"""
|
||||||
for read in self.queued.splitlines():
|
for read in self.queued.splitlines():
|
||||||
|
@ -80,7 +80,7 @@ class QueuePkgs(Utils):
|
||||||
yield read.replace("\n", "")
|
yield read.replace("\n", "")
|
||||||
|
|
||||||
def listed(self):
|
def listed(self):
|
||||||
"""Print packages from queue
|
"""Prints packages from queue
|
||||||
"""
|
"""
|
||||||
print("Packages in the queue:")
|
print("Packages in the queue:")
|
||||||
for pkg in self.packages():
|
for pkg in self.packages():
|
||||||
|
@ -88,7 +88,7 @@ class QueuePkgs(Utils):
|
||||||
print()
|
print()
|
||||||
|
|
||||||
def add(self, pkgs):
|
def add(self, pkgs):
|
||||||
"""Add packages in queue if not exist
|
"""Adds packages in queue if not exist
|
||||||
"""
|
"""
|
||||||
queue_list = list(self.packages())
|
queue_list = list(self.packages())
|
||||||
pkgs = list(OrderedDict.fromkeys(pkgs))
|
pkgs = list(OrderedDict.fromkeys(pkgs))
|
||||||
|
@ -104,7 +104,7 @@ class QueuePkgs(Utils):
|
||||||
print()
|
print()
|
||||||
|
|
||||||
def remove(self, pkgs):
|
def remove(self, pkgs):
|
||||||
"""Remove packages from queue
|
"""Removes packages from the queue
|
||||||
"""
|
"""
|
||||||
print("Remove packages from the queue:")
|
print("Remove packages from the queue:")
|
||||||
with open(self.queue_list, "w") as queue:
|
with open(self.queue_list, "w") as queue:
|
||||||
|
@ -116,7 +116,7 @@ class QueuePkgs(Utils):
|
||||||
print()
|
print()
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
"""Build packages from queue
|
"""Builds packages from the queue
|
||||||
"""
|
"""
|
||||||
sources = []
|
sources = []
|
||||||
packages = list(self.packages())
|
packages = list(self.packages())
|
||||||
|
@ -146,7 +146,7 @@ class QueuePkgs(Utils):
|
||||||
"building\n")
|
"building\n")
|
||||||
|
|
||||||
def install(self):
|
def install(self):
|
||||||
"""Install packages from queue
|
"""Installs packages from the queue
|
||||||
"""
|
"""
|
||||||
packages = list(self.packages())
|
packages = list(self.packages())
|
||||||
if packages:
|
if packages:
|
||||||
|
|
|
@ -22,7 +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/>.
|
||||||
|
|
||||||
|
|
||||||
from slpkg.utils import Utils
|
import sqlite3
|
||||||
from slpkg.repositories import Repo
|
from slpkg.repositories import Repo
|
||||||
from slpkg.__metadata__ import MetaData as _meta_
|
from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
@ -33,16 +33,17 @@ def sbo_search_pkg(name):
|
||||||
"""Search for package path in SLACKBUILDS.TXT file and
|
"""Search for package path in SLACKBUILDS.TXT file and
|
||||||
return url
|
return url
|
||||||
"""
|
"""
|
||||||
url = ""
|
db = _meta_.db
|
||||||
utils = Utils()
|
lib_path = _meta_.lib_path
|
||||||
|
con = sqlite3.connect(f"{lib_path}{db}")
|
||||||
|
cur = con.cursor()
|
||||||
|
|
||||||
|
location = cur.execute("""SELECT location
|
||||||
|
FROM sbo
|
||||||
|
WHERE name = '{}'""".format(name)).fetchone()
|
||||||
|
|
||||||
repo = Repo()
|
repo = Repo()
|
||||||
sbo = repo.default_repository()["sbo"]
|
sbo = repo.default_repository()["sbo"]
|
||||||
sbo_url = f"{sbo}{slack_ver()}/"
|
sbo_url = f"{sbo}{slack_ver()}/"
|
||||||
SLACKBUILDS_TXT = utils.read_file(
|
|
||||||
f"{_meta_.lib_path}sbo_repo/SLACKBUILDS.TXT")
|
return f"{sbo_url}{location[0][2:]}/"
|
||||||
for line in SLACKBUILDS_TXT.splitlines():
|
|
||||||
if line.startswith("SLACKBUILD LOCATION"):
|
|
||||||
sbo_name = (line[23:].split("/")[-1].replace("\n", "")).strip()
|
|
||||||
if name == sbo_name:
|
|
||||||
url = f"{sbo_url}{line[23:].strip()}/"
|
|
||||||
return url
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ from slpkg.messages import Msg
|
||||||
|
|
||||||
|
|
||||||
def pkg_security(pkgs):
|
def pkg_security(pkgs):
|
||||||
"""Check packages before install or upgrade for security
|
"""Checks packages before installing or upgrading for security
|
||||||
reasons. Configuration file in the /etc/slpkg/pkg_security"""
|
reasons. Configuration file in the /etc/slpkg/pkg_security"""
|
||||||
packages, msg, utils = [], Msg(), Utils()
|
packages, msg, utils = [], Msg(), Utils()
|
||||||
security_packages = utils.read_file("/etc/slpkg/pkg_security")
|
security_packages = utils.read_file("/etc/slpkg/pkg_security")
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
def units(comp_sum, uncomp_sum):
|
def units(comp_sum, uncomp_sum):
|
||||||
"""Calculate package size
|
"""Calculates package size
|
||||||
"""
|
"""
|
||||||
compressed = round((sum(map(float, comp_sum)) / 1024), 2)
|
compressed = round((sum(map(float, comp_sum)) / 1024), 2)
|
||||||
uncompressed = round((sum(map(float, uncomp_sum)) / 1024), 2)
|
uncompressed = round((sum(map(float, uncomp_sum)) / 1024), 2)
|
||||||
|
|
|
@ -29,7 +29,7 @@ from slpkg.slack.slack_version import slack_ver
|
||||||
|
|
||||||
|
|
||||||
def mirrors(name, location):
|
def mirrors(name, location):
|
||||||
"""Select Slackware official mirror packages
|
"""Selects Slackware official mirror packages
|
||||||
based architecture and version.
|
based architecture and version.
|
||||||
"""
|
"""
|
||||||
rel = _meta_.slack_rel
|
rel = _meta_.slack_rel
|
||||||
|
|
|
@ -53,7 +53,7 @@ from slpkg.slack.slack_version import slack_ver
|
||||||
|
|
||||||
|
|
||||||
class Patches(BlackList, Utils):
|
class Patches(BlackList, Utils):
|
||||||
"""Upgrade distribution from official Slackware mirrors
|
"""Upgrades distribution from the official Slackware mirrors
|
||||||
"""
|
"""
|
||||||
def __init__(self, skip, flag):
|
def __init__(self, skip, flag):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
@ -85,7 +85,7 @@ class Patches(BlackList, Utils):
|
||||||
self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "")).get_request()
|
self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "")).get_request()
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
"""Install new patches from official Slackware mirrors
|
"""Installs new patches from official Slackware mirrors
|
||||||
"""
|
"""
|
||||||
self.store()
|
self.store()
|
||||||
self.msg.done()
|
self.msg.done()
|
||||||
|
@ -132,7 +132,7 @@ class Patches(BlackList, Utils):
|
||||||
f" distribution is up to date!\n")
|
f" distribution is up to date!\n")
|
||||||
|
|
||||||
def store(self):
|
def store(self):
|
||||||
"""Store and return packages for upgrading
|
"""Stores and returns packages for upgrading
|
||||||
"""
|
"""
|
||||||
data = repo_data(self.PACKAGES_TXT, "slack", self.flag)
|
data = repo_data(self.PACKAGES_TXT, "slack", self.flag)
|
||||||
black = list(self.get_black())
|
black = list(self.get_black())
|
||||||
|
@ -169,7 +169,7 @@ class Patches(BlackList, Utils):
|
||||||
return self.count_upg
|
return self.count_upg
|
||||||
|
|
||||||
def dialog_checklist(self):
|
def dialog_checklist(self):
|
||||||
"""Create checklist to choose packages for upgrade
|
"""Creates checklist to choose packages for upgrade
|
||||||
"""
|
"""
|
||||||
data = []
|
data = []
|
||||||
for upg in self.upgrade_all:
|
for upg in self.upgrade_all:
|
||||||
|
@ -214,7 +214,7 @@ class Patches(BlackList, Utils):
|
||||||
f"{' ' * (7-len(pkg_repo[3]))}Slack{size:>12} K")
|
f"{' ' * (7-len(pkg_repo[3]))}Slack{size:>12} K")
|
||||||
|
|
||||||
def upgrade(self):
|
def upgrade(self):
|
||||||
"""Upgrade packages
|
"""Upgrades packages
|
||||||
"""
|
"""
|
||||||
for pkg in self.upgrade_all:
|
for pkg in self.upgrade_all:
|
||||||
check_md5(pkg_checksum(pkg, "slack_patches"),
|
check_md5(pkg_checksum(pkg, "slack_patches"),
|
||||||
|
@ -233,8 +233,8 @@ class Patches(BlackList, Utils):
|
||||||
self.installed.append(pkg_ver)
|
self.installed.append(pkg_ver)
|
||||||
|
|
||||||
def kernel(self):
|
def kernel(self):
|
||||||
"""Check if kernel upgraded if true
|
"""Checks if kernel upgraded if true
|
||||||
then reinstall "lilo"
|
then reinstall boot loader
|
||||||
"""
|
"""
|
||||||
for core in self.upgrade_all:
|
for core in self.upgrade_all:
|
||||||
if "kernel" in core:
|
if "kernel" in core:
|
||||||
|
@ -264,7 +264,7 @@ class Patches(BlackList, Utils):
|
||||||
break
|
break
|
||||||
|
|
||||||
def slackpkg_update(self):
|
def slackpkg_update(self):
|
||||||
"""This replace slackpkg ChangeLog.txt file with new
|
"""This replace slackpkg ChangeLog.txt file with new one
|
||||||
from Slackware official mirrors after update distribution.
|
from Slackware official mirrors after update distribution.
|
||||||
"""
|
"""
|
||||||
NEW_ChangeLog_txt = URL(mirrors("ChangeLog.txt", "")).get_request()
|
NEW_ChangeLog_txt = URL(mirrors("ChangeLog.txt", "")).get_request()
|
||||||
|
@ -278,7 +278,7 @@ class Patches(BlackList, Utils):
|
||||||
log.write(NEW_ChangeLog_txt)
|
log.write(NEW_ChangeLog_txt)
|
||||||
|
|
||||||
def update_lists(self):
|
def update_lists(self):
|
||||||
"""Update packages list and ChangeLog.txt file after
|
"""Updates packages list and ChangeLog.txt file after
|
||||||
upgrade distribution
|
upgrade distribution
|
||||||
"""
|
"""
|
||||||
print(f"{self.green}Update the package lists ?{self.endc}")
|
print(f"{self.green}Update the package lists ?{self.endc}")
|
||||||
|
|
|
@ -29,8 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
def slack_ver():
|
def slack_ver():
|
||||||
"""
|
"""Opens the file and read Slackware version
|
||||||
Open file and read Slackware version
|
|
||||||
"""
|
"""
|
||||||
utils = Utils()
|
utils = Utils()
|
||||||
if _meta_.slackware_version in ["off", "OFF"]:
|
if _meta_.slackware_version in ["off", "OFF"]:
|
||||||
|
|
|
@ -29,7 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
def slackware_repository():
|
def slackware_repository():
|
||||||
"""Return all official Slackware packages
|
"""Returns all official Slackware packages
|
||||||
"""
|
"""
|
||||||
utils = Utils()
|
utils = Utils()
|
||||||
slack_repo, packages, names = [], [], []
|
slack_repo, packages, names = [], [], []
|
||||||
|
|
|
@ -35,8 +35,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
def it_self_update():
|
def it_self_update():
|
||||||
"""Check from GitLab slpkg repository if new version is available
|
"""Checks from GitLab slpkg repository if a new version is available
|
||||||
download and update itself
|
|
||||||
"""
|
"""
|
||||||
__new_version__ = ""
|
__new_version__ = ""
|
||||||
repository = "gitlab"
|
repository = "gitlab"
|
||||||
|
|
|
@ -23,8 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
def split_package(package):
|
def split_package(package):
|
||||||
"""
|
"""Splits package in name, version
|
||||||
Split package in name, version
|
|
||||||
arch and build tag.
|
arch and build tag.
|
||||||
"""
|
"""
|
||||||
name = ver = arch = build = []
|
name = ver = arch = build = []
|
||||||
|
|
|
@ -34,7 +34,7 @@ from slpkg.pkg.find import find_package
|
||||||
|
|
||||||
|
|
||||||
class DependenciesStatus(Utils):
|
class DependenciesStatus(Utils):
|
||||||
"""Print dependencies status used by packages
|
"""Prints dependencies status used by packages
|
||||||
"""
|
"""
|
||||||
def __init__(self, image):
|
def __init__(self, image):
|
||||||
self.image = image
|
self.image = image
|
||||||
|
@ -53,7 +53,7 @@ class DependenciesStatus(Utils):
|
||||||
self.installed = find_package("", self.meta.pkg_path)
|
self.installed = find_package("", self.meta.pkg_path)
|
||||||
|
|
||||||
def data(self):
|
def data(self):
|
||||||
"""Check all installed packages and create
|
"""Checks all installed packages and create
|
||||||
dictionary database
|
dictionary database
|
||||||
"""
|
"""
|
||||||
for pkg in self.installed:
|
for pkg in self.installed:
|
||||||
|
@ -72,7 +72,7 @@ class DependenciesStatus(Utils):
|
||||||
self.count_packages()
|
self.count_packages()
|
||||||
|
|
||||||
def count_packages(self):
|
def count_packages(self):
|
||||||
"""Count dependencies and packages
|
"""Counts dependencies and packages
|
||||||
"""
|
"""
|
||||||
packages = []
|
packages = []
|
||||||
for pkg in self.dmap.values():
|
for pkg in self.dmap.values():
|
||||||
|
|
|
@ -27,14 +27,14 @@ import getpass
|
||||||
|
|
||||||
|
|
||||||
def s_user():
|
def s_user():
|
||||||
"""Check for root user
|
"""Checks for root user
|
||||||
"""
|
"""
|
||||||
if getpass.getuser() != "root":
|
if getpass.getuser() != "root":
|
||||||
raise SystemExit("\nslpkg: Error: Must have root privileges\n")
|
raise SystemExit("\nslpkg: Error: Must have root privileges\n")
|
||||||
|
|
||||||
|
|
||||||
def virtual_env():
|
def virtual_env():
|
||||||
"""Check if a virtual enviroment exists
|
"""Checks if a virtual enviroment exists
|
||||||
"""
|
"""
|
||||||
if "VIRTUAL_ENV" in os.environ.keys():
|
if "VIRTUAL_ENV" in os.environ.keys():
|
||||||
raise SystemExit("\nslpkg: Error: Please exit from virtual "
|
raise SystemExit("\nslpkg: Error: Please exit from virtual "
|
||||||
|
|
|
@ -39,9 +39,9 @@ from slpkg.binary.dependency import Dependencies
|
||||||
|
|
||||||
|
|
||||||
class TrackingDeps(BlackList, Utils):
|
class TrackingDeps(BlackList, Utils):
|
||||||
"""View tree of dependencies and also
|
"""Views tree of dependencies and also
|
||||||
highlight packages with color green
|
highlights packages with the colour green
|
||||||
if already installed and color red
|
if already installed and the colour red
|
||||||
if not installed.
|
if not installed.
|
||||||
"""
|
"""
|
||||||
def __init__(self, name, repo, flag):
|
def __init__(self, name, repo, flag):
|
||||||
|
@ -71,7 +71,7 @@ class TrackingDeps(BlackList, Utils):
|
||||||
self.flag[i] = "--graph="
|
self.flag[i] = "--graph="
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""Run tracking dependencies
|
"""Runs tracking dependencies
|
||||||
"""
|
"""
|
||||||
self.msg.resolving()
|
self.msg.resolving()
|
||||||
self.repositories()
|
self.repositories()
|
||||||
|
@ -124,7 +124,7 @@ class TrackingDeps(BlackList, Utils):
|
||||||
raise SystemExit("\nNo package was found to match\n")
|
raise SystemExit("\nNo package was found to match\n")
|
||||||
|
|
||||||
def repositories(self):
|
def repositories(self):
|
||||||
"""Get dependencies by repositories
|
"""Gets dependencies by repositories
|
||||||
"""
|
"""
|
||||||
if self.repo == "sbo":
|
if self.repo == "sbo":
|
||||||
self.sbo_case_insensitive()
|
self.sbo_case_insensitive()
|
||||||
|
@ -169,7 +169,7 @@ class TrackingDeps(BlackList, Utils):
|
||||||
Graph(self.image).dependencies(self.deps_dict)
|
Graph(self.image).dependencies(self.deps_dict)
|
||||||
|
|
||||||
def check_used(self, pkg):
|
def check_used(self, pkg):
|
||||||
"""Check if dependencies used
|
"""Checks if dependencies used
|
||||||
"""
|
"""
|
||||||
used = []
|
used = []
|
||||||
dep_path = f"{self.meta.log_path}dep/"
|
dep_path = f"{self.meta.log_path}dep/"
|
||||||
|
@ -197,7 +197,7 @@ class TrackingDeps(BlackList, Utils):
|
||||||
self.deps_dict[dep] = self.dimensional_list(deps)
|
self.deps_dict[dep] = self.dimensional_list(deps)
|
||||||
|
|
||||||
def deps_used(self, pkg, used):
|
def deps_used(self, pkg, used):
|
||||||
"""Create dependencies dictionary
|
"""Creates dependencies dictionary
|
||||||
"""
|
"""
|
||||||
if find_package(f"{pkg}-", self.meta.pkg_path):
|
if find_package(f"{pkg}-", self.meta.pkg_path):
|
||||||
if pkg not in self.deps_dict.values():
|
if pkg not in self.deps_dict.values():
|
||||||
|
|
|
@ -41,7 +41,7 @@ class URL:
|
||||||
self.http = urllib3.PoolManager()
|
self.http = urllib3.PoolManager()
|
||||||
|
|
||||||
def get_request(self):
|
def get_request(self):
|
||||||
"""Open url and read
|
"""Opens url and read
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
f = self.http.request('GET', self.link)
|
f = self.http.request('GET', self.link)
|
||||||
|
|
|
@ -29,7 +29,7 @@ from slpkg.splitting import split_package
|
||||||
|
|
||||||
|
|
||||||
class Utils:
|
class Utils:
|
||||||
"""Class with usefull utilities
|
"""Class with useful utilities
|
||||||
"""
|
"""
|
||||||
def case_sensitive(self, lst):
|
def case_sensitive(self, lst):
|
||||||
"""Create dictionary from list with key in lower case
|
"""Create dictionary from list with key in lower case
|
||||||
|
@ -41,7 +41,7 @@ class Utils:
|
||||||
return dictionary
|
return dictionary
|
||||||
|
|
||||||
def dimensional_list(self, lists):
|
def dimensional_list(self, lists):
|
||||||
"""Create one dimensional list
|
"""Creates one dimensional list
|
||||||
"""
|
"""
|
||||||
one_list = []
|
one_list = []
|
||||||
for lst in lists:
|
for lst in lists:
|
||||||
|
@ -49,7 +49,7 @@ class Utils:
|
||||||
return one_list
|
return one_list
|
||||||
|
|
||||||
def remove_dbs(self, double):
|
def remove_dbs(self, double):
|
||||||
"""Remove double item from list
|
"""Removes double item from list
|
||||||
"""
|
"""
|
||||||
return list(OrderedDict.fromkeys(double))
|
return list(OrderedDict.fromkeys(double))
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ class Utils:
|
||||||
yield split_package(line[14:].strip())[0]
|
yield split_package(line[14:].strip())[0]
|
||||||
|
|
||||||
def check_downloaded(self, path, downloaded):
|
def check_downloaded(self, path, downloaded):
|
||||||
"""Check if files downloaded and return downloaded
|
"""Checks if files downloaded and return downloaded
|
||||||
packages
|
packages
|
||||||
"""
|
"""
|
||||||
for pkg in downloaded:
|
for pkg in downloaded:
|
||||||
|
@ -79,8 +79,8 @@ class Utils:
|
||||||
yield pkg
|
yield pkg
|
||||||
|
|
||||||
def read_config(self, config):
|
def read_config(self, config):
|
||||||
"""Read config file and returns first uncomment line
|
"""Reads config file and returns first uncomment line
|
||||||
and stop. Used for Slackware mirrors
|
and stops. Used for Slackware mirrors
|
||||||
"""
|
"""
|
||||||
for line in config.splitlines():
|
for line in config.splitlines():
|
||||||
line = line.lstrip()
|
line = line.lstrip()
|
||||||
|
@ -107,6 +107,6 @@ class Utils:
|
||||||
return "ISO-8859-1"
|
return "ISO-8859-1"
|
||||||
|
|
||||||
def debug(self, test):
|
def debug(self, test):
|
||||||
"""Function used for print some stuff for debugging
|
"""A function used to print some stuff for debugging
|
||||||
"""
|
"""
|
||||||
print(test)
|
print(test)
|
||||||
|
|
|
@ -26,7 +26,7 @@ from slpkg.__metadata__ import MetaData as m
|
||||||
|
|
||||||
|
|
||||||
def prog_version():
|
def prog_version():
|
||||||
"""Print version, license and email
|
"""Prints version, license and email
|
||||||
"""
|
"""
|
||||||
print(f"Version : {m.__version__}\n"
|
print(f"Version : {m.__version__}\n"
|
||||||
f"Licence : {m.__license__}\n"
|
f"Licence : {m.__license__}\n"
|
||||||
|
|
|
@ -11,30 +11,30 @@ class TestSBoGreps(unittest.TestCase):
|
||||||
"""Test package source
|
"""Test package source
|
||||||
"""
|
"""
|
||||||
source = self.grep.source()
|
source = self.grep.source()
|
||||||
flask_source = ('https://files.pythonhosted.org/packages/4e/0b/'
|
flask_source = ('https://files.pythonhosted.org/packages/source/f'
|
||||||
'cb02268c90e67545a0e3a37ea1ca3d45de3aca43ceb7dbf'
|
'/flask/Flask-2.1.2.tar.gz')
|
||||||
'1712fb5127d5d/Flask-1.1.2.tar.gz')
|
|
||||||
self.assertEqual(source, flask_source)
|
self.assertEqual(source, flask_source)
|
||||||
|
|
||||||
def test_requires(self):
|
def test_requires(self):
|
||||||
"""Test package requires
|
"""Test package requires
|
||||||
"""
|
"""
|
||||||
requires = self.grep.requires()
|
requires = self.grep.requires()
|
||||||
flask_dep = ['werkzeug', 'python3-itsdangerous', 'click']
|
flask_dep = ['werkzeug', 'python3-itsdangerous',
|
||||||
|
'click', 'python-importlib_metadata']
|
||||||
self.assertListEqual(requires, flask_dep)
|
self.assertListEqual(requires, flask_dep)
|
||||||
|
|
||||||
def test_version(self):
|
def test_version(self):
|
||||||
"""Test package version
|
"""Test package version
|
||||||
"""
|
"""
|
||||||
version = self.grep.version()
|
version = self.grep.version()
|
||||||
flask_ver = '1.1.2'
|
flask_ver = '2.1.2'
|
||||||
self.assertEqual(version, flask_ver)
|
self.assertEqual(version, flask_ver)
|
||||||
|
|
||||||
def test_checksum(self):
|
def test_checksum(self):
|
||||||
"""Test package checksum
|
"""Test package checksum
|
||||||
"""
|
"""
|
||||||
checksum = self.grep.checksum()
|
checksum = self.grep.checksum()
|
||||||
flask_md5 = ['0da4145d172993cd28a6c619630cc19c']
|
flask_md5 = ['93f1832e5be704ef6ff2a4124579cd85']
|
||||||
self.assertListEqual(checksum, flask_md5)
|
self.assertListEqual(checksum, flask_md5)
|
||||||
|
|
||||||
def test_description(self):
|
def test_description(self):
|
||||||
|
|
|
@ -12,13 +12,13 @@ class TestSplitting(unittest.TestCase):
|
||||||
pkg_3 = ''.join(list(searching('autoconf-archive', path)))
|
pkg_3 = ''.join(list(searching('autoconf-archive', path)))
|
||||||
pkg_4 = ''.join(list(searching('bind', path)))
|
pkg_4 = ''.join(list(searching('bind', path)))
|
||||||
|
|
||||||
self.assertListEqual(['slpkg', '3.9.6', 'x86_64', '1'],
|
self.assertListEqual(['slpkg', '3.9.9', 'x86_64', '1'],
|
||||||
split_package(pkg_1))
|
split_package(pkg_1))
|
||||||
self.assertListEqual(['akonadi-mime', '21.12.1', 'x86_64', '1'],
|
self.assertListEqual(['akonadi-mime', '21.12.1', 'x86_64', '1'],
|
||||||
split_package(pkg_2))
|
split_package(pkg_2))
|
||||||
self.assertListEqual(['autoconf-archive', '2021.02.19', 'noarch', '1'],
|
self.assertListEqual(['autoconf-archive', '2021.02.19', 'noarch', '1'],
|
||||||
split_package(pkg_3))
|
split_package(pkg_3))
|
||||||
self.assertListEqual(['bind', '9.16.27', 'x86_64', '1'],
|
self.assertListEqual(['bind', '9.16.29', 'x86_64', '1'],
|
||||||
split_package(pkg_4))
|
split_package(pkg_4))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue