mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-24 19:58:31 +01:00
Merge branch 'develop'
This commit is contained in:
commit
64e6b5ed26
26 changed files with 252 additions and 252 deletions
|
@ -1,3 +1,11 @@
|
|||
4.3.4 - 02/12/2022
|
||||
Updated:
|
||||
- Remove dataclasses and switch to __init__
|
||||
- Version print command
|
||||
Added:
|
||||
- Version to the requires in the view packages command
|
||||
- Short cli menu
|
||||
|
||||
4.3.3 - 01/12/2022
|
||||
Fixed:
|
||||
- Blacklist file permissions 0644
|
||||
|
|
|
@ -30,8 +30,8 @@ Install from the official third-party `SBo repository <https://slackbuilds.org/r
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
$ tar xvf slpkg-4.3.3.tar.gz
|
||||
$ cd slpkg-4.3.3
|
||||
$ tar xvf slpkg-4.3.4.tar.gz
|
||||
$ cd slpkg-4.3.4
|
||||
$ ./install.sh
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[metadata]
|
||||
name = slpkg
|
||||
version = 4.3.3
|
||||
version = 4.3.4
|
||||
license_file = LICENSE
|
||||
author = Dimitris Zlatanidis
|
||||
author_email = d.zlatanidis@gmail.com
|
||||
|
|
|
@ -4,18 +4,18 @@
|
|||
|
||||
import os
|
||||
import tomli
|
||||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.configs import Configs
|
||||
|
||||
|
||||
@dataclass
|
||||
class Blacklist:
|
||||
''' Reads and returns the blacklist. '''
|
||||
etc_path: str = Configs.etc_path
|
||||
|
||||
def __init__(self):
|
||||
self.configs: str = Configs
|
||||
|
||||
def get(self):
|
||||
file = f'{self.etc_path}/blacklist.toml'
|
||||
file = f'{self.configs.etc_path}/blacklist.toml'
|
||||
if os.path.isfile(file):
|
||||
with open(file, 'rb') as black:
|
||||
return tomli.load(black)['blacklist']['packages']
|
||||
|
|
|
@ -4,25 +4,24 @@
|
|||
|
||||
import os
|
||||
import urllib3
|
||||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.configs import Configs
|
||||
|
||||
|
||||
@dataclass
|
||||
class CheckUpdates:
|
||||
sbo_repo_url: str = Configs.sbo_repo_url
|
||||
sbo_repo_path: str = Configs.sbo_repo_path
|
||||
chglog_txt: str = Configs.chglog_txt
|
||||
''' Check for changes in the ChangeLog file. '''
|
||||
|
||||
def __init__(self):
|
||||
self.configs: str = Configs
|
||||
|
||||
def updates(self):
|
||||
|
||||
local_date = 0
|
||||
local_chg_txt = f'{self.sbo_repo_path}/{self.chglog_txt}'
|
||||
local_chg_txt = (f'{self.configs.sbo_repo_path}/'
|
||||
f'{self.configs.chglog_txt}')
|
||||
|
||||
http = urllib3.PoolManager()
|
||||
repo = http.request(
|
||||
'GET', f'{self.sbo_repo_url}/{self.chglog_txt}')
|
||||
'GET', f'{self.configs.sbo_repo_url}/{self.configs.chglog_txt}')
|
||||
|
||||
if os.path.isfile(local_chg_txt):
|
||||
local_date = int(os.stat(local_chg_txt).st_size)
|
||||
|
|
|
@ -2,21 +2,17 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.queries import SBoQueries
|
||||
from slpkg.blacklist import Blacklist
|
||||
|
||||
|
||||
@dataclass
|
||||
class Check:
|
||||
''' Some checks before proceed. '''
|
||||
log_packages: str = Configs.log_packages
|
||||
sbo_repo_tag: str = Configs.sbo_repo_tag
|
||||
db_path: str = Configs.db_path
|
||||
database_name: str = Configs.database
|
||||
etc_path: str = Configs.etc_path
|
||||
|
||||
def __init__(self):
|
||||
self.configs: str = Configs
|
||||
|
||||
def exists(self, slackbuilds: list):
|
||||
''' Checking if the slackbuild exists in the repository. '''
|
||||
|
@ -43,9 +39,9 @@ class Check:
|
|||
found, not_found = [], []
|
||||
|
||||
for sbo in slackbuilds:
|
||||
for package in os.listdir(self.log_packages):
|
||||
for package in os.listdir(self.configs.log_packages):
|
||||
if (package.startswith(f'{sbo}-') and
|
||||
package.endswith(self.sbo_repo_tag)):
|
||||
package.endswith(self.configs.sbo_repo_tag)):
|
||||
found.append(sbo)
|
||||
|
||||
for sbo in slackbuilds:
|
||||
|
@ -70,12 +66,12 @@ class Check:
|
|||
if packages:
|
||||
raise SystemExit(
|
||||
f'\nThe packages \'{", ".join(packages)}\' is blacklisted.\n'
|
||||
f'Please edit the blacklist.toml file in {self.etc_path} '
|
||||
'folder.\n')
|
||||
f'Please edit the blacklist.toml file in '
|
||||
f'{self.configs.etc_path} folder.\n')
|
||||
|
||||
def database(self):
|
||||
''' Checking for empty table '''
|
||||
db = f'{self.db_path}/{self.database_name}'
|
||||
db = f'{self.configs.db_path}/{self.configs.database}'
|
||||
if not SBoQueries('').names() or not os.path.isfile(db):
|
||||
raise SystemExit('\nYou need to update the package lists first.\n'
|
||||
'Please run slpkg update.\n')
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
|
||||
|
||||
import hashlib
|
||||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.views.views import ViewMessage
|
||||
|
||||
|
||||
@dataclass
|
||||
class Md5sum:
|
||||
''' Checksum the sources. '''
|
||||
flags: str
|
||||
|
||||
def __init__(self, flags):
|
||||
self.flags: str = flags
|
||||
|
||||
def check(self, path: str, source: str, checksum: str, name: str):
|
||||
filename = f'{path}/{source.split("/")[-1]}'
|
||||
|
|
|
@ -2,18 +2,17 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.views.views import ViewMessage
|
||||
from slpkg.models.models import LogsDependencies
|
||||
from slpkg.models.models import session as Session
|
||||
|
||||
|
||||
@dataclass
|
||||
class CleanLogsDependencies:
|
||||
''' Cleans the logs from packages. '''
|
||||
flags: str
|
||||
session: str = Session
|
||||
|
||||
def __init__(self, flags):
|
||||
self.flags: str = flags
|
||||
self.session: str = Session
|
||||
|
||||
def clean(self):
|
||||
dependencies = self.session.query(
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
import os
|
||||
import tomli
|
||||
import platform
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
|
@ -16,7 +17,7 @@ class Configs:
|
|||
|
||||
''' Default configurations. '''
|
||||
# OS architecture by default
|
||||
os_arch: str = os.uname()[4]
|
||||
os_arch: str = platform.machine()
|
||||
|
||||
# All necessary paths
|
||||
tmp_path: str = '/tmp'
|
||||
|
@ -45,7 +46,7 @@ class Configs:
|
|||
removepkg: str = 'removepkg'
|
||||
|
||||
# Cli menu colors configs
|
||||
colors: str = 'off'
|
||||
colors: str = False
|
||||
|
||||
# Wget options
|
||||
wget_options = '-c -N'
|
||||
|
|
|
@ -2,21 +2,17 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.models.models import SBoTable
|
||||
from slpkg.models.models import session as Session
|
||||
|
||||
|
||||
@dataclass
|
||||
class CreateData:
|
||||
''' Reads the SLACKBUILDS.TXT file and inserts them into the database. '''
|
||||
|
||||
db_path: str = Configs.db_path
|
||||
sbo_txt: str = Configs.sbo_txt
|
||||
sbo_repo_path: str = Configs.sbo_repo_path
|
||||
session: str = Session
|
||||
def __init__(self):
|
||||
self.configs: str = Configs
|
||||
self.session: str = Session
|
||||
|
||||
def insert_sbo_table(self):
|
||||
sbo_tags = [
|
||||
|
@ -32,7 +28,8 @@ class CreateData:
|
|||
'SLACKBUILD SHORT DESCRIPTION:'
|
||||
]
|
||||
|
||||
sbo_file = self.read_file(f'{self.sbo_repo_path}/SLACKBUILDS.TXT')
|
||||
sbo_file = self.read_file(
|
||||
f'{self.configs.sbo_repo_path}/SLACKBUILDS.TXT')
|
||||
|
||||
cache = [] # init cache
|
||||
|
||||
|
|
|
@ -2,16 +2,15 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.queries import SBoQueries
|
||||
|
||||
|
||||
@dataclass
|
||||
class Requires:
|
||||
''' Creates a list of dependencies with
|
||||
the right order to install. '''
|
||||
name: str
|
||||
|
||||
def __init__(self, name):
|
||||
self.name: str = name
|
||||
|
||||
def resolve(self) -> list:
|
||||
requires = SBoQueries(self.name).requires()
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.downloader import Wget
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.queries import SBoQueries
|
||||
|
@ -11,28 +9,27 @@ from slpkg.views.views import ViewMessage
|
|||
from slpkg.models.models import session as Session
|
||||
|
||||
|
||||
@dataclass
|
||||
class Download:
|
||||
flags: list
|
||||
session: str = Session
|
||||
download_only = Configs.download_only
|
||||
sbo_repo_url: str = Configs.sbo_repo_url
|
||||
sbo_tar_suffix: str = Configs.sbo_tar_suffix
|
||||
''' Download the slackbuilds with the sources only. '''
|
||||
|
||||
def __init__(self, flags):
|
||||
self.flags: list = flags
|
||||
self.configs: str = Configs
|
||||
self.session: str = Session
|
||||
|
||||
def packages(self, slackbuilds: list):
|
||||
|
||||
view = ViewMessage(self.flags)
|
||||
view.download_packages(slackbuilds)
|
||||
view.question()
|
||||
wget = Wget()
|
||||
|
||||
for sbo in slackbuilds:
|
||||
file = f'{sbo}{self.sbo_tar_suffix}'
|
||||
file = f'{sbo}{self.configs.sbo_tar_suffix}'
|
||||
location = SBoQueries(sbo).location()
|
||||
url = f'{self.sbo_repo_url}/{location}/{file}'
|
||||
url = f'{self.configs.sbo_repo_url}/{location}/{file}'
|
||||
|
||||
wget.download(self.download_only, url)
|
||||
wget.download(self.configs.download_only, url)
|
||||
|
||||
sources = SBoQueries(sbo).sources()
|
||||
for source in sources.split():
|
||||
wget.download(self.download_only, source)
|
||||
wget.download(self.configs.download_only, source)
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
|
||||
|
||||
import subprocess
|
||||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.configs import Configs
|
||||
|
||||
|
||||
@dataclass
|
||||
class Wget:
|
||||
''' Wget donwloader. '''
|
||||
wget_options: str = Configs.wget_options
|
||||
|
||||
def __init__(self):
|
||||
self.wget_options: str = Configs.wget_options
|
||||
|
||||
def download(self, path: str, url: str):
|
||||
subprocess.call(f'wget {self.wget_options} --directory-prefix={path}'
|
||||
|
|
|
@ -3,15 +3,17 @@
|
|||
|
||||
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.configs import Configs
|
||||
|
||||
|
||||
@dataclass
|
||||
class FindInstalled:
|
||||
log_packages: str = Configs.log_packages
|
||||
colors: dict = Configs.colour
|
||||
sbo_repo_tag: str = Configs.sbo_repo_tag
|
||||
''' Find installed packages. '''
|
||||
|
||||
def __init__(self):
|
||||
self.configs: str = Configs
|
||||
colors = self.configs.colour
|
||||
self.color = colors()
|
||||
|
||||
def find(self, packages: list):
|
||||
matching = []
|
||||
|
@ -20,15 +22,14 @@ class FindInstalled:
|
|||
f'that contains \'{", ".join([p for p in packages])}\' files:\n')
|
||||
|
||||
for pkg in packages:
|
||||
for package in os.listdir(self.log_packages):
|
||||
if pkg in package and self.sbo_repo_tag in package:
|
||||
for package in os.listdir(self.configs.log_packages):
|
||||
if pkg in package and self.configs.sbo_repo_tag in package:
|
||||
matching.append(package)
|
||||
self.matched(matching)
|
||||
|
||||
def matched(self, matching: list):
|
||||
color = self.colors()
|
||||
if matching:
|
||||
for package in matching:
|
||||
print(f'{color["CYAN"]}{package}{color["ENDC"]}')
|
||||
print(f'{self.color["CYAN"]}{package}{self.color["ENDC"]}')
|
||||
else:
|
||||
print('\nDoes not match any package.\n')
|
||||
|
|
|
@ -3,14 +3,13 @@
|
|||
|
||||
|
||||
import sys
|
||||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.checks import Check
|
||||
from slpkg.upgrade import Upgrade
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.search import SearchPackage
|
||||
from slpkg.views.cli_menu import usage
|
||||
from slpkg.views.cli_menu import Usage
|
||||
from slpkg.views.version import Version
|
||||
from slpkg.download_only import Download
|
||||
from slpkg.slackbuild import Slackbuilds
|
||||
|
@ -22,16 +21,18 @@ from slpkg.clean_logs import CleanLogsDependencies
|
|||
from slpkg.update_repository import UpdateRepository
|
||||
|
||||
|
||||
@dataclass
|
||||
class Argparse:
|
||||
args: list
|
||||
|
||||
def __post_init__(self):
|
||||
def __init__(self, args):
|
||||
self.args: list = args
|
||||
|
||||
self.configs = Configs
|
||||
self.usage = Usage()
|
||||
self.flag()
|
||||
self.check = Check()
|
||||
|
||||
if len(self.args) == 0:
|
||||
usage(1)
|
||||
self.usage.help_short()
|
||||
|
||||
self.check.blacklist(self.args)
|
||||
|
||||
|
@ -51,22 +52,22 @@ class Argparse:
|
|||
|
||||
def help(self):
|
||||
if len(self.args) == 1 and not self.flags:
|
||||
usage(0)
|
||||
usage(1)
|
||||
self.usage.help(0)
|
||||
self.usage.help(1)
|
||||
|
||||
def version(self):
|
||||
if len(self.args) == 1 and not self.flags:
|
||||
version = Version()
|
||||
version.view()
|
||||
raise SystemExit()
|
||||
usage(1)
|
||||
self.usage.help(1)
|
||||
|
||||
def update(self):
|
||||
if len(self.args) == 1 and not self.flags:
|
||||
update = UpdateRepository()
|
||||
update.sbo()
|
||||
raise SystemExit()
|
||||
usage(1)
|
||||
self.usage.help(1)
|
||||
|
||||
def upgrade(self):
|
||||
if len(self.args) == 1:
|
||||
|
@ -82,7 +83,7 @@ class Argparse:
|
|||
install = Slackbuilds(packages, self.flags, install=True)
|
||||
install.execute()
|
||||
raise SystemExit()
|
||||
usage(1)
|
||||
self.usage.help(1)
|
||||
|
||||
def check_updates(self):
|
||||
if len(self.args) == 1 and not self.flags:
|
||||
|
@ -91,7 +92,7 @@ class Argparse:
|
|||
check = CheckUpdates()
|
||||
check.updates()
|
||||
raise SystemExit()
|
||||
usage(1)
|
||||
self.usage.help(1)
|
||||
|
||||
def build(self):
|
||||
if len(self.args) >= 2 and '--reinstall' not in self.flags:
|
||||
|
@ -104,7 +105,7 @@ class Argparse:
|
|||
build = Slackbuilds(packages, self.flags, install=False)
|
||||
build.execute()
|
||||
raise SystemExit()
|
||||
usage(1)
|
||||
self.usage.help(1)
|
||||
|
||||
def install(self):
|
||||
if len(self.args) >= 2:
|
||||
|
@ -117,11 +118,11 @@ class Argparse:
|
|||
install = Slackbuilds(packages, self.flags, install=True)
|
||||
install.execute()
|
||||
raise SystemExit()
|
||||
usage(1)
|
||||
self.usage.help(1)
|
||||
|
||||
def download(self):
|
||||
if [f for f in self.flags if f in self.options[1:]]:
|
||||
usage(1)
|
||||
self.usage.help(1)
|
||||
|
||||
if len(self.args) >= 2:
|
||||
packages = list(set(self.args[1:]))
|
||||
|
@ -132,11 +133,11 @@ class Argparse:
|
|||
download.packages(packages)
|
||||
|
||||
raise SystemExit()
|
||||
usage(1)
|
||||
self.usage.help(1)
|
||||
|
||||
def remove(self):
|
||||
if [f for f in self.flags if f in self.options[1:]]:
|
||||
usage(1)
|
||||
self.usage.help(1)
|
||||
|
||||
if len(self.args) >= 2:
|
||||
packages = list(set(self.args[1:]))
|
||||
|
@ -147,7 +148,7 @@ class Argparse:
|
|||
remove = RemovePackages(packages, self.flags)
|
||||
remove.remove()
|
||||
raise SystemExit()
|
||||
usage(1)
|
||||
self.usage.help(1)
|
||||
|
||||
def view(self):
|
||||
if len(self.args) >= 2 and not self.flags:
|
||||
|
@ -159,7 +160,7 @@ class Argparse:
|
|||
view = ViewPackage()
|
||||
view.package(packages)
|
||||
raise SystemExit()
|
||||
usage(1)
|
||||
self.usage.help(1)
|
||||
|
||||
def search(self):
|
||||
if len(self.args) >= 2 and not self.flags:
|
||||
|
@ -170,7 +171,7 @@ class Argparse:
|
|||
search = SearchPackage()
|
||||
search.package(packages)
|
||||
raise SystemExit()
|
||||
usage(1)
|
||||
self.usage.help(1)
|
||||
|
||||
def find(self):
|
||||
if len(self.args) >= 2 and not self.flags:
|
||||
|
@ -181,11 +182,11 @@ class Argparse:
|
|||
find = FindInstalled()
|
||||
find.find(packages)
|
||||
raise SystemExit()
|
||||
usage(1)
|
||||
self.usage.help(1)
|
||||
|
||||
def clean_logs(self):
|
||||
if [f for f in self.flags if f in self.options[1:]]:
|
||||
usage(1)
|
||||
self.usage.help(1)
|
||||
|
||||
if len(self.args) == 1:
|
||||
self.check.database()
|
||||
|
@ -193,19 +194,19 @@ class Argparse:
|
|||
logs = CleanLogsDependencies(self.flags)
|
||||
logs.clean()
|
||||
raise SystemExit()
|
||||
usage(1)
|
||||
self.usage.help(1)
|
||||
|
||||
def clean_tmp(self):
|
||||
if len(self.args) == 1 and not self.flags:
|
||||
path = Configs.tmp_path
|
||||
tmp_slpkg = Configs.tmp_slpkg
|
||||
folder = Configs.prog_name
|
||||
path = self.configs.tmp_path
|
||||
tmp_slpkg = self.configs.tmp_slpkg
|
||||
folder = self.configs.prog_name
|
||||
|
||||
utils = Utilities()
|
||||
utils.remove_folder_if_exists(path, folder)
|
||||
utils.create_folder(tmp_slpkg, 'build')
|
||||
raise SystemExit()
|
||||
usage(1)
|
||||
self.usage.help(1)
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -243,7 +244,7 @@ def main():
|
|||
try:
|
||||
arguments[args[0]]()
|
||||
except KeyError:
|
||||
usage(1)
|
||||
Usage().help(1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -2,22 +2,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.blacklist import Blacklist
|
||||
from slpkg.models.models import SBoTable
|
||||
from slpkg.models.models import session as Session
|
||||
|
||||
|
||||
@dataclass
|
||||
class SBoQueries:
|
||||
''' Queries class for the sbo repository. '''
|
||||
name: str
|
||||
session: str = Session
|
||||
os_arch: str = Configs.os_arch
|
||||
|
||||
def __post_init__(self):
|
||||
def __init__(self, name):
|
||||
self.name: str = name
|
||||
self.session: str = Session
|
||||
self.configs: str = Configs
|
||||
|
||||
self.black = Blacklist()
|
||||
if self.name in self.black.get():
|
||||
self.name = ''
|
||||
|
@ -106,7 +104,7 @@ class SBoQueries:
|
|||
return ''
|
||||
|
||||
def _chose_arch(self, arch, arch64):
|
||||
if self.os_arch == 'x86_64' and arch64:
|
||||
if self.configs.os_arch == 'x86_64' and arch64:
|
||||
return arch64
|
||||
return arch
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
|
||||
import subprocess
|
||||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.views.views import ViewMessage
|
||||
|
@ -11,13 +10,14 @@ from slpkg.models.models import LogsDependencies
|
|||
from slpkg.models.models import session as Session
|
||||
|
||||
|
||||
@dataclass
|
||||
class RemovePackages:
|
||||
''' Removes installed packages. '''
|
||||
packages: str
|
||||
flags: list
|
||||
session: str = Session
|
||||
removepkg: str = Configs.removepkg
|
||||
|
||||
def __init__(self, packages, flags):
|
||||
self.packages: str = packages
|
||||
self.flags: list = flags
|
||||
self.session: str = Session
|
||||
self.configs: str = Configs
|
||||
|
||||
def remove(self):
|
||||
''' Removes package with dependencies. '''
|
||||
|
@ -40,7 +40,7 @@ class RemovePackages:
|
|||
def remove_packages(self):
|
||||
''' Run Slackware command to remove the packages. '''
|
||||
for package in self.installed_packages:
|
||||
command = f'{self.removepkg} {package}'
|
||||
command = f'{self.configs.removepkg} {package}'
|
||||
subprocess.call(command, shell=True)
|
||||
|
||||
def delete_main_logs(self):
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.queries import SBoQueries
|
||||
from slpkg.configs import Configs
|
||||
|
||||
|
||||
@dataclass
|
||||
class SearchPackage:
|
||||
colors: dict = Configs.colour
|
||||
''' Search slackbuilds from the repository. '''
|
||||
|
||||
def __init__(self):
|
||||
self.colors: dict = Configs.colour
|
||||
|
||||
def package(self, packages):
|
||||
color = self.colors()
|
||||
|
|
|
@ -5,7 +5,6 @@ import os
|
|||
import subprocess
|
||||
import multiprocessing
|
||||
|
||||
from dataclasses import dataclass
|
||||
from collections import OrderedDict
|
||||
|
||||
from slpkg.downloader import Wget
|
||||
|
@ -19,23 +18,16 @@ from slpkg.models.models import LogsDependencies
|
|||
from slpkg.models.models import session as Session
|
||||
|
||||
|
||||
@dataclass
|
||||
class Slackbuilds:
|
||||
''' Download build and install the SlackBuilds. '''
|
||||
slackbuilds: str
|
||||
flags: list
|
||||
install: bool
|
||||
session: str = Session
|
||||
utils: str = Utilities()
|
||||
build_path: str = Configs.build_path
|
||||
sbo_repo_tag: str = Configs.sbo_repo_tag
|
||||
sbo_repo_url: str = Configs.sbo_repo_url
|
||||
build_path: str = Configs.build_path
|
||||
tmp_slpkg: str = Configs.tmp_slpkg
|
||||
tmp_path: str = Configs.tmp_path
|
||||
sbo_tar_suffix: str = Configs.sbo_tar_suffix
|
||||
installpkg: str = Configs.installpkg
|
||||
reinstall: str = Configs.reinstall
|
||||
|
||||
def __init__(self, slackbuilds, flags, install):
|
||||
self.slackbuilds: str = slackbuilds
|
||||
self.flags: list = flags
|
||||
self.install: bool = install
|
||||
self.session: str = Session
|
||||
self.utils: str = Utilities()
|
||||
self.configs: str = Configs
|
||||
|
||||
def execute(self):
|
||||
''' Starting build or install the slackbuilds. '''
|
||||
|
@ -96,24 +88,24 @@ class Slackbuilds:
|
|||
wget = Wget()
|
||||
|
||||
for sbo in self.install_order:
|
||||
file = f'{sbo}{self.sbo_tar_suffix}'
|
||||
file = f'{sbo}{self.configs.sbo_tar_suffix}'
|
||||
|
||||
self.utils.remove_file_if_exists(self.tmp_slpkg, file)
|
||||
self.utils.remove_folder_if_exists(self.build_path, sbo)
|
||||
self.utils.remove_file_if_exists(self.configs.tmp_slpkg, file)
|
||||
self.utils.remove_folder_if_exists(self.configs.build_path, sbo)
|
||||
|
||||
location = SBoQueries(sbo).location()
|
||||
url = f'{self.sbo_repo_url}/{location}/{file}'
|
||||
url = f'{self.configs.sbo_repo_url}/{location}/{file}'
|
||||
|
||||
wget.download(self.tmp_slpkg, url)
|
||||
wget.download(self.configs.tmp_slpkg, url)
|
||||
|
||||
self.utils.untar_archive(self.tmp_slpkg, file, self.build_path)
|
||||
self.utils.untar_archive(self.configs.tmp_slpkg, file, self.configs.build_path)
|
||||
|
||||
self.patch_sbo_tag(sbo)
|
||||
|
||||
sources = SBoQueries(sbo).sources()
|
||||
self.download_sources(sbo, sources)
|
||||
|
||||
self.build_the_script(self.build_path, sbo)
|
||||
self.build_the_script(self.configs.build_path, sbo)
|
||||
|
||||
if self.install:
|
||||
|
||||
|
@ -125,7 +117,7 @@ class Slackbuilds:
|
|||
|
||||
def patch_sbo_tag(self, sbo):
|
||||
''' Patching SBo TAG from the configuration file. '''
|
||||
sbo_script = f'{self.build_path}/{sbo}/{sbo}.SlackBuild'
|
||||
sbo_script = f'{self.configs.build_path}/{sbo}/{sbo}.SlackBuild'
|
||||
|
||||
if os.path.isfile(sbo_script):
|
||||
with open(sbo_script, 'r', encoding='utf-8') as f:
|
||||
|
@ -134,7 +126,7 @@ class Slackbuilds:
|
|||
with open(sbo_script, 'w') as script:
|
||||
for line in lines:
|
||||
if line.startswith('TAG=$'):
|
||||
line = f'TAG=${{TAG:-{self.sbo_repo_tag}}}\n'
|
||||
line = f'TAG=${{TAG:-{self.configs.sbo_repo_tag}}}\n'
|
||||
script.write(line)
|
||||
|
||||
def logging_installed_dependencies(self, name: str):
|
||||
|
@ -158,12 +150,12 @@ class Slackbuilds:
|
|||
|
||||
def install_package(self, package: str):
|
||||
''' Install the packages that before created in the tmp directory. '''
|
||||
execute = self.installpkg
|
||||
execute = self.configs.installpkg
|
||||
if ('--reinstall' in self.flags and
|
||||
self.utils.is_installed(package[:-4])):
|
||||
execute = self.reinstall
|
||||
|
||||
command = f'{execute} {self.tmp_path}/{package}'
|
||||
command = f'{execute} {self.configs.tmp_path}/{package}'
|
||||
subprocess.call(command, shell=True)
|
||||
|
||||
def creating_package_for_install(self, name: str):
|
||||
|
@ -175,8 +167,8 @@ class Slackbuilds:
|
|||
packages = []
|
||||
pkg = f'{name}-{version}'
|
||||
|
||||
for package in os.listdir(self.tmp_path):
|
||||
if pkg in package and self.sbo_repo_tag in package:
|
||||
for package in os.listdir(self.configs.tmp_path):
|
||||
if pkg in package and self.configs.sbo_repo_tag in package:
|
||||
packages.append(package)
|
||||
|
||||
return max(packages)
|
||||
|
@ -204,7 +196,7 @@ class Slackbuilds:
|
|||
''' Download the sources. '''
|
||||
wget = Wget()
|
||||
|
||||
path = f'{self.build_path}/{name}'
|
||||
path = f'{self.configs.build_path}/{name}'
|
||||
|
||||
checksums = SBoQueries(name).checksum()
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
import os
|
||||
|
||||
from os import path
|
||||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.downloader import Wget
|
||||
from slpkg.configs import Configs
|
||||
|
@ -14,29 +13,25 @@ from slpkg.models.models import SBoTable
|
|||
from slpkg.models.models import session as Session
|
||||
|
||||
|
||||
@dataclass
|
||||
class UpdateRepository:
|
||||
''' Deletes and install the data. '''
|
||||
sbo_repo_path: str = Configs.sbo_repo_path
|
||||
url: str = Configs.sbo_repo_url
|
||||
sbo_txt: str = Configs.sbo_txt
|
||||
chglog_txt: str = Configs.chglog_txt
|
||||
db_path: str = Configs.db_path
|
||||
database: str = Configs.database
|
||||
session: str = Session
|
||||
|
||||
def __init__(self):
|
||||
self.configs: str = Configs
|
||||
self.session: str = Session
|
||||
|
||||
def sbo(self):
|
||||
print('Updating the package list...\n')
|
||||
self.delete_file(self.sbo_repo_path, self.sbo_txt)
|
||||
self.delete_file(self.sbo_repo_path, self.chglog_txt)
|
||||
self.delete_file(self.configs.sbo_repo_path, self.configs.sbo_txt)
|
||||
self.delete_file(self.configs.sbo_repo_path, self.configs.chglog_txt)
|
||||
self.delete_sbo_data()
|
||||
|
||||
slackbuilds_txt = f'{self.url}/{self.sbo_txt}'
|
||||
changelog_txt = f'{self.url}/{self.chglog_txt}'
|
||||
slackbuilds_txt = f'{self.configs.sbo_repo_url}/{self.configs.sbo_txt}'
|
||||
changelog_txt = f'{self.configs.sbo_repo_url}/{self.configs.chglog_txt}'
|
||||
|
||||
wget = Wget()
|
||||
wget.download(self.sbo_repo_path, slackbuilds_txt)
|
||||
wget.download(self.sbo_repo_path, changelog_txt)
|
||||
wget.download(self.configs.sbo_repo_path, slackbuilds_txt)
|
||||
wget.download(self.configs.sbo_repo_path, changelog_txt)
|
||||
|
||||
data = CreateData()
|
||||
data.insert_sbo_table()
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from slpkg.configs import Configs
|
||||
|
@ -10,10 +9,11 @@ from slpkg.queries import SBoQueries
|
|||
from slpkg.blacklist import Blacklist
|
||||
|
||||
|
||||
@dataclass
|
||||
class Upgrade:
|
||||
log_packages: str = Configs.log_packages
|
||||
sbo_repo_tag: str = Configs.sbo_repo_tag
|
||||
''' Upgrade the installed packages. '''
|
||||
|
||||
def __init__(self):
|
||||
self.configs: str = Configs
|
||||
|
||||
def packages(self):
|
||||
''' Compares version of packages and returns the maximum. '''
|
||||
|
@ -22,9 +22,10 @@ class Upgrade:
|
|||
repo_packages = SBoQueries('').names()
|
||||
black = Blacklist().get()
|
||||
|
||||
for pkg in os.listdir(self.log_packages):
|
||||
for pkg in os.listdir(self.configs.log_packages):
|
||||
inst_pkg_name = '-'.join(pkg.split('-')[:-3])
|
||||
if pkg.endswith(self.sbo_repo_tag) and inst_pkg_name not in black:
|
||||
if (pkg.endswith(self.configs.sbo_repo_tag)
|
||||
and inst_pkg_name not in black):
|
||||
|
||||
if inst_pkg_name in repo_packages:
|
||||
installed_ver = pkg.replace(f'{inst_pkg_name}-',
|
||||
|
|
|
@ -6,14 +6,14 @@ import os
|
|||
import shutil
|
||||
import tarfile
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.configs import Configs
|
||||
|
||||
|
||||
@dataclass
|
||||
class Utilities:
|
||||
log_packages: str = Configs.log_packages
|
||||
|
||||
def __init__(self):
|
||||
self.configs: str = Configs
|
||||
|
||||
def untar_archive(self, path: str, archive: str, ext_path: str):
|
||||
''' Untar the file to the build folder. '''
|
||||
|
@ -24,7 +24,7 @@ class Utilities:
|
|||
|
||||
def is_installed(self, package: str):
|
||||
''' Returns True if a package is installed. '''
|
||||
for pkg in os.listdir(self.log_packages):
|
||||
for pkg in os.listdir(self.configs.log_packages):
|
||||
if package in pkg:
|
||||
return pkg
|
||||
|
||||
|
|
|
@ -5,43 +5,59 @@
|
|||
from slpkg.configs import Configs
|
||||
|
||||
|
||||
def usage(status: int):
|
||||
colors = Configs.colour
|
||||
color = colors()
|
||||
class Usage:
|
||||
|
||||
BOLD = color['BOLD']
|
||||
RED = color['RED']
|
||||
CYAN = color['CYAN']
|
||||
YELLOW = color['YELLOW']
|
||||
ENDC = color['ENDC']
|
||||
def __init__(self):
|
||||
colors = Configs.colour
|
||||
color = colors()
|
||||
|
||||
args = [f'{BOLD}USAGE:{ENDC} {Configs.prog_name} [{YELLOW}OPTIONS{ENDC}] [{CYAN}COMMAND{ENDC}] <packages>\n',
|
||||
f'{BOLD}DESCRIPTION:{ENDC}',
|
||||
' Packaging tool that interacts with the SBo repository.\n',
|
||||
f'{BOLD}COMMANDS:{ENDC}',
|
||||
f' {RED}update{ENDC} Update the package lists.',
|
||||
f' {CYAN}upgrade{ENDC} Upgrade all the packages.',
|
||||
f' {CYAN}check-updates{ENDC} Check for news on ChangeLog.txt.',
|
||||
f' {CYAN}clean-logs{ENDC} Clean dependencies log tracking.',
|
||||
f' {CYAN}clean-tmp{ENDC} Delete all the downloaded sources.',
|
||||
f' {CYAN}-b, build{ENDC} <packages> Build only the packages.',
|
||||
f' {CYAN}-i, install{ENDC} <packages> Build and install the packages.',
|
||||
f' {CYAN}-d, download{ENDC} <packages> Download only the scripts and sources.',
|
||||
f' {CYAN}-r, remove{ENDC} <packages> Remove installed packages.',
|
||||
f' {CYAN}-f, find{ENDC} <packages> Find installed packages.',
|
||||
f' {CYAN}-w, view{ENDC} <packages> View packages from the repository.',
|
||||
f' {CYAN}-s, search{ENDC} <packages> Search packages from the repository.\n',
|
||||
f'{BOLD}OPTIONS:{ENDC}',
|
||||
f' {YELLOW}--yes{ENDC} Answer Yes to all questions.',
|
||||
f' {YELLOW}--jobs{ENDC} Set it for multicore systems.',
|
||||
f' {YELLOW}--resolve-off{ENDC} Turns off dependency resolving.',
|
||||
f' {YELLOW}--reinstall{ENDC} Upgrade packages of the same version.',
|
||||
f' {YELLOW}--skip-installed{ENDC} Skip installed packages.\n',
|
||||
' -h, --help Show this message and exit.',
|
||||
' -v, --version Print version and exit.\n',
|
||||
'Edit the configuration file in the /etc/slpkg/slpkg.toml.',
|
||||
'If you need more information try to use slpkg manpage.']
|
||||
self.BOLD = color['BOLD']
|
||||
self.RED = color['RED']
|
||||
self.CYAN = color['CYAN']
|
||||
self.YELLOW = color['YELLOW']
|
||||
self.ENDC = color['ENDC']
|
||||
|
||||
for opt in args:
|
||||
print(opt)
|
||||
raise SystemExit(status)
|
||||
|
||||
def help_short(self):
|
||||
args = (f'Usage: {Configs.prog_name} [{self.YELLOW}OPTIONS{self.ENDC}] [{self.CYAN}COMMAND{self.ENDC}] <packages>\n'
|
||||
f'\n slpkg [{self.YELLOW}OPTIONS{self.ENDC}] [--yes, --jobs, --resolve-off, --reinstall, --skip-installed]\n'
|
||||
f' slpkg [{self.CYAN}COMMAND{self.ENDC}] [update, upgrade, check-updates, clean-logs, clean-tmp]\n'
|
||||
f' slpkg [{self.CYAN}COMMAND{self.ENDC}] [-b, build, -i, install, -d, download] <packages>\n'
|
||||
f' slpkg [{self.CYAN}COMMAND{self.ENDC}] [-r, remove, -f, find, -w, view, -s, search] <packages>\n'
|
||||
" \nIf you need more information please try 'slpkg --help'.")
|
||||
|
||||
print(args)
|
||||
raise SystemExit()
|
||||
|
||||
|
||||
def help(self, status: int):
|
||||
args = [f'{self.BOLD}USAGE:{self.ENDC} {Configs.prog_name} [{self.YELLOW}OPTIONS{self.ENDC}] [{self.CYAN}COMMAND{self.ENDC}] <packages>\n',
|
||||
f'{self.BOLD}DESCRIPTION:{self.ENDC}',
|
||||
' Packaging tool that interacts with the SBo repository.\n',
|
||||
f'{self.BOLD}COMMANDS:{self.ENDC}',
|
||||
f' {self.RED}update{self.ENDC} Update the package lists.',
|
||||
f' {self.CYAN}upgrade{self.ENDC} Upgrade all the packages.',
|
||||
f' {self.CYAN}check-updates{self.ENDC} Check for news on ChangeLog.txt.',
|
||||
f' {self.CYAN}clean-logs{self.ENDC} Clean dependencies log tracking.',
|
||||
f' {self.CYAN}clean-tmp{self.ENDC} Delete all the downloaded sources.',
|
||||
f' {self.CYAN}-b, build{self.ENDC} <packages> Build only the packages.',
|
||||
f' {self.CYAN}-i, install{self.ENDC} <packages> Build and install the packages.',
|
||||
f' {self.CYAN}-d, download{self.ENDC} <packages> Download only the scripts and sources.',
|
||||
f' {self.CYAN}-r, remove{self.ENDC} <packages> Remove installed packages.',
|
||||
f' {self.CYAN}-f, find{self.ENDC} <packages> Find installed packages.',
|
||||
f' {self.CYAN}-w, view{self.ENDC} <packages> View packages from the repository.',
|
||||
f' {self.CYAN}-s, search{self.ENDC} <packages> Search packages from the repository.\n',
|
||||
f'{self.BOLD}OPTIONS:{self.ENDC}',
|
||||
f' {self.YELLOW}--yes{self.ENDC} Answer Yes to all questions.',
|
||||
f' {self.YELLOW}--jobs{self.ENDC} Set it for multicore systems.',
|
||||
f' {self.YELLOW}--resolve-off{self.ENDC} Turns off dependency resolving.',
|
||||
f' {self.YELLOW}--reinstall{self.ENDC} Upgrade packages of the same version.',
|
||||
f' {self.YELLOW}--skip-installed{self.ENDC} Skip installed packages.\n',
|
||||
' -h, --help Show this message and exit.',
|
||||
' -v, --version Print version and exit.\n',
|
||||
'Edit the configuration file in the /etc/slpkg/slpkg.toml.',
|
||||
'If you need more information try to use slpkg manpage.']
|
||||
|
||||
for opt in args:
|
||||
print(opt)
|
||||
raise SystemExit(status)
|
||||
|
|
|
@ -2,20 +2,18 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.configs import Configs
|
||||
|
||||
|
||||
@dataclass
|
||||
class Version:
|
||||
prog_name: str = Configs.prog_name
|
||||
version_info: tuple = (4, 3, 3)
|
||||
version: str = '{0}.{1}.{2}'.format(*version_info)
|
||||
license: str = 'MIT License'
|
||||
author: str = 'dslackw'
|
||||
homepage: str = 'https://dslackw.gitlab.io/slpkg'
|
||||
''' Print the vesrsion. '''
|
||||
|
||||
def __init__(self):
|
||||
self.version_info: tuple = (4, 3, 4)
|
||||
self.version: str = '{0}.{1}.{2}'.format(*self.version_info)
|
||||
self.license: str = 'MIT License'
|
||||
self.author: str = 'Dimitris Zlatanidis (dslackw)'
|
||||
self.homepage: str = 'https://dslackw.gitlab.io/slpkg'
|
||||
|
||||
def view(self):
|
||||
print(f'{self.prog_name} version: {self.version}\n'
|
||||
print(f'Version: {self.version}\n'
|
||||
f'Author: {self.author}\n'
|
||||
f'License: {self.license}\n'
|
||||
f'Homepage: {self.homepage}')
|
||||
|
|
|
@ -3,19 +3,20 @@
|
|||
|
||||
|
||||
import urllib3
|
||||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.models.models import SBoTable
|
||||
from slpkg.queries import SBoQueries
|
||||
from slpkg.models.models import session as Session
|
||||
|
||||
|
||||
@dataclass
|
||||
class ViewPackage:
|
||||
session: str = Session
|
||||
colors: dict = Configs.colour
|
||||
sbo_repo_url: str = Configs.sbo_repo_url
|
||||
sbo_tar_suffix: str = Configs.sbo_tar_suffix
|
||||
''' View the repository packages. '''
|
||||
|
||||
def __init__(self):
|
||||
self.session: str = Session
|
||||
self.configs: str = Configs
|
||||
self.colors: dict = self.configs.colour
|
||||
|
||||
def package(self, packages):
|
||||
http = urllib3.PoolManager()
|
||||
|
@ -42,10 +43,10 @@ class ViewPackage:
|
|||
).filter(SBoTable.name == package).first()
|
||||
|
||||
readme = http.request(
|
||||
'GET', f'{self.sbo_repo_url}/{info[9]}/{info[0]}/README')
|
||||
'GET', f'{self.configs.sbo_repo_url}/{info[9]}/{info[0]}/README')
|
||||
|
||||
info_file = http.request(
|
||||
'GET', f'{self.sbo_repo_url}/{info[9]}/{info[0]}/{info[0]}.info')
|
||||
'GET', f'{self.configs.sbo_repo_url}/{info[9]}/{info[0]}/{info[0]}.info')
|
||||
|
||||
maintainer, email, homepage = '', '', ''
|
||||
for line in info_file.data.decode().splitlines():
|
||||
|
@ -56,20 +57,22 @@ class ViewPackage:
|
|||
if line.startswith('EMAIL'):
|
||||
email = line[7:-1].strip()
|
||||
|
||||
deps = (', '.join([f'{pkg} ({SBoQueries(pkg).version()})' for pkg in info[2].split()]))
|
||||
|
||||
print(f'Name: {GREEN}{info[0]}{ENDC}\n'
|
||||
f'Version: {GREEN}{info[1]}{ENDC}\n'
|
||||
f'Requires: {GREEN}{info[2]}{ENDC}\n'
|
||||
f'Requires: {GREEN}{deps}{ENDC}\n'
|
||||
f'Homepage: {BLUE}{homepage}{ENDC}\n'
|
||||
f'Download SlackBuild: {BLUE}{self.sbo_repo_url}/{info[9]}/{info[0]}{self.sbo_tar_suffix}{ENDC}\n'
|
||||
f'Download SlackBuild: {BLUE}{self.configs.sbo_repo_url}/{info[9]}/{info[0]}{self.configs.sbo_tar_suffix}{ENDC}\n'
|
||||
f'Download sources: {BLUE}{info[3]}{ENDC}\n'
|
||||
f'Download_x86_64 sources: {BLUE}{info[4]}{ENDC}\n'
|
||||
f'Md5sum: {YELLOW}{info[5]}{ENDC}\n'
|
||||
f'Md5sum_x86_64: {YELLOW}{info[6]}{ENDC}\n'
|
||||
f'Files: {GREEN}{info[7]}{ENDC}\n'
|
||||
f'Description: {GREEN}{info[8]}{ENDC}\n'
|
||||
f'Slackware: {CYAN}{self.sbo_repo_url.split("/")[-1]}{ENDC}\n'
|
||||
f'Slackware: {CYAN}{self.configs.sbo_repo_url.split("/")[-1]}{ENDC}\n'
|
||||
f'Category: {RED}{info[9]}{ENDC}\n'
|
||||
f'SBo url: {BLUE}{self.sbo_repo_url}/{info[9]}/{info[0]}{ENDC}\n'
|
||||
f'SBo url: {BLUE}{self.configs.sbo_repo_url}/{info[9]}/{info[0]}{ENDC}\n'
|
||||
f'Maintainer: {YELLOW}{maintainer}{ENDC}\n'
|
||||
f'Email: {YELLOW}{email}{ENDC}\n'
|
||||
f'\nREADME: {CYAN}{readme.data.decode()}{ENDC}')
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.queries import SBoQueries
|
||||
|
@ -12,16 +11,16 @@ from slpkg.models.models import LogsDependencies
|
|||
from slpkg.models.models import session as Session
|
||||
|
||||
|
||||
@dataclass
|
||||
class ViewMessage:
|
||||
flags: list
|
||||
colors: dict = Configs.colour
|
||||
log_packages: str = Configs.log_packages
|
||||
sbo_repo_tag: str = Configs.sbo_repo_tag
|
||||
arch: str = Configs.os_arch
|
||||
session: str = Session
|
||||
utils: str = Utilities()
|
||||
black: list = Blacklist()
|
||||
''' Print some messages before. '''
|
||||
|
||||
def __init__(self, flags):
|
||||
self.flags: list = flags
|
||||
self.configs: str = Configs
|
||||
self.colors: dict = self.configs.colour
|
||||
self.session: str = Session
|
||||
self.utils: str = Utilities()
|
||||
self.black: list = Blacklist()
|
||||
|
||||
def build_packages(self, slackbuilds: list, dependencies: list):
|
||||
print('The following packages will be build:\n')
|
||||
|
@ -118,7 +117,7 @@ class ViewMessage:
|
|||
install, set_color = 'upgrade', color['YELLOW']
|
||||
|
||||
if installed and 'noarch' in installed:
|
||||
self.arch = 'noarch'
|
||||
self.configs.os_arch = 'noarch'
|
||||
|
||||
if installed:
|
||||
|
||||
|
@ -127,7 +126,7 @@ class ViewMessage:
|
|||
|
||||
print(f'[{set_color} {install} {color["ENDC"]}] -> '
|
||||
f'{sbo}-{version} {set_color}'
|
||||
f'({installed.split(self.arch)[0][:-1].split("-")[-1]})'
|
||||
f'({installed.split(self.configs.os_arch)[0][:-1].split("-")[-1]})'
|
||||
f'{color["ENDC"]}')
|
||||
else:
|
||||
print(f'[{color["CYAN"]} install {color["ENDC"]}] -> '
|
||||
|
@ -135,13 +134,13 @@ class ViewMessage:
|
|||
|
||||
def _view_installed_packages(self, name: str):
|
||||
''' View and creates list with packages for remove. '''
|
||||
installed = os.listdir(self.log_packages)
|
||||
installed = os.listdir(self.configs.log_packages)
|
||||
color = self.colors()
|
||||
|
||||
for package in installed:
|
||||
black = package.split('-')[0]
|
||||
if (package.startswith(f'{name}-') and
|
||||
self.sbo_repo_tag in package and
|
||||
self.configs.sbo_repo_tag in package and
|
||||
black not in self.black.get()):
|
||||
self.installed_packages.append(package)
|
||||
print(f'[{color["RED"]} delete {color["ENDC"]}] -> {package}')
|
||||
|
|
Loading…
Add table
Reference in a new issue