Merge branch 'develop'

This commit is contained in:
Dimitris Zlatanidis 2022-11-28 20:49:51 +02:00
commit 7088587ec0
10 changed files with 83 additions and 61 deletions

View file

@ -1,3 +1,11 @@
4.3.1 - 26/11/2022
Added:
- Category in the view command
- Slackware repo version
Bugfixed:
- Remove packages equal with the name
- Install packages with correct sbo tag
4.3.0 - 23/11/2022
Added:
- Message for blacklisted packages

View file

@ -30,8 +30,8 @@ Install from the official third-party `SBo repository <https://slackbuilds.org/r
.. code-block:: bash
$ tar xvf slpkg-4.3.0.tar.gz
$ cd slpkg-4.3.0
$ tar xvf slpkg-4.3.1.tar.gz
$ cd slpkg-4.3.1
$ ./install.sh

View file

@ -1,10 +1,10 @@
.TH slpkg 1 "Orestiada, Greece" "slpkg 4.2.5" dslackw
.TH slpkg 1 "Orestiada, Greece" "slpkg 4.3.1" dslackw
.SH NAME
.P
slpkg - [OPTIONS] [COMMAND] <packages>
.SH SYNAPSES
.P
slpkg [-h|-v] [update] [upgrade] [check-updates] [build] [install] [download] [remove] [find] [view] [search] [clean-logs] [clean-tmp] --yes --jobs --resolve-off --reinstall --skip-installed
slpkg [-h|-v] [update] [upgrade] [check-updates] [clean-logs] [clean-tmp] [-b, build] [-i, install] [-d, download] [-r, remove] [-f, find] [-w, view] [-s, search] --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.
@ -27,41 +27,6 @@ check-updates
Check if there is any news on the SlackBuild's ChangeLog.txt file.
.RE
.P
build
.RS
Builds the Slackbuilds scripts and adds them to the /tmp directory.
.RE
.P
install
.RS
Builds and installs the packages in the correct order and also logs the packages with dependencies to use for removal.
.RE
.P
download
.RS
Download the SlackBuilds scripts and the sources without building or installing it.
.RE
.P
remove
.RS
Removes packages with dependencies if the packages was installed with 'slpkg install' method. Slpkg looks at the 'sbo_repo_tag' configuration to find packages for removal.
.RE
.P
find
.RS
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 and match packages from the repository.
.RE
.P
clean-logs
.RS
Cleans dependencies log tracking. After that procedure you should remove dependencies by hand.
@ -71,6 +36,41 @@ clean-tmp
.RS
Deletes all the downloaded SlackBuilds scripts and sources.
.RE
.P
-b, build
.RS
Builds the Slackbuilds scripts and adds them to the /tmp directory.
.RE
.P
-i, install
.RS
Builds and installs the packages in the correct order and also logs the packages with dependencies to use for removal.
.RE
.P
-d, download
.RS
Download the SlackBuilds scripts and the sources without building or installing it.
.RE
.P
-r, remove
.RS
Removes packages with dependencies if the packages was installed with 'slpkg install' method. Slpkg looks at the 'sbo_repo_tag' configuration to find packages for removal.
.RE
.P
-f, find
.RS
Find sbo installed packages on your distribution.
.RE
.P
-w, view
.RS
View packages from the repository and get everything in your terminal.
.RE
.P
-s, search
.RS
Search and match packages from the repository.
.RE
.SH OPTIONS
.P
--yes

View file

@ -1,6 +1,6 @@
[metadata]
name = slpkg
version = 4.3.0
version = 4.3.1
license_file = LICENSE
author = Dimitris Zlatanidis
author_email = d.zlatanidis@gmail.com

View file

@ -27,7 +27,7 @@ class Check:
packages.append(sbo)
if packages:
raise SystemExit(f'\nPackages {", ".join(packages)} '
raise SystemExit(f'\nPackages \'{", ".join(packages)}\' '
'does not exists.\n')
def unsupported(self, slackbuilds: list):
@ -36,18 +36,27 @@ class Check:
sources = SBoQueries(sbo).sources()
if 'UNSUPPORTED' in sources:
raise SystemExit(f'\nPackage {sbo} unsupported by arch.\n')
raise SystemExit(f"\nPackage '{sbo}' unsupported by arch.\n")
def installed(self, slackbuilds: list):
''' Checking for installed packages. '''
found, not_found = [], []
for package in os.listdir(self.log_packages):
for sbo in slackbuilds:
for sbo in slackbuilds:
for package in os.listdir(self.log_packages):
if (package.startswith(f'{sbo}-') and
package.endswith(self.sbo_repo_tag)):
found.append(sbo)
if sbo + '-' in package and self.sbo_repo_tag in package:
return
for sbo in slackbuilds:
if sbo not in found:
not_found.append(sbo)
raise SystemExit('\nNot found installed packages.\n')
if not_found:
raise SystemExit(f'\nNot found \'{", ".join(not_found)}\' '
'installed packages.\n')
return found
def blacklist(self, slackbuilds: list):
''' Checking if the packages are blacklisted. '''

View file

@ -142,7 +142,7 @@ class Argparse:
packages = list(set(self.args[1:]))
self.check.database()
self.check.installed(packages)
packages = self.check.installed(packages)
remove = RemovePackages(packages, self.flags)
remove.remove()

View file

@ -176,7 +176,7 @@ class Slackbuilds:
pkg = f'{name}-{version}'
for package in os.listdir(self.tmp_path):
if pkg in package:
if pkg in package and self.sbo_repo_tag in package:
packages.append(package)
return max(packages)

View file

@ -10,7 +10,7 @@ from slpkg.configs import Configs
@dataclass
class Version:
prog_name: str = Configs.prog_name
version_info: tuple = (4, 3, 0)
version_info: tuple = (4, 3, 1)
version: str = '{0}.{1}.{2}'.format(*version_info)
license: str = 'MIT License'
author: str = 'dslackw'

View file

@ -24,6 +24,7 @@ class ViewPackage:
BLUE = color['BLUE']
YELLOW = color['YELLOW']
CYAN = color['CYAN']
RED = color['RED']
ENDC = color['ENDC']
for package in packages:
@ -66,6 +67,8 @@ class ViewPackage:
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'Category: {RED}{info[9]}{ENDC}\n'
f'SBo url: {BLUE}{self.sbo_repo_url}/{info[9]}/{info[0]}{ENDC}\n'
f'Maintainer: {YELLOW}{maintainer}{ENDC}\n'
f'Email: {YELLOW}{email}{ENDC}\n'

View file

@ -63,25 +63,27 @@ class ViewMessage:
def remove_packages(self, packages: list):
print('The following packages will be removed:\n')
self.installed_packages = []
slackbuilds, dependencies, = [], []
slackbuilds, dependencies, deps = [], [], []
for pkg in packages:
self._view_installed_packages(pkg)
slackbuilds.append(pkg)
self.dependencies = self.session.query(
dependencies.append(self.session.query(
LogsDependencies.requires).filter(
LogsDependencies.name == pkg).first()
LogsDependencies.name == pkg).first())
if self.dependencies and '--resolve-off' not in self.flags:
print('\nDependencies:')
for dep in self.dependencies[0].split():
if None not in dependencies and '--resolve-off' not in self.flags:
print('\nDependencies:')
for i in range(0, len(dependencies)):
for dep in dependencies[i][0].split():
self._view_installed_packages(dep)
dependencies.append(dep)
deps.append(dep)
self._view_total(slackbuilds, dependencies, option='remove')
self._view_total(slackbuilds, deps, option='remove')
return self.installed_packages, self.dependencies
return self.installed_packages, deps
def _view_download(self, sbo: str, version: str):
color = self.colors()
@ -135,8 +137,8 @@ class ViewMessage:
for package in installed:
black = package.split('-')[0]
if (package.startswith(name) and self.sbo_repo_tag in package and
black not in self.black.get()):
if (package.startswith(f'{name}-') and
self.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}')