mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-10 20:01:54 +01:00
Merge branch 'develop'
This commit is contained in:
commit
bda8a439ea
14 changed files with 141 additions and 70 deletions
|
@ -1,3 +1,11 @@
|
|||
4.2.2 - 20/10/2022
|
||||
Updated:
|
||||
- Removed version for skip installed option
|
||||
- Removed unused configurations
|
||||
- Search command to view
|
||||
Added:
|
||||
- A new search command to search and match packages from the repository
|
||||
|
||||
4.2.1 - 18/10/2022
|
||||
Added:
|
||||
- Print the README file in the search option
|
||||
|
|
|
@ -30,8 +30,8 @@ Install from the official third-party `SBo repository <https://slackbuilds.org/r
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
$ tar xvf slpkg-4.2.1.tar.gz
|
||||
$ cd slpkg-4.2.1
|
||||
$ tar xvf slpkg-4.2.2.tar.gz
|
||||
$ cd slpkg-4.2.2
|
||||
$ ./install.sh
|
||||
|
||||
|
||||
|
@ -55,7 +55,8 @@ Usage
|
|||
download <packages> Download only the packages.
|
||||
remove <packages> Remove installed packages.
|
||||
find <packages> Find installed packages.
|
||||
search <packages> Search packages on repository.
|
||||
view <packages> View packages from the repository.
|
||||
search <packages> Search packages from the repository.
|
||||
clean-logs Clean dependencies log tracking.
|
||||
clean-tmp Deletes all the downloaded sources.
|
||||
|
||||
|
|
|
@ -2,33 +2,48 @@ configs:
|
|||
# OS architecture by default.
|
||||
os_arch: x86_64
|
||||
|
||||
# All necessary paths.
|
||||
tmp_path: /tmp
|
||||
# Tmp path for slpkg.
|
||||
tmp_slpkg: /tmp/slpkg
|
||||
build_path: /tmp/slpkg/build
|
||||
download_only: /tmp/slpkg
|
||||
lib_path: /var/lib/slpkg
|
||||
etc_path: /etc/slpkg
|
||||
db_path: /var/lib/slpkg/database
|
||||
sbo_repo_path: /var/lib/slpkg/repository
|
||||
log_packages: /var/log/packages
|
||||
|
||||
# Database name.
|
||||
# Path for building source and the script
|
||||
build_path: /tmp/slpkg/build
|
||||
|
||||
# This path working only with the command download.
|
||||
download_only: /tmp/slpkg
|
||||
|
||||
# The path that the SLACKBUILDS.TXT file downloaded.
|
||||
sbo_repo_path: /var/lib/slpkg/repository
|
||||
|
||||
# The name of the database. Default name is 'database.slpkg'.
|
||||
database: database.slpkg
|
||||
|
||||
# SBo repository configs.
|
||||
# Slackbuilds.org repository url.
|
||||
sbo_repo_url: http://slackbuilds.org/slackbuilds/15.0
|
||||
|
||||
# The sbo repository main file.
|
||||
sbo_txt: SLACKBUILDS.TXT
|
||||
|
||||
# The sbo tar suffix.
|
||||
sbo_tar_suffix: .tar.gz
|
||||
|
||||
# The sbo repo tag.
|
||||
sbo_repo_tag: _SBo
|
||||
|
||||
# Slackware commands.
|
||||
# Slackware install command. Alternative you can
|
||||
# use 'installpkg', if you want.
|
||||
installpkg: upgradepkg --install-new
|
||||
|
||||
# Upgrade or reinstall slackware command.
|
||||
reinstall: upgradepkg --reinstall
|
||||
|
||||
# Slackware command fro remove packages.
|
||||
removepkg: removepkg
|
||||
|
||||
# Cli menu colors configs.
|
||||
# Cli menu colors configs. Default is on. [on/off]
|
||||
colors: on
|
||||
|
||||
# Wget options.
|
||||
# Wget downloader options.
|
||||
# -c, --continue: resume getting a partially-downloaded file.
|
||||
# -N, --timestamping: don't re-retrieve files unless newer
|
||||
# than local.
|
||||
wget_options: -c -N
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
slpkg - [OPTIONS] [COMMAND] <packages>
|
||||
.SH SYNAPSES
|
||||
.P
|
||||
slpkg [-h|-v] [update] [upgrade] [build] [install] [download] [remove] [find] [search] [clean-logs] [clean-tmp] --yes --jobs --resolve-off --reinstall --skip-installed
|
||||
slpkg [-h|-v] [update] [upgrade] [build] [install] [download] [remove] [find] [view] [search] [clean-logs] [clean-tmp] --yes --jobs --resolve-off --reinstall --skip-installed
|
||||
.SH DESCRIPTION
|
||||
.P
|
||||
Slpkg is a software package manager that installs, updates, and removes packages on Slackware based systems. It automatically computes dependencies and figures out what things should occur to install packages. Slpkg makes it easier to maintain groups of machines without having to manually update.
|
||||
|
@ -47,9 +47,14 @@ find
|
|||
Find sbo installed packages on your distribution.
|
||||
.RE
|
||||
.P
|
||||
view
|
||||
.RS
|
||||
View packages from the repository and get everything in your terminal.
|
||||
.RE
|
||||
.P
|
||||
search
|
||||
.RS
|
||||
Search packages on repository and view everything in your terminal.
|
||||
Search and match packages from the repository.
|
||||
.RE
|
||||
.P
|
||||
clean-logs
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[metadata]
|
||||
name = slpkg
|
||||
version = 4.2.1
|
||||
version = 4.2.2
|
||||
license_file = LICENSE
|
||||
author = Dimitris Zlatanidis
|
||||
author_email = d.zlatanidis@gmail.com
|
||||
|
|
|
@ -67,15 +67,10 @@ class Configs:
|
|||
os_arch: str = config['os_arch']
|
||||
|
||||
# All necessary paths
|
||||
tmp_path: str = config['tmp_path']
|
||||
tmp_slpkg: str = config['tmp_slpkg']
|
||||
build_path: str = config['build_path']
|
||||
download_only: str = config['download_only']
|
||||
lib_path: str = config['lib_path']
|
||||
etc_path: str = config['etc_path']
|
||||
db_path: str = config['db_path']
|
||||
sbo_repo_path: str = config['sbo_repo_path']
|
||||
log_packages: str = config['log_packages']
|
||||
|
||||
# Database name
|
||||
database: str = config['database']
|
||||
|
|
|
@ -15,6 +15,10 @@ class FindInstalled:
|
|||
|
||||
def find(self, packages: list):
|
||||
matching = []
|
||||
|
||||
print(f'The list below shows the packages '
|
||||
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:
|
||||
|
|
|
@ -6,14 +6,15 @@ import sys
|
|||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.checks import Check
|
||||
from slpkg.search import Search
|
||||
from slpkg.upgrade import Upgrade
|
||||
from slpkg.version import Version
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.search import SearchPackage
|
||||
from slpkg.views.cli_menu import usage
|
||||
from slpkg.download_only import Download
|
||||
from slpkg.slackbuild import Slackbuilds
|
||||
from slpkg.view_package import ViewPackage
|
||||
from slpkg.find_installed import FindInstalled
|
||||
from slpkg.remove_packages import RemovePackages
|
||||
from slpkg.clean_logs import CleanLogsDependencies
|
||||
|
@ -131,14 +132,24 @@ class Argparse:
|
|||
raise SystemExit()
|
||||
usage(1)
|
||||
|
||||
def search(self):
|
||||
def view(self):
|
||||
if len(self.args) >= 2 and not self.flags:
|
||||
packages = list(set(self.args[1:]))
|
||||
packages = self.check.blacklist(packages)
|
||||
|
||||
self.check.exists(packages)
|
||||
|
||||
search = Search()
|
||||
view = ViewPackage()
|
||||
view.package(packages)
|
||||
raise SystemExit()
|
||||
usage(1)
|
||||
|
||||
def search(self):
|
||||
if len(self.args) >= 2 and not self.flags:
|
||||
packages = list(set(self.args[1:]))
|
||||
packages = self.check.blacklist(packages)
|
||||
|
||||
search = SearchPackage()
|
||||
search.package(packages)
|
||||
raise SystemExit()
|
||||
usage(1)
|
||||
|
@ -193,8 +204,9 @@ def main():
|
|||
'install': argparse.install,
|
||||
'download': argparse.download,
|
||||
'remove': argparse.remove,
|
||||
'search': argparse.search,
|
||||
'view': argparse.view,
|
||||
'find': argparse.find,
|
||||
'search': argparse.search,
|
||||
'clean-logs': argparse.clean_logs,
|
||||
'clean-tmp': argparse.clean_tmp
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ class SBoQueries:
|
|||
return ''
|
||||
|
||||
def _chose_arch(self, arch, arch64):
|
||||
if self.os_arch and arch64:
|
||||
if self.os_arch == 'x86_64' and arch64:
|
||||
return arch64
|
||||
return arch
|
||||
|
||||
|
|
|
@ -2,53 +2,29 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
import urllib3
|
||||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.queries import SBoQueries
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.models.models import SBoTable
|
||||
from slpkg.models.models import session as Session
|
||||
|
||||
|
||||
@dataclass
|
||||
class Search:
|
||||
session: str = Session
|
||||
class SearchPackage:
|
||||
colors: dict = Configs.colour
|
||||
sbo_repo_url: str = Configs.sbo_repo_url
|
||||
|
||||
def package(self, packages):
|
||||
http = urllib3.PoolManager()
|
||||
color = self.colors()
|
||||
GREEN = color['GREEN']
|
||||
BLUE = color['BLUE']
|
||||
YELLOW = color['YELLOW']
|
||||
CYAN = color['CYAN']
|
||||
ENDC = color['ENDC']
|
||||
|
||||
for package in packages:
|
||||
info = self.session.query(
|
||||
SBoTable.name,
|
||||
SBoTable.version,
|
||||
SBoTable.requires,
|
||||
SBoTable.download,
|
||||
SBoTable.download64,
|
||||
SBoTable.md5sum,
|
||||
SBoTable.md5sum64,
|
||||
SBoTable.files,
|
||||
SBoTable.short_description,
|
||||
SBoTable.location
|
||||
).filter(SBoTable.name == package).first()
|
||||
names = SBoQueries('').names()
|
||||
|
||||
readme = http.request(
|
||||
'GET', f'{self.sbo_repo_url}/{info[9]}/{info[0]}/README')
|
||||
print(f'The list below shows the packages '
|
||||
f'that contains \'{", ".join([p for p in packages])}\' files:\n')
|
||||
|
||||
print(f'Name: {GREEN}{info[0]}{ENDC}\n'
|
||||
f'Version: {GREEN}{info[1]}{ENDC}\n'
|
||||
f'Requires: {GREEN}{info[2]}{ENDC}\n'
|
||||
f'Download: {BLUE}{info[3]}{ENDC}\n'
|
||||
f'Download_x86_64: {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'SBo url: {BLUE}{self.sbo_repo_url}/{info[9]}/{info[0]}{ENDC}\n'
|
||||
f'README: {readme.data.decode()}')
|
||||
for name in names:
|
||||
for package in packages:
|
||||
if package in name:
|
||||
desc = SBoQueries(name).description().replace(name, '')
|
||||
print(f'{name}-{SBoQueries(name).version()}'
|
||||
f'{CYAN}{desc}{ENDC}')
|
||||
|
|
|
@ -75,9 +75,8 @@ class Slackbuilds:
|
|||
for dep in deps:
|
||||
|
||||
# Checks if the package was installed and skipped.
|
||||
pkg = f'{dep}-{SBoQueries(dep).version()}'
|
||||
if ('--skip-installed' in self.flags and
|
||||
self.utils.is_installed(f'{pkg}-')):
|
||||
self.utils.is_installed(f'{dep}-')):
|
||||
continue
|
||||
|
||||
if dep not in self.slackbuilds:
|
||||
|
|
|
@ -10,7 +10,7 @@ from slpkg.configs import Configs
|
|||
@dataclass
|
||||
class Version:
|
||||
prog_name: str = Configs.prog_name
|
||||
version_info: tuple = (4, 2, 1)
|
||||
version_info: tuple = (4, 2, 2)
|
||||
version: str = '{0}.{1}.{2}'.format(*version_info)
|
||||
license: str = 'MIT License'
|
||||
author: str = 'dslackw'
|
||||
|
|
55
slpkg/view_package.py
Normal file
55
slpkg/view_package.py
Normal file
|
@ -0,0 +1,55 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
import urllib3
|
||||
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 ViewPackage:
|
||||
session: str = Session
|
||||
colors: dict = Configs.colour
|
||||
sbo_repo_url: str = Configs.sbo_repo_url
|
||||
|
||||
def package(self, packages):
|
||||
http = urllib3.PoolManager()
|
||||
color = self.colors()
|
||||
GREEN = color['GREEN']
|
||||
BLUE = color['BLUE']
|
||||
YELLOW = color['YELLOW']
|
||||
CYAN = color['CYAN']
|
||||
ENDC = color['ENDC']
|
||||
|
||||
for package in packages:
|
||||
info = self.session.query(
|
||||
SBoTable.name,
|
||||
SBoTable.version,
|
||||
SBoTable.requires,
|
||||
SBoTable.download,
|
||||
SBoTable.download64,
|
||||
SBoTable.md5sum,
|
||||
SBoTable.md5sum64,
|
||||
SBoTable.files,
|
||||
SBoTable.short_description,
|
||||
SBoTable.location
|
||||
).filter(SBoTable.name == package).first()
|
||||
|
||||
readme = http.request(
|
||||
'GET', f'{self.sbo_repo_url}/{info[9]}/{info[0]}/README')
|
||||
|
||||
print(f'Name: {GREEN}{info[0]}{ENDC}\n'
|
||||
f'Version: {GREEN}{info[1]}{ENDC}\n'
|
||||
f'Requires: {GREEN}{info[2]}{ENDC}\n'
|
||||
f'Download: {BLUE}{info[3]}{ENDC}\n'
|
||||
f'Download_x86_64: {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'SBo url: {BLUE}{self.sbo_repo_url}/{info[9]}/{info[0]}{ENDC}\n'
|
||||
f'README: {CYAN}{readme.data.decode()}{ENDC}')
|
|
@ -26,7 +26,8 @@ def usage(status: int):
|
|||
f' {CYAN}download{ENDC} <packages> Download only the packages.',
|
||||
f' {CYAN}remove{ENDC} <packages> Remove installed packages.',
|
||||
f' {CYAN}find{ENDC} <packages> Find installed packages.',
|
||||
f' {CYAN}search{ENDC} <packages> Search packages on repository.',
|
||||
f' {CYAN}view{ENDC} <packages> View packages from the repository.',
|
||||
f' {CYAN}search{ENDC} <packages> Search packages from the repository.',
|
||||
f' {CYAN}clean-logs{ENDC} Clean dependencies log tracking.',
|
||||
f' {CYAN}clean-tmp{ENDC} Delete all the downloaded sources.\n',
|
||||
f'{BOLD}OPTIONS:{ENDC}',
|
||||
|
|
Loading…
Reference in a new issue