Merge branch 'develop'

This commit is contained in:
Dimitris Zlatanidis 2022-05-30 13:09:35 +03:00
commit 49608c5604
62 changed files with 449 additions and 399 deletions

View file

@ -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
Updated:
- Stderr error output to auto-install packages

View file

@ -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
@ -35,9 +35,9 @@ Install from the official third party `SBo repository <https://slackbuilds.org/r
.. code-block:: bash
$ wget slpkg-3.9.9.tar.gz
$ tar xvf slpkg-3.9.9.tar.gz
$ cd slpkg-3.9.9
$ wget slpkg-4.0.0.tar.gz
$ tar xvf slpkg-4.0.0.tar.gz
$ cd slpkg-4.0.0
$ ./install.sh

View file

@ -2,6 +2,8 @@
# Python 3.7+
# GNU wget
# GNU coreutils
# sqlite3
# progress
#
# [OPTIONAL]
# aria2 (alternative downloader)

View file

@ -33,7 +33,7 @@ except ImportError:
docs_requires = []
tests_requires = []
install_requires = []
install_requires = ["progress>=1.6"]
optional_requires = [
"pythondialog>=3.5.1",
"pygraphviz>=1.3.1"

View file

@ -31,8 +31,7 @@ CURRENT = "current"
def remove_repositories(repositories, default_repositories):
"""
Remove no default repositories
"""Removes no default repositories
"""
for repo in repositories:
if repo in default_repositories:
@ -40,8 +39,7 @@ def remove_repositories(repositories, default_repositories):
def update_repositories(repositories, conf_path):
"""
Upadate with user custom repositories
"""Upadate with user custom repositories
"""
repo_file = f"{conf_path}custom-repositories"
if os.path.isfile(repo_file):
@ -56,8 +54,7 @@ def update_repositories(repositories, conf_path):
def grab_sub_repo(repositories, repos):
"""
Grab SUB_REPOSITORY
"""Grabs SUB_REPOSITORY
"""
for i, repo in enumerate(repositories):
if repos in repo:
@ -68,8 +65,7 @@ def grab_sub_repo(repositories, repos):
def select_slack_release(slack_rel):
"""
Warning message if Slackware release not defined or
"""Warning message if Slackware release not defined or
defined wrong
"""
if slack_rel not in [STABLE, CURRENT]:
@ -81,7 +77,7 @@ class MetaData:
__all__ = "slpkg"
__author__ = "dslackw"
__version_info__ = (3, 9, 9)
__version_info__ = (4, 0, 0)
__version__ = "{0}.{1}.{2}".format(*__version_info__)
__license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com"
@ -137,7 +133,7 @@ class MetaData:
"slonly", "ktown", "multi", "slacke", "salix",
"slackl", "rested", "msb", "csb", "connos", "mles"]
# read value from configuration file
# reads values from the configuration file
repositories = []
for files in ["slpkg.conf", "repositories.conf"]:
if os.path.isfile(f"{conf_path}{files}"):
@ -152,7 +148,7 @@ class MetaData:
elif files == "repositories.conf":
repositories.append(line)
# Set values from configuration file
# Sets values from the configuration file
slack_rel = _conf_slpkg["RELEASE"]
slackware_version = _conf_slpkg["SLACKWARE_VERSION"]
comp_arch = _conf_slpkg["COMP_ARCH"]
@ -183,22 +179,22 @@ class MetaData:
# SBo downloading sources path
SBo_SOURCES = build_path + "_SOURCES/"
# Remove any gaps
# Removes any gaps
repositories = [repo.strip() for repo in repositories]
# Check Slackware release
# Checks Slackware release
slack_rel = select_slack_release(slack_rel)
# Grap sub repositories
# Grabs sub repositories
ktown_kde_repo = grab_sub_repo(repositories, "ktown")
slacke_sub_repo = grab_sub_repo(repositories, "slacke")
msb_sub_repo = grab_sub_repo(repositories, "msb")
mles_sub_repo = grab_sub_repo(repositories, "mles")
# remove no default repositories
# removes no default repositories
repositories = list(remove_repositories(repositories,
default_repositories))
# add custom repositories
# adds custom repositories
update_repositories(repositories, conf_path)
color = {
@ -241,13 +237,16 @@ class MetaData:
# slackpkg lib path
slackpkg_lib_path = "/var/lib/slackpkg/"
# database name
db = "/database/database.slpkg"
# computer architecture
if comp_arch in ["off", "OFF"]:
arch = os.uname()[4]
else:
arch = comp_arch
# get sbo OUTPUT enviroment variable
# gets sbo OUTPUT enviroment variable
try:
output = os.environ["OUTPUT"]
except KeyError:

View file

@ -29,7 +29,7 @@ from slpkg.pkg.manager import PackageManager
class AutoInstall:
"""Select Slackware command to install packages
"""Select the Slackware command to install packages
"""
def __init__(self, packages):
self.packages = packages
@ -69,7 +69,7 @@ class AutoInstall:
self.execute()
def execute(self):
"""Execute Slackware command
"""Executes Slackware command
"""
if self.choice in self.commands.keys():
if self.choice == "i":

View file

@ -65,6 +65,6 @@ def pkg_upgrade(repo, skip, flag):
def installed():
"""Return all installed packages
"""Returns all installed packages
"""
return find_package("", _meta_.pkg_path)

View file

@ -40,7 +40,7 @@ class Dependencies:
self.meta = _meta_
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:
sys.setrecursionlimit(10000)

View file

@ -31,7 +31,7 @@ from slpkg.slack.slack_version import slack_ver
def repo_data(PACKAGES_TXT, repo, flag):
"""Grap data packages
"""Grabs data packages
"""
(name, location, size, unsize,
rname, rlocation, rsize, runsize) = ([] for i in range(8))
@ -180,7 +180,7 @@ class Requires:
self.repo = repo
def get_deps(self):
"""Grap package requirements from repositories
"""Grabs package requirements from repositories
"""
if self.repo == "rlw":
dependencies = {}

View file

@ -49,7 +49,7 @@ from slpkg.binary.dependency import Dependencies
class BinaryInstall(BlackList, Utils):
"""Install binaries packages with all dependencies from
"""Installs binaries packages with all dependencies from
repository
"""
def __init__(self, packages, repo, flag):
@ -94,8 +94,7 @@ class BinaryInstall(BlackList, Utils):
self.tmp_path += "/"
def start(self, is_upgrade):
"""
Install packages from official Slackware distribution
"""Installs packages from official Slackware distribution
"""
self.case_insensitive()
# fix if packages is for upgrade
@ -175,7 +174,7 @@ class BinaryInstall(BlackList, Utils):
raise SystemExit(1)
def if_all_installed(self):
"""Check if all packages is already installed
"""Checks if all packages is already installed
"""
count_inst = 0
for inst in (self.dep_install + self.install):
@ -200,7 +199,7 @@ class BinaryInstall(BlackList, Utils):
self.packages[index] = value
def update_deps(self):
"""Update dependencies dictionary with all package
"""Updates dependencies dictionary with all package
"""
for dep in self.dependencies:
deps = self.dimensional_list(Dependencies(
@ -219,7 +218,7 @@ class BinaryInstall(BlackList, Utils):
self.packages = packages
def install_packages(self):
"""Install or upgrade packages
"""Installs or upgrades packages
"""
installs, upgraded = [], []
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)
def resolving_deps(self):
"""Return package dependencies
"""Returns package dependencies
"""
requires = []
if (self.meta.rsl_deps in ["on", "ON"] and
@ -274,7 +273,7 @@ class BinaryInstall(BlackList, Utils):
return self.remove_dbs(requires)
def _fix_deps_repos(self, dependencies):
"""Fix store deps include in repository
"""Fixes store deps include in the repository
"""
for dep in dependencies:
if dep in self.repo_pkg_names:
@ -311,7 +310,7 @@ class BinaryInstall(BlackList, Utils):
return [pkg_sum, res_sum, upg_sum, uni_sum]
def top_view(self):
"""Print packages status bar
"""Prints packages status bar
"""
self.msg.template(78)
print(f"| Package{' ' * 17}New Version{' ' * 8}Arch{' ' * 4}"
@ -319,7 +318,7 @@ class BinaryInstall(BlackList, Utils):
self.msg.template(78)
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))
# name = data[0]

View file

@ -31,7 +31,7 @@ from slpkg.slack.slack_version import slack_ver
class RepoInit(Utils):
"""Return PACKAGES.TXT and mirror by repository
"""Returns PACKAGES.TXT and mirror by repository
"""
def __init__(self, repo):
self.repo = repo

View file

@ -28,7 +28,7 @@ from slpkg.__metadata__ import MetaData as _meta_
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.
"""
utils = Utils()

View file

@ -30,7 +30,7 @@ from slpkg.__metadata__ import MetaData as _meta_
class BlackList(Utils):
"""Blacklist class to add, remove or listed packages
"""Blacklist class to add, remove or list packages
in blacklist file."""
def __init__(self):
self.green = _meta_.color["GREEN"]
@ -56,8 +56,8 @@ class BlackList(Utils):
yield black
def black_filter(self):
"""Return all the installed files that start
by the name*
"""Returns all the installed files that start
by the name
"""
for read in self.black_conf.splitlines():
read = read.lstrip()
@ -65,7 +65,7 @@ class BlackList(Utils):
yield read.replace("\n", "")
def black_listed(self):
"""Print blacklist packages
"""Prints blacklist packages
"""
print("Packages in the blacklist:")
for black in list(self.black_filter()):
@ -74,7 +74,7 @@ class BlackList(Utils):
print()
def black_add(self, pkgs):
"""Add blacklist packages if not exist
"""Adds blacklist packages if not exist
"""
blacklist = list(self.black_filter())
pkgs = set(pkgs)
@ -87,7 +87,7 @@ class BlackList(Utils):
print()
def black_remove(self, pkgs):
"""Remove packages from blacklist
"""Removes packages from blacklist
"""
print("Remove packages from the blacklist:")
with open(self.blackfile, "w") as remove:

View file

@ -29,7 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
def clean_tmp():
"""Delete packages and sources from tmp/ directory
"""Deletes packages and sources from tmp/ directory
"""
tmps = [_meta_.tmp_path, # /tmp/slpkg/
_meta_.build_path, # /tmp/slpkg/build/

View file

@ -30,7 +30,7 @@ from slpkg.sbo.greps import SBoGrep
class PkgDesc(Utils):
"""Print package description from the repository
"""Prints package description from the repository
"""
def __init__(self, name, repo, paint):
self.name = name
@ -51,7 +51,7 @@ class PkgDesc(Utils):
self.lib = f"{self.meta.lib_path}{self.repo}_repo/PACKAGES.TXT"
def view(self):
"""Print package description by repository
"""Prints package description by repository
"""
description, count = "", 0
if self.repo == "sbo":

View file

@ -28,7 +28,7 @@ import os
class DialogUtil:
"""Create dialog checklist
"""Creates dialog checklist
"""
def __init__(self, *args):
self.imp_dialog()
@ -48,7 +48,7 @@ class DialogUtil:
self.d = Dialog(dialog="dialog", autowidgetsize=True)
def checklist(self):
"""Run dialog checklist
"""Runs dialog checklist
"""
choice = []
for item in self.data:
@ -63,7 +63,7 @@ class DialogUtil:
self.exit()
def buildlist(self, enabled):
"""Run dialog buildlist
"""Runs dialog buildlist
"""
choice = []
for item in self.data:
@ -81,7 +81,7 @@ class DialogUtil:
self.exit()
def exit(self):
"""Exit from dialog
"""Exits from dialog
"""
self.clear_screen()
raise SystemExit()
@ -92,7 +92,7 @@ class DialogUtil:
os.system("clear")
def unicode_to_string(self):
"""Convert unicode in string
"""Converts unicode in string
"""
for tag in self.tags:
self.ununicode.append(str(tag))

View file

@ -51,7 +51,7 @@ class Download(Utils):
self.downder_options = self.meta.downder_options
def start(self):
"""Download files using wget or other downloader.
"""Download files using wget or other downloaders.
Optional curl, aria2c and httpie
"""
dwn_count = 1
@ -82,7 +82,7 @@ class Download(Utils):
dwn_count += 1
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:
tar.add(source_dir, arcname=os.path.basename(source_dir))
@ -96,7 +96,7 @@ class Download(Utils):
self.dir_prefix = "--dir="
def _check_if_downloaded(self):
"""Check if file downloaded
"""Checks if file downloaded
"""
if not os.path.isfile(self.path + self.file_name):
print()
@ -109,7 +109,7 @@ class Download(Utils):
raise SystemExit()
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
self.downder == "wget"):

View file

@ -29,7 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
class FileSize:
"""Check local or remote file size
"""Checks local or remote file size
"""
def __init__(self, registry):
self.meta = _meta_

View file

@ -47,7 +47,7 @@ class Graph:
]
def dependencies(self, deps_dict):
"""Generate graph file with depenndencies map tree
"""Generates graph file with dependencies map tree
"""
try:
import pygraphviz as pgv
@ -75,7 +75,7 @@ class Graph:
raise SystemExit()
def check_file(self):
"""Check for file format and type
"""Checks for file format and type
"""
try:
image_type = f".{self.image.split('.')[1]}"
@ -87,7 +87,7 @@ class Graph:
raise SystemExit("slpkg: Error: Image file suffix missing")
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"):
print("Require 'graph-easy': Install with 'slpkg -s sbo"
@ -99,7 +99,7 @@ class Graph:
raise SystemExit(1)
def remove_dot(self):
"""Remove .dot files
"""Removes .dot files
"""
if os.path.isfile(f"{self.image}.dot"):
os.remove(f"{self.image}.dot")

View file

@ -29,7 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
def pkg_checksum(binary, repo):
"""Return checksum from CHECKSUMS.md5 file by repository
"""Returns checksum from CHECKSUMS.md5 file by repository
"""
md5 = "None"
if repo == "slack_patches" and _meta_.slack_rel == "stable":

View file

@ -31,7 +31,7 @@ from slpkg.pkg.find import find_package
class PackageHealth:
"""Health check installed packages
"""Health check for the installed packages
"""
def __init__(self, mode):
self.mode = mode
@ -46,7 +46,7 @@ class PackageHealth:
self.cn = 0
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)
@ -67,7 +67,7 @@ class PackageHealth:
raise SystemExit("\n")
def test(self):
"""Get started test each package and read file list
"""Starts testing each package and reading the file list
"""
self.packages()
self.cf = 0
@ -86,7 +86,7 @@ class PackageHealth:
self.results()
def results(self):
"""Print results
"""Prints results
"""
print()
per = int(round((float(self.cf) / (self.cf + self.cn)) * 100))

View file

@ -24,6 +24,8 @@
import os
import shutil
import sqlite3
from models.models import Database
from slpkg.utils import Utils
from slpkg.repositories import Repo
@ -36,15 +38,13 @@ from slpkg.slack.slack_version import slack_ver
class Initialization(Utils):
"""Slpkg initialization start all from here. Create local
package lists and update or upgrade these.
"""Slpkg initialization starts all from here.
Creates local package lists and updates or upgrades these.
"""
def __init__(self, check):
self.check = check
self.meta = _meta_
self.arch = _meta_.arch
self.slack_ver = slack_ver()
self.def_repos_dict = Repo().default_repository()
self.conf_path = self.meta.conf_path
self.log_path = self.meta.log_path
self.lib_path = self.meta.lib_path
@ -53,6 +53,8 @@ class Initialization(Utils):
self._SOURCES = self.meta.SBo_SOURCES
self.slpkg_tmp_packages = self.meta.slpkg_tmp_packages
self.slpkg_tmp_patches = self.meta.slpkg_tmp_patches
self.slack_ver = slack_ver()
self.def_repos_dict = Repo().default_repository()
self.constructing()
def constructing(self):
@ -74,6 +76,15 @@ class Initialization(Utils):
self.make_dir(paths_basic)
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):
for p in path:
@ -86,7 +97,7 @@ class Initialization(Utils):
os.makedirs(p)
def custom(self, name):
"""Creating user select repository local library
"""Creating user custom repository local library
"""
repo = Repo().custom_repository()[name]
log = self.log_path + name + "/"
@ -588,14 +599,14 @@ class Initialization(Utils):
FILELIST_TXT, repo_name)
def down(self, path, link, repo):
"""Download files
"""Downloads files
"""
filename = link.split("/")[-1]
if not os.path.isfile(path + filename):
Download(path, link.split(), repo).start()
def remote(self, *args):
"""Remove and recreate files
"""Removes and recreates files
"""
log_path = args[0]
ChangeLog_txt = args[1]
@ -626,9 +637,12 @@ class Initialization(Utils):
self.down(lib_path, CHECKSUMS_MD5, repo)
self.down(lib_path, FILELIST_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):
"""Merge files
"""Merging files
"""
code = "utf-8"
with open(path + outfile, 'w', encoding=code) as out_f:
@ -641,7 +655,7 @@ class Initialization(Utils):
out_f.write(line)
def file_remove(self, path, filename):
"""Check if filename exists and remove
"""Checks if filename exists and removes
"""
if os.path.isfile(path + filename):
os.remove(path + filename)
@ -704,7 +718,7 @@ class Update:
self.error = f"{self.red}Error{self.endc}\n"
def run(self, repos):
"""Update repositories lists
"""Updates repositories lists
"""
print("\nCheck and update repositories:\n")
default = self.meta.default_repositories
@ -728,8 +742,17 @@ class Update:
else:
print(self.error, end="")
print() # new line at end
self.check_db()
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):
print(f"{self.grey}Check repository "
f"[{self.cyan}{repo}{self.grey}] ... "
@ -749,7 +772,7 @@ def check_exists_repositories(repo):
def check_for_local_repos(repo):
"""Check if repository is local
"""Checks if repository is local
"""
repos_dict = Repo().default_repository()
if repo in repos_dict:

View file

@ -32,7 +32,7 @@ from slpkg.pkg.find import find_package
def library(repo):
"""Load packages from slpkg library and from local
"""Loads packages from slpkg library and from local
"""
utils = Utils()
pkg_list, packages = [], ""
@ -59,7 +59,7 @@ def library(repo):
class Regex:
"""Grap packages with simple regex using asterisk *
"""Graps packages with simple regex using asterisk *
with options: starts with string*
ends with *string
include *string*
@ -90,7 +90,7 @@ class Regex:
return lib
def add(self, repo, pkg):
"""Split packages by repository
"""Splits packages by repository
"""
if repo == "sbo":
return pkg

View file

@ -30,8 +30,8 @@ from slpkg.pkg.find import find_package
def write_deps(deps_dict):
"""Write dependencies in a log file
into directory `/var/log/slpkg/dep/`
"""Writes dependencies in a log file
into the directory `/var/log/slpkg/dep/`
"""
for name, dependencies in deps_dict.items():
if find_package(f"{name}-", _meta_.pkg_path):

View file

@ -25,12 +25,12 @@
import os
import sys
from slpkg.clean import clean_tmp
from slpkg.load import Regex
from slpkg.desc import PkgDesc
from slpkg.messages import Msg
from slpkg.config import Config
from slpkg.checks import Updates
from slpkg.clean import clean_tmp
from slpkg.repoinfo import RepoInfo
from slpkg.repolist import RepoList
from slpkg.repositories import Repo
@ -99,7 +99,7 @@ class ArgParse(BlackList):
"-f", "--find"
]
# checking if repositories exists
# checking if the repositories exist
enabled_repos = _meta_.repositories
if len(self.args) > 1:
@ -126,7 +126,7 @@ class ArgParse(BlackList):
usage("", 1)
def command_update(self):
"""Update package lists repositories
"""Updates package lists repositories
"""
update = Update()
@ -143,7 +143,7 @@ class ArgParse(BlackList):
usage("", 1)
def command_upgrade(self):
"""Recreate repositories package lists
"""Recreates repositories package lists
"""
upgrade = Upgrade()
@ -185,7 +185,7 @@ class ArgParse(BlackList):
usage("", 1)
def command_repo_add(self):
"""Add custom repositories
"""Adds custom repositories
"""
if len(self.args) == 3 and self.args[0] == "repo-add":
Repo().add(self.args[1], self.args[2])
@ -193,7 +193,7 @@ class ArgParse(BlackList):
usage("", 1)
def command_repo_remove(self):
"""Remove custom repositories
"""Removes custom repositories
"""
if len(self.args) == 2 and self.args[0] == "repo-remove":
Repo().remove(self.args[1])
@ -214,7 +214,7 @@ class ArgParse(BlackList):
usage("", 1)
def command_health(self):
"""Check package health
"""Checks package health
"""
if len(self.args) == 1 and self.args[0] == "health":
PackageHealth(mode="").test()
@ -225,7 +225,7 @@ class ArgParse(BlackList):
usage("", 1)
def command_deps_status(self):
"""Print dependencies status
"""Prints dependencies status
"""
image = ""
@ -247,7 +247,7 @@ class ArgParse(BlackList):
usage("", 1)
def command_new_config(self):
"""Manage .new configuration files
"""Manages .new configuration files
"""
if len(self.args) == 1 and self.args[0] == "new-config":
NewConfig().run()
@ -307,7 +307,7 @@ class ArgParse(BlackList):
usage("", 1)
def pkg_upgrade(self):
"""Check and upgrade packages by repository
"""Checks and upgrade packages by repository
"""
options = [
"-c",
@ -322,7 +322,7 @@ class ArgParse(BlackList):
]
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
# if flags[3] in self.args:
# self.args.remove(flags[3])
@ -351,7 +351,7 @@ class ArgParse(BlackList):
usage("", 1)
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
for arg in self.args[2:]:
@ -373,7 +373,7 @@ class ArgParse(BlackList):
return flag, skip
def pkg_install(self):
"""Install packages by repository
"""Installs packages by repository
"""
flag = []
options = [
@ -451,7 +451,7 @@ class ArgParse(BlackList):
usage("", 1)
def sbo_network(self):
"""View slackbuilds packages
"""Views slackbuilds packages
"""
flag = []
options = [
@ -479,7 +479,7 @@ class ArgParse(BlackList):
usage("sbo", 1)
def pkg_blacklist(self):
"""Manage blacklist packages
"""Manages blacklist packages
"""
options = [
"-b",
@ -509,7 +509,7 @@ class ArgParse(BlackList):
usage("", 1)
def pkg_queue(self):
"""Manage packages in queue
"""Manages packages in queue
"""
queue = QueuePkgs()
options = [
@ -555,7 +555,7 @@ class ArgParse(BlackList):
usage("", 1)
def bin_install(self):
"""Install Slackware binary packages
"""Installs Slackware binary packages
"""
packages = self.args[1:]
options = [
@ -583,7 +583,7 @@ class ArgParse(BlackList):
usage("", 1)
def bin_upgrade(self):
"""Install-upgrade Slackware binary packages
"""Installs, upgrades Slackware binary packages
"""
packages = self.args[1:]
options = [
@ -651,7 +651,7 @@ class ArgParse(BlackList):
usage("", 1)
def bin_find(self):
"""Find installed packages
"""Finds installed packages
"""
flag = []
options = [
@ -681,7 +681,7 @@ class ArgParse(BlackList):
usage("", 1)
def pkg_desc(self):
"""Print slack-desc by repository
"""Prints slack-desc by repository
"""
options = [
"-p",
@ -722,7 +722,7 @@ class ArgParse(BlackList):
usage("", 1)
def pkg_find(self):
"""Find packages from all enabled repositories
"""Finds packages from all the enabled repositories
"""
flag = []
options = [
@ -743,7 +743,7 @@ class ArgParse(BlackList):
usage("", 1)
def pkg_contents(self):
"""Print packages contents
"""Prints packages contents
"""
packages = self.args[1:]
options = [
@ -757,7 +757,7 @@ class ArgParse(BlackList):
usage("", 1)
def congiguration(self):
"""Manage slpkg configuration file
"""Manages slpkg configuration file
"""
options = [
"-g",
@ -770,7 +770,7 @@ class ArgParse(BlackList):
]
conf = Config()
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]:
conf.view()
@ -782,7 +782,7 @@ class ArgParse(BlackList):
usage("", 1)
def auto_detect(self, args):
"""Check for already Slackware binary packages exist
"""Checks for already Slackware binary packages
"""
suffixes = [
".tgz",

View file

@ -39,23 +39,15 @@ class Msg:
self.endc = _meta_.color["ENDC"]
def pkg_not_found(self, bol, pkg, message, eol):
"""Print message when package not found
"""
print(f"{bol}No such package {pkg}: {message}{eol}")
def pkg_found(self, prgnam):
"""Print message when package found
"""
print(f"| Package {prgnam} is already installed")
def pkg_installed(self, pkg):
"""Print message when package installed
"""
print(f"| Package {pkg} installed")
def build_FAILED(self, prgnam):
"""Print error message if build failed
"""
self.template(78)
print(f"| Some error on the package {prgnam} "
f"[ {self.red}FAILED{self.endc} ]")
@ -67,59 +59,41 @@ class Msg:
print() # new line at end
def template(self, max_len):
"""Print template
"""
print("+" + "=" * max_len)
def checking(self):
"""Message checking
"""
print(f"{self.grey}Checking...{self.endc} ", end="", flush=True)
def reading(self):
"""Message reading
"""
print(f"{self.grey}Reading package lists...{self.endc} ",
end="", flush=True)
def resolving(self):
"""Message resolving
"""
print(f"{self.grey}Resolving dependencies...{self.endc} ",
end="", flush=True)
def done(self):
"""Message done
"""
print(f"\b{self.green}Done{self.endc}\n", end="")
def pkg(self, count):
"""Print singular plural
"""
message = "package"
if count > 1:
message = message + "s"
return message
def not_found(self, if_upgrade):
"""Message not found packages
"""
if if_upgrade:
print("\nNot found packages for upgrade\n")
else:
print("\nNot found packages for installation\n")
def upg_inst(self, if_upgrade):
"""Message installing or upgrading
"""
if not if_upgrade:
print("Installing:")
else:
print("Upgrading:")
def answer(self):
"""Message answer
"""
if self.meta.default_answer in ["y", "Y"]:
answer = self.meta.default_answer
else:
@ -130,8 +104,6 @@ class Msg:
return answer
def security_pkg(self, pkg):
"""Warning message for some special reasons
"""
print()
self.template(78)
print(f"| {' ' * 27}{self.red}*** WARNING ***{self.endc}")
@ -143,9 +115,6 @@ class Msg:
print()
def reference(self, install, upgrade):
"""Reference list with packages installed
and upgraded
"""
self.template(78)
print(f"| Total {len(install)} {self.pkg(len(install))} installed and "
f"{len(upgrade)} {self.pkg(len(upgrade))} upgraded")
@ -159,8 +128,6 @@ class Msg:
print()
def matching(self, packages):
"""Message for matching packages
"""
print(f"\nNot found package with the name "
f"[ {self.cyan}{''.join(packages)}{self.endc} ]. "
"Matching packages:\nNOTE: Not dependencies are resolved\n")

0
slpkg/models/__init.py__ Normal file
View file

103
slpkg/models/models.py Normal file
View 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()

View file

@ -32,7 +32,7 @@ from slpkg.__metadata__ import MetaData as _meta_
class NewConfig(Utils):
"""Manage .new configuration files
"""Manages .new configuration files
"""
def __init__(self):
self.meta = _meta_
@ -47,7 +47,7 @@ class NewConfig(Utils):
self.news = []
def run(self):
"""print .new configuration files
"""prints .new configuration files
"""
self.find_new()
for n in self.news:
@ -59,7 +59,7 @@ class NewConfig(Utils):
self.choices()
def find_new(self):
"""Find all '.new' files from /etc/ folder
"""Finds all '.new' files from /etc/ folder
and subfolders
"""
print("Search for .new configuration files:\n")
@ -97,14 +97,14 @@ class NewConfig(Utils):
self.prompt()
def overwrite_all(self):
"""Overwrite all .new files and keep
"""Overwrites all .new files and keep
old with suffix .old
"""
for n in self.news:
self._overwrite(n)
def remove_all(self):
"""Remove all .new files
"""Removes all .new files
"""
for n in self.news:
self._remove(n)
@ -131,7 +131,7 @@ class NewConfig(Utils):
raise SystemExit("\n")
def question(self, n):
"""Choose what do to file by file
"""Chooses what do to file by file
"""
print()
prompt_ask = input(f"{n} [K/O/R/D/M/Q]? ")
@ -151,7 +151,7 @@ class NewConfig(Utils):
self.quit()
def _remove(self, n):
"""Remove one single file
"""Removes one single file
"""
if os.path.isfile(n):
os.remove(n)
@ -159,7 +159,7 @@ class NewConfig(Utils):
print(f"File '{n}' removed")
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]):
shutil.copy2(n[:-4], n[:-4] + ".old")
@ -174,7 +174,7 @@ class NewConfig(Utils):
pass
def diff(self, n):
"""Print the differences between the two files
"""Prints the differences between the two files
"""
if os.path.isfile(n[:-4]):
diff1 = self.read_file(n[:-4]).splitlines()
@ -203,7 +203,7 @@ class NewConfig(Utils):
lines.append(a)
def merge(self, n):
"""Merge new file into old
"""Merges new file into old
"""
if os.path.isfile(n[:-4]):
old = self.read_file(n[:-4]).splitlines()

View file

@ -41,7 +41,7 @@ from slpkg.sbo.greps import SBoGrep
class BuildPackage(Utils):
"""Build SBo packages from source
"""Builds SBo packages from source
"""
def __init__(self, script, sources, path, auto):
self.script = script
@ -66,10 +66,9 @@ class BuildPackage(Utils):
os.mkdir(self.build_logs)
def build(self):
"""
Build package from source and create log
"""Builds package from source and creates log
file in path /var/log/slpkg/sbo/build_logs/.
Also check md5sum calculates.
Also checks the md5sum calculation.
"""
try:
self._delete_dir()
@ -115,7 +114,7 @@ class BuildPackage(Utils):
self.msg.pkg_not_found("\n", self.prgnam, "Wrong file", "\n")
def _check_sources(self):
"""Fix filenames with char +
"""Fixes filenames with char +
"""
new_sources = []
for src in self.sources:
@ -123,7 +122,7 @@ class BuildPackage(Utils):
self.sources = new_sources
def _create_md5_dict(self):
"""Create md5 dictionary per source
"""Creates md5 dictionary per source
"""
self.sbo_md5 = {}
md5_lists = SBoGrep(self.prgnam).checksum()
@ -131,7 +130,7 @@ class BuildPackage(Utils):
self.sbo_md5[src] = md5
def _makeflags(self):
"""Set variable MAKEFLAGS with the numbers of
"""Sets variable MAKEFLAGS with the numbers of
processors
"""
if self.meta.makeflags in ["on", "ON"]:
@ -139,7 +138,7 @@ class BuildPackage(Utils):
os.environ["MAKEFLAGS"] = f"-j{cpus}"
def _pass_variable(self):
"""Return enviroment variables
"""Returns enviroment variables
"""
pass_var = []
for var in os.environ.keys():
@ -149,21 +148,20 @@ class BuildPackage(Utils):
return pass_var
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):
os.remove(self.meta.build_path + self.script)
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):
shutil.rmtree(self.meta.build_path + self.prgnam)
def log_head(path, log_file, log_time):
"""
write headers to log file
"""Writes headers to log file
"""
with open(path + log_file, "w") as log:
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):
"""
append END tag to a log file
"""Appends END tag to a log file
"""
with open(path + log_file, "a") as log:
log.seek(2)
@ -188,8 +185,7 @@ def log_end(path, log_file, sum_time):
def build_time(start_time):
"""
Calculate build time per package
"""Calculates build time per package
"""
diff_time = round(time.time() - start_time, 2)
if diff_time <= 59.99:

View file

@ -29,7 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
class GetFromInstalled:
"""Find and return version and package name from
"""Finds and returns version and package name from
already installed packages
"""
def __init__(self, package):
@ -42,14 +42,14 @@ class GetFromInstalled:
self.find = file
def version(self):
"""Return version from installed packages
"""Returns version from installed packages
"""
if self.find:
return split_package(self.find)[1]
return self.find
def name(self):
"""Return installed package name
"""Returns installed package name
"""
if self.find:
return self.package

View file

@ -58,7 +58,7 @@ class PackageManager(Utils):
self.unit = "Kb"
def install(self, flag):
"""Install Slackware binary packages
"""Installs Slackware binary packages
"""
for pkg in self.binary:
try:
@ -73,7 +73,7 @@ class PackageManager(Utils):
raise SystemExit(1)
def upgrade(self, flag):
"""Upgrade Slackware binary packages with new
"""Upgrades Slackware binary packages with new
"""
for pkg in self.binary:
try:
@ -95,7 +95,7 @@ class PackageManager(Utils):
self.msg.pkg_not_found(bol, pkg, message, eol)
def remove(self, flag, extra):
"""Remove Slackware binary packages
"""Removes Slackware binary packages
"""
self.flag = flag
self.extra = extra
@ -120,10 +120,9 @@ class PackageManager(Utils):
if remove_pkg in ["y", "Y"]:
self._check_if_used(self.binary)
for rmv in self.removed:
'''
If package build and install with "slpkg -s sbo <package>"
then look log file for dependencies in /var/log/slpkg/dep,
read and remove all else remove only the package.
'''If package build and install with "slpkg -s sbo <package>"
then looks in the log file for dependencies "/var/log/slpkg/dep",
reads and removes all but remove only the package.
'''
if (os.path.isfile(self.dep_path + rmv) and
self.meta.del_deps in ["on", "ON"] or
@ -141,7 +140,7 @@ class PackageManager(Utils):
self._reference_rmvs(rmv_list)
def _rmv_deps_answer(self):
"""Remove dependencies answer
"""Removes dependencies answer
"""
if self.meta.remove_deps_answer in ["y", "Y"]:
remove_dep = self.meta.remove_deps_answer
@ -156,7 +155,7 @@ class PackageManager(Utils):
return remove_dep
def _get_removed(self):
"""Manage removed packages by extra options
"""Manages removed packages by extra options
"""
extra = self.extra
removed, packages, pkg = [], [], ""
@ -195,7 +194,7 @@ class PackageManager(Utils):
return removed, packages
def _view_removed(self):
"""View packages before removed
"""Views packages before removed
"""
print("Packages with name matching [ {0}{1}{2} ]\n".format(
self.cyan, ", ".join(self.binary), self.endc))
@ -248,7 +247,7 @@ class PackageManager(Utils):
self.grey, round(self.size, 2), self.unit, self.endc))
def _view_deps(self, path, package):
"""View dependencies before remove
"""Views dependencies before remove
"""
self.size = 0
packages = []
@ -297,7 +296,7 @@ class PackageManager(Utils):
raise SystemExit(er)
def _rmv_deps(self, dependencies, package):
"""Remove dependencies
"""Removes dependencies
"""
removes = []
dependencies.append(package)
@ -310,7 +309,7 @@ class PackageManager(Utils):
return removes
def _rmv_pkg(self, package):
"""Remove one signle package
"""Removes one signle package
"""
removes = []
if GetFromInstalled(package).name() and package not in self.skip:
@ -335,7 +334,7 @@ class PackageManager(Utils):
self.removed.remove(s)
def _check_if_used(self, removes):
"""Check package if dependencies for another package
"""Checks package if dependencies for another package
before removed"""
if "--check-deps" in self.extra:
package, dependency, pkg_dep = [], [], []
@ -387,7 +386,7 @@ class PackageManager(Utils):
print() # new line at end
def find(self, flag):
"""Find installed Slackware packages
"""Finds installed Slackware packages
"""
matching, packages = 0, []
pkg_cache, match_cache = "", ""
@ -447,7 +446,7 @@ class PackageManager(Utils):
break
def display(self):
"""Print the Slackware packages contents
"""Prints the Slackware packages contents
"""
for pkg in self.binary:
name = GetFromInstalled(pkg).name()
@ -502,7 +501,7 @@ class PackageManager(Utils):
raise SystemExit(1)
def _splitting_packages(self, pkg, repo, name):
"""Return package name from repositories
"""Returns package name from repositories
"""
if name and repo != "sbo":
pkg = split_package(pkg)[0]
@ -511,7 +510,7 @@ class PackageManager(Utils):
return pkg
def list_greps(self, repo, packages):
"""Grep packages
"""Grabs packages
"""
pkg_list, pkg_size = [], []
for line in packages.splitlines():
@ -529,7 +528,7 @@ class PackageManager(Utils):
return pkg_list, pkg_size
def list_lib(self, repo):
"""Return package lists
"""Returns package lists
"""
packages = ""
if repo == "sbo":
@ -545,7 +544,7 @@ class PackageManager(Utils):
return packages
def list_color_tag(self, pkg):
"""Tag with color installed packages
"""Tag with colour installed packages
"""
name = GetFromInstalled(pkg).name()
find = f"{name}-"
@ -556,7 +555,7 @@ class PackageManager(Utils):
return pkg
def list_of_installed(self, repo, name):
"""Return installed packages
"""Returns installed packages
"""
all_installed_names = []
all_installed_packages = find_package("", self.meta.pkg_path)
@ -573,7 +572,7 @@ class PackageManager(Utils):
def alien_filter(packages, sizes):
"""This filter avoid list double packages from
"""This filter avoids listing double packages from
alien repository
"""
cache, npkg, nsize = [], [], []

View file

@ -29,7 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
class FindFromRepos:
"""Find packages from all enabled repositories
"""Finds packages from all enabled repositories
"""
def __init__(self):
self.cache = ""
@ -44,7 +44,7 @@ class FindFromRepos:
self.endc = self.meta.color["ENDC"]
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}"
f"{', '.join(pkg)}{self.endc} ]\n")
@ -78,8 +78,7 @@ class FindFromRepos:
f"{self.count_repo} repositories.{self.endc}\n")
def sbo_version(self, repo, find):
"""
Add version to SBo packages
"""Adds version to SBo packages
"""
ver = ""
if repo == "sbo":

View file

@ -30,7 +30,7 @@ from slpkg.__metadata__ import MetaData as _meta_
def delete_package(path, packages):
"""Delete downloaded packages
"""Deletes downloaded packages
"""
if _meta_.del_all in ["on", "ON"]:
for pkg in packages:
@ -38,7 +38,7 @@ def delete_package(path, packages):
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):
shutil.rmtree(folder)

View file

@ -31,7 +31,7 @@ from slpkg.__metadata__ import MetaData as _meta_
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
"""
def __init__(self):
@ -77,7 +77,7 @@ Keys: SPACE select or deselect the highlighted repositories,
self.reference()
def read_enabled(self):
"""Read enable repositories
"""Reads enabled repositories
"""
for line in self.conf.splitlines():
line = line.lstrip()
@ -89,7 +89,7 @@ Keys: SPACE select or deselect the highlighted repositories,
self.tag_line = False
def read_disabled(self):
"""Read disable repositories
"""Reads disabled repositories
"""
for line in self.conf.splitlines():
line = line.lstrip()
@ -101,7 +101,7 @@ Keys: SPACE select or deselect the highlighted repositories,
self.tag_line = False
def update_repos(self):
"""Update repositories.conf file with enabled or disabled
"""Updates repositories.conf file with enabled or disabled
repositories
"""
with open(f"{self.meta.conf_path}"

View file

@ -56,8 +56,7 @@ class RepoInfo(Utils):
del RepoList().all_repos
def view(self, repo):
"""
View repository information
"""Views repository information
"""
status = f"{self.red}disabled{self.endc}"
self.form["Status:"] = status
@ -109,7 +108,7 @@ class RepoInfo(Utils):
print(f"{self.green}{key}{self.endc} {value}")
def repository_data(self, repo):
"""Grap data packages
"""Graps data packages
"""
sum_pkgs, size, unsize, last_upd = 0, [], [], ""
f = f"{self.meta.lib_path}{repo}_repo/PACKAGES.TXT"

View file

@ -29,7 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
class Repo(Utils):
"""Manage repositories configuration files
"""Manages repositories configuration files
"""
def __init__(self):
self.meta = _meta_
@ -43,7 +43,7 @@ class Repo(Utils):
self.default_repository()
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 = []
if not url.endswith("/"):
@ -67,7 +67,7 @@ class Repo(Utils):
print(f"\nRepository '{repo}' successfully added\n")
def remove(self, repo):
"""Remove custom repository
"""Removes custom repository
"""
rem_repo = False
with open(self.custom_repo_file, "w") as repos:
@ -83,7 +83,7 @@ class Repo(Utils):
print(f"\nRepository '{repo}' doesn't exist\n")
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 = {}
for line in self.custom_repositories_list.splitlines():
@ -93,7 +93,7 @@ class Repo(Utils):
return custom_dict_repo
def default_repository(self):
"""Return dictionary with default repo name and url
"""Returns dictionary with default repo name and url
"""
default_dict_repo = {}
for line in self.default_repositories_list.splitlines():

View file

@ -41,20 +41,20 @@ class AutoBuild:
self.sbo_sources = []
def run(self):
"""Build package and fix ordelist per checksum
"""Builds package and fix ordelist per checksum
"""
self.files_exist()
self.info_file()
sources = self.sources
if len(sources) > 1 and self.sbo_sources != 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.
BuildPackage(self.script, sources, self.path, auto=True).build()
raise SystemExit()
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()
for source in sources:

View file

@ -30,7 +30,7 @@ from slpkg.__metadata__ import MetaData as _meta_
class BuildNumber(Utils):
"""Get build number from SlackBuild script
"""Gets build number from SlackBuild script
"""
def __init__(self, sbo_url, pkg):
self.sbo_url = sbo_url

View file

@ -35,7 +35,7 @@ from slpkg.sbo.greps import SBoGrep
def sbo_upgrade(skip, flag):
"""Return packages for upgrade
"""Returns packages for upgrade
"""
msg = Msg()
black = BlackList()
@ -58,7 +58,7 @@ def sbo_upgrade(skip, flag):
def sbo_list():
"""Return all SBo packages
"""Returns all SBo packages
"""
for pkg in os.listdir(_meta_.pkg_path):
if pkg.endswith("_SBo"):

View file

@ -23,12 +23,10 @@
class SBoLink:
"""Create slackbuild tar.gz archive from url
"""Creates slackbuild tar.gz archive from url
"""
def __init__(self, sbo_url):
self.sbo_url = sbo_url
def tar_gz(self):
"""Return link slackbuild tar.gz archive
"""
return f"{self.sbo_url[:-1]}.tar.gz"

View file

@ -44,7 +44,7 @@ class Requires(BlackList):
@lru_cache
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
"--resolve-off" not in self.flag):
@ -53,8 +53,8 @@ class Requires(BlackList):
requires = SBoGrep(name).requires()
if requires:
for req in requires:
# avoid to add %README% as dependency and
# if require in blacklist
# avoids adding %README% as dependency and if
# requires in the blacklist
if "%README%" not in req and req not in self.blacklist:
dependencies.append(req)
self.deep_check(tuple(dependencies))
@ -64,7 +64,7 @@ class Requires(BlackList):
@lru_cache
def deep_check(self, dependencies):
"""Checking if dependencies are finnished
"""Checking if dependencies are finished
"""
if dependencies:
self.dep_results.append(dependencies)

View file

@ -22,37 +22,29 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sqlite3
from slpkg.utils import Utils
from slpkg.__metadata__ import MetaData as _meta_
class SBoGrep(Utils):
"""Grab data from SLACKBUILDS.TXT file
"""Grabs data from sbo database
"""
def __init__(self, name):
self.name = name
self.meta = _meta_
arch64 = "x86_64"
self.line_name = "SLACKBUILD NAME: "
self.line_files = "SLACKBUILD FILES: "
self.line_down = "SLACKBUILD DOWNLOAD: "
self.line_down_64 = f"SLACKBUILD DOWNLOAD_{arch64}: "
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)
self.db = self.meta.db
self.arch64 = "x86_64"
self.sbo_db = f"{self.meta.lib_path}{self.db}"
self.con = sqlite3.connect(self.sbo_db)
self.cur = self.con.cursor()
def _names_grabbing(self):
"""Generator that collecting all packages names
"""
for line in self.SLACKBUILDS_TXT.splitlines():
if line.startswith(self.line_name):
yield line[17:].strip()
names = self.cur.execute("SELECT name FROM sbo").fetchall()
for n in names:
yield n[0]
def names(self):
"""Alias method convert generator and return
@ -61,102 +53,67 @@ class SBoGrep(Utils):
return list(self._names_grabbing())
def source(self):
"""Grab sources downloads links
"""Grabs sources downloads links
"""
source, source64, = "", ""
for line in self.SLACKBUILDS_TXT.splitlines():
if line.startswith(self.line_name):
sbo_name = line[17:].strip()
if line.startswith(self.line_down):
if sbo_name == self.name and line[21:].strip():
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
source, source64 = self.cur.execute("""SELECT download, download64
FROM sbo
WHERE name = '{}'""".format(
self.name)).fetchone()
return self._sorting_arch(source, source64)
def requires(self):
"""Grab package requirements
"""Grabs package requirements
"""
for line in self.SLACKBUILDS_TXT.splitlines():
if line.startswith(self.line_name):
sbo_name = line[17:].strip()
if line.startswith(self.line_req):
if sbo_name == self.name:
return line[21:].strip().split()
requires = self.cur.execute("""SELECT requires
FROM sbo
WHERE name = '{}'""".format(
self.name)).fetchone()
return requires[0].split()
def version(self):
"""Grab package version
"""Grabs package version
"""
for line in self.SLACKBUILDS_TXT.splitlines():
if line.startswith(self.line_name):
sbo_name = line[17:].strip()
if line.startswith(self.line_ver):
if sbo_name == self.name:
return line[20:].strip()
version = self.cur.execute("""SELECT version
FROM sbo
WHERE name = '{}'""".format(
self.name)).fetchone()
return version[0]
def checksum(self):
"""Grab checksum string
"""Grabs checksum string
"""
md5sum, md5sum64, = [], []
for line in self.SLACKBUILDS_TXT.splitlines():
if line.startswith(self.line_name):
sbo_name = line[17:].strip()
if line.startswith(self.line_md5_64):
if sbo_name == self.name and line[26:].strip():
md5sum64 = line[26:].strip().split()
if line.startswith(self.line_md5):
if sbo_name == self.name and line[19:].strip():
md5sum = line[19:].strip().split()
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
mds5, md5s64 = self.cur.execute("""SELECT md5sum, md5sum64
FROM sbo
WHERE name = '{}'""".format(
self.name)).fetchone()
if mds5:
md5sum.append(mds5)
if md5s64:
md5sum64.append(md5s64)
return self._sorting_arch(md5sum, md5sum64)
def description(self):
"""Grab package version
"""Grabs package description
"""
for line in self.SLACKBUILDS_TXT.splitlines():
if line.startswith(self.line_name):
sbo_name = line[17:].strip()
if line.startswith(self.line_des):
if sbo_name == self.name:
return line[31:].strip()
desc = self.cur.execute("""SELECT short_desc
FROM sbo
WHERE name = '{}'""".format(
self.name)).fetchone()
return desc[0]
def files(self):
"""Grab files
"""Grabs files
"""
for line in self.SLACKBUILDS_TXT.splitlines():
if line.startswith(self.line_name):
sbo_name = line[17:].strip()
if line.startswith(self.line_files):
if sbo_name == self.name:
return line[18:].strip()
files = self.cur.execute("""SELECT files
FROM sbo
WHERE name = '{}'""".format(
self.name)).fetchone()
return files[0]
def _sorting_arch(self, arch, arch64):
"""Returns sources by arch
"""
if self.meta.arch == self.arch64 and arch64:
return arch64
return arch

View file

@ -49,7 +49,7 @@ from slpkg.slack.slack_version import slack_ver
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
"""
def __init__(self, name, flag):
@ -58,6 +58,8 @@ class SBoNetwork(BlackList, Utils):
self.flag = flag
self.meta = _meta_
self.msg = Msg()
self.data = SBoGrep(name="").names()
self.check_pkg_exist()
self.arch = SBoArch().get()
self.comp_tar = ".tar.gz"
self.choice = ""
@ -71,7 +73,6 @@ class SBoNetwork(BlackList, Utils):
self.build_folder = self.meta.build_path
self._SOURCES = self.meta.SBo_SOURCES
self.msg.reading()
self.data = SBoGrep(name="").names()
self.case_insensitive()
if "--checklist" in self.flag:
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:
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):
"""View SlackBuild package, read or install them
from slackbuilds.org
@ -224,7 +230,7 @@ class SBoNetwork(BlackList, Utils):
raise SystemExit()
def choice_install(self):
"""Download, build and install package
"""Download, build and install the package
"""
pkg_security([self.name])
if not find_package(self.prgnam, self.meta.pkg_path):
@ -313,7 +319,7 @@ class SBoNetwork(BlackList, Utils):
pydoc.pager(text)
def fill_pager(self, page):
"""Fix pager spaces
"""Fixes pager spaces
"""
tty_size = os.popen("stty size", "r").read().split()
rows = int(tty_size[0]) - 1
@ -326,8 +332,8 @@ class SBoNetwork(BlackList, Utils):
return ""
def error_uns(self):
"""Check if package supported by arch
before proceed to install
"""Checks if the package supported by an arch
before proceeding to install
"""
self.FAULT = ""
UNST = ["UNSUPPORTED", "UNTESTED"]
@ -335,7 +341,7 @@ class SBoNetwork(BlackList, Utils):
self.FAULT = "".join(self.source_dwn)
def build(self):
"""Only build and create Slackware package
"""Builds slackware package
"""
pkg_security([self.name])
self.error_uns()
@ -363,7 +369,7 @@ class SBoNetwork(BlackList, Utils):
slack_package(self.prgnam) # check if build
def install(self):
"""Install SBo package found in /tmp directory.
"""Installs SBo package found in /tmp directory.
"""
binary = slack_package(self.prgnam)
print(f"[ {self.green}Installing{self.endc} ] --> {self.name}")

View file

@ -40,7 +40,7 @@ from slpkg.sbo.slack_find import slack_package
class QueuePkgs(Utils):
"""Manage SBo packages, add or remove for building or
"""Manages SBo packages, add or removes for building or
installation
"""
def __init__(self):
@ -57,7 +57,7 @@ class QueuePkgs(Utils):
"""Creating the directories and the 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",
"#\n"]
if not os.path.exists(self.meta.lib_path):
@ -71,7 +71,7 @@ class QueuePkgs(Utils):
self.queued = self.read_file(self.queue_list)
def packages(self):
"""Return queue list from /var/lib/queue/queue_list
"""Returns queue list from /var/lib/queue/queue_list
file.
"""
for read in self.queued.splitlines():
@ -80,7 +80,7 @@ class QueuePkgs(Utils):
yield read.replace("\n", "")
def listed(self):
"""Print packages from queue
"""Prints packages from queue
"""
print("Packages in the queue:")
for pkg in self.packages():
@ -88,7 +88,7 @@ class QueuePkgs(Utils):
print()
def add(self, pkgs):
"""Add packages in queue if not exist
"""Adds packages in queue if not exist
"""
queue_list = list(self.packages())
pkgs = list(OrderedDict.fromkeys(pkgs))
@ -104,7 +104,7 @@ class QueuePkgs(Utils):
print()
def remove(self, pkgs):
"""Remove packages from queue
"""Removes packages from the queue
"""
print("Remove packages from the queue:")
with open(self.queue_list, "w") as queue:
@ -116,7 +116,7 @@ class QueuePkgs(Utils):
print()
def build(self):
"""Build packages from queue
"""Builds packages from the queue
"""
sources = []
packages = list(self.packages())
@ -146,7 +146,7 @@ class QueuePkgs(Utils):
"building\n")
def install(self):
"""Install packages from queue
"""Installs packages from the queue
"""
packages = list(self.packages())
if packages:

View file

@ -22,7 +22,7 @@
# 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.__metadata__ import MetaData as _meta_
@ -33,16 +33,17 @@ def sbo_search_pkg(name):
"""Search for package path in SLACKBUILDS.TXT file and
return url
"""
url = ""
utils = Utils()
db = _meta_.db
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()
sbo = repo.default_repository()["sbo"]
sbo_url = f"{sbo}{slack_ver()}/"
SLACKBUILDS_TXT = utils.read_file(
f"{_meta_.lib_path}sbo_repo/SLACKBUILDS.TXT")
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
return f"{sbo_url}{location[0][2:]}/"

View file

@ -27,7 +27,7 @@ from slpkg.messages import Msg
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"""
packages, msg, utils = [], Msg(), Utils()
security_packages = utils.read_file("/etc/slpkg/pkg_security")

View file

@ -23,7 +23,7 @@
def units(comp_sum, uncomp_sum):
"""Calculate package size
"""Calculates package size
"""
compressed = round((sum(map(float, comp_sum)) / 1024), 2)
uncompressed = round((sum(map(float, uncomp_sum)) / 1024), 2)

View file

@ -29,7 +29,7 @@ from slpkg.slack.slack_version import slack_ver
def mirrors(name, location):
"""Select Slackware official mirror packages
"""Selects Slackware official mirror packages
based architecture and version.
"""
rel = _meta_.slack_rel

View file

@ -53,7 +53,7 @@ from slpkg.slack.slack_version import slack_ver
class Patches(BlackList, Utils):
"""Upgrade distribution from official Slackware mirrors
"""Upgrades distribution from the official Slackware mirrors
"""
def __init__(self, skip, flag):
super().__init__()
@ -85,7 +85,7 @@ class Patches(BlackList, Utils):
self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "")).get_request()
def start(self):
"""Install new patches from official Slackware mirrors
"""Installs new patches from official Slackware mirrors
"""
self.store()
self.msg.done()
@ -132,7 +132,7 @@ class Patches(BlackList, Utils):
f" distribution is up to date!\n")
def store(self):
"""Store and return packages for upgrading
"""Stores and returns packages for upgrading
"""
data = repo_data(self.PACKAGES_TXT, "slack", self.flag)
black = list(self.get_black())
@ -169,7 +169,7 @@ class Patches(BlackList, Utils):
return self.count_upg
def dialog_checklist(self):
"""Create checklist to choose packages for upgrade
"""Creates checklist to choose packages for upgrade
"""
data = []
for upg in self.upgrade_all:
@ -214,7 +214,7 @@ class Patches(BlackList, Utils):
f"{' ' * (7-len(pkg_repo[3]))}Slack{size:>12} K")
def upgrade(self):
"""Upgrade packages
"""Upgrades packages
"""
for pkg in self.upgrade_all:
check_md5(pkg_checksum(pkg, "slack_patches"),
@ -233,8 +233,8 @@ class Patches(BlackList, Utils):
self.installed.append(pkg_ver)
def kernel(self):
"""Check if kernel upgraded if true
then reinstall "lilo"
"""Checks if kernel upgraded if true
then reinstall boot loader
"""
for core in self.upgrade_all:
if "kernel" in core:
@ -264,7 +264,7 @@ class Patches(BlackList, Utils):
break
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.
"""
NEW_ChangeLog_txt = URL(mirrors("ChangeLog.txt", "")).get_request()
@ -278,7 +278,7 @@ class Patches(BlackList, Utils):
log.write(NEW_ChangeLog_txt)
def update_lists(self):
"""Update packages list and ChangeLog.txt file after
"""Updates packages list and ChangeLog.txt file after
upgrade distribution
"""
print(f"{self.green}Update the package lists ?{self.endc}")

View file

@ -29,8 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
def slack_ver():
"""
Open file and read Slackware version
"""Opens the file and read Slackware version
"""
utils = Utils()
if _meta_.slackware_version in ["off", "OFF"]:

View file

@ -29,7 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
def slackware_repository():
"""Return all official Slackware packages
"""Returns all official Slackware packages
"""
utils = Utils()
slack_repo, packages, names = [], [], []

View file

@ -35,8 +35,7 @@ from slpkg.__metadata__ import MetaData as _meta_
def it_self_update():
"""Check from GitLab slpkg repository if new version is available
download and update itself
"""Checks from GitLab slpkg repository if a new version is available
"""
__new_version__ = ""
repository = "gitlab"

View file

@ -23,8 +23,7 @@
def split_package(package):
"""
Split package in name, version
"""Splits package in name, version
arch and build tag.
"""
name = ver = arch = build = []

View file

@ -34,7 +34,7 @@ from slpkg.pkg.find import find_package
class DependenciesStatus(Utils):
"""Print dependencies status used by packages
"""Prints dependencies status used by packages
"""
def __init__(self, image):
self.image = image
@ -53,7 +53,7 @@ class DependenciesStatus(Utils):
self.installed = find_package("", self.meta.pkg_path)
def data(self):
"""Check all installed packages and create
"""Checks all installed packages and create
dictionary database
"""
for pkg in self.installed:
@ -72,7 +72,7 @@ class DependenciesStatus(Utils):
self.count_packages()
def count_packages(self):
"""Count dependencies and packages
"""Counts dependencies and packages
"""
packages = []
for pkg in self.dmap.values():

View file

@ -27,14 +27,14 @@ import getpass
def s_user():
"""Check for root user
"""Checks for root user
"""
if getpass.getuser() != "root":
raise SystemExit("\nslpkg: Error: Must have root privileges\n")
def virtual_env():
"""Check if a virtual enviroment exists
"""Checks if a virtual enviroment exists
"""
if "VIRTUAL_ENV" in os.environ.keys():
raise SystemExit("\nslpkg: Error: Please exit from virtual "

View file

@ -39,9 +39,9 @@ from slpkg.binary.dependency import Dependencies
class TrackingDeps(BlackList, Utils):
"""View tree of dependencies and also
highlight packages with color green
if already installed and color red
"""Views tree of dependencies and also
highlights packages with the colour green
if already installed and the colour red
if not installed.
"""
def __init__(self, name, repo, flag):
@ -71,7 +71,7 @@ class TrackingDeps(BlackList, Utils):
self.flag[i] = "--graph="
def run(self):
"""Run tracking dependencies
"""Runs tracking dependencies
"""
self.msg.resolving()
self.repositories()
@ -124,7 +124,7 @@ class TrackingDeps(BlackList, Utils):
raise SystemExit("\nNo package was found to match\n")
def repositories(self):
"""Get dependencies by repositories
"""Gets dependencies by repositories
"""
if self.repo == "sbo":
self.sbo_case_insensitive()
@ -169,7 +169,7 @@ class TrackingDeps(BlackList, Utils):
Graph(self.image).dependencies(self.deps_dict)
def check_used(self, pkg):
"""Check if dependencies used
"""Checks if dependencies used
"""
used = []
dep_path = f"{self.meta.log_path}dep/"
@ -197,7 +197,7 @@ class TrackingDeps(BlackList, Utils):
self.deps_dict[dep] = self.dimensional_list(deps)
def deps_used(self, pkg, used):
"""Create dependencies dictionary
"""Creates dependencies dictionary
"""
if find_package(f"{pkg}-", self.meta.pkg_path):
if pkg not in self.deps_dict.values():

View file

@ -41,7 +41,7 @@ class URL:
self.http = urllib3.PoolManager()
def get_request(self):
"""Open url and read
"""Opens url and read
"""
try:
f = self.http.request('GET', self.link)

View file

@ -29,7 +29,7 @@ from slpkg.splitting import split_package
class Utils:
"""Class with usefull utilities
"""Class with useful utilities
"""
def case_sensitive(self, lst):
"""Create dictionary from list with key in lower case
@ -41,7 +41,7 @@ class Utils:
return dictionary
def dimensional_list(self, lists):
"""Create one dimensional list
"""Creates one dimensional list
"""
one_list = []
for lst in lists:
@ -49,7 +49,7 @@ class Utils:
return one_list
def remove_dbs(self, double):
"""Remove double item from list
"""Removes double item from list
"""
return list(OrderedDict.fromkeys(double))
@ -71,7 +71,7 @@ class Utils:
yield split_package(line[14:].strip())[0]
def check_downloaded(self, path, downloaded):
"""Check if files downloaded and return downloaded
"""Checks if files downloaded and return downloaded
packages
"""
for pkg in downloaded:
@ -79,8 +79,8 @@ class Utils:
yield pkg
def read_config(self, config):
"""Read config file and returns first uncomment line
and stop. Used for Slackware mirrors
"""Reads config file and returns first uncomment line
and stops. Used for Slackware mirrors
"""
for line in config.splitlines():
line = line.lstrip()
@ -107,6 +107,6 @@ class Utils:
return "ISO-8859-1"
def debug(self, test):
"""Function used for print some stuff for debugging
"""A function used to print some stuff for debugging
"""
print(test)

View file

@ -26,7 +26,7 @@ from slpkg.__metadata__ import MetaData as m
def prog_version():
"""Print version, license and email
"""Prints version, license and email
"""
print(f"Version : {m.__version__}\n"
f"Licence : {m.__license__}\n"

View file

@ -11,30 +11,30 @@ class TestSBoGreps(unittest.TestCase):
"""Test package source
"""
source = self.grep.source()
flask_source = ('https://files.pythonhosted.org/packages/4e/0b/'
'cb02268c90e67545a0e3a37ea1ca3d45de3aca43ceb7dbf'
'1712fb5127d5d/Flask-1.1.2.tar.gz')
flask_source = ('https://files.pythonhosted.org/packages/source/f'
'/flask/Flask-2.1.2.tar.gz')
self.assertEqual(source, flask_source)
def test_requires(self):
"""Test package 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)
def test_version(self):
"""Test package version
"""
version = self.grep.version()
flask_ver = '1.1.2'
flask_ver = '2.1.2'
self.assertEqual(version, flask_ver)
def test_checksum(self):
"""Test package checksum
"""
checksum = self.grep.checksum()
flask_md5 = ['0da4145d172993cd28a6c619630cc19c']
flask_md5 = ['93f1832e5be704ef6ff2a4124579cd85']
self.assertListEqual(checksum, flask_md5)
def test_description(self):

View file

@ -12,13 +12,13 @@ class TestSplitting(unittest.TestCase):
pkg_3 = ''.join(list(searching('autoconf-archive', 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))
self.assertListEqual(['akonadi-mime', '21.12.1', 'x86_64', '1'],
split_package(pkg_2))
self.assertListEqual(['autoconf-archive', '2021.02.19', 'noarch', '1'],
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))