mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-30 20:34:38 +01:00
Merge branch 'develop'
This commit is contained in:
commit
7d8802296e
9 changed files with 55 additions and 47 deletions
|
@ -1,3 +1,9 @@
|
|||
4.4.9 - 13/01/2023
|
||||
Updated:
|
||||
- Color highlight for installed packages
|
||||
BugFixed:
|
||||
- Upgrade packages (Thanks to marav)
|
||||
|
||||
4.4.8 - 12/01/2023
|
||||
Added:
|
||||
- Error ascii box for checksum
|
||||
|
|
|
@ -31,8 +31,8 @@ Install from the official third-party `SBo repository <https://slackbuilds.org/r
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
$ tar xvf slpkg-4.4.8.tar.gz
|
||||
$ cd slpkg-4.4.8
|
||||
$ tar xvf slpkg-4.4.9.tar.gz
|
||||
$ cd slpkg-4.4.9
|
||||
$ ./install.sh
|
||||
|
||||
Screenshots
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[metadata]
|
||||
name = slpkg
|
||||
version = 4.4.8
|
||||
version = 4.4.9
|
||||
license_file = LICENSE
|
||||
author = Dimitris Zlatanidis
|
||||
author_email = d.zlatanidis@gmail.com
|
||||
|
|
|
@ -170,15 +170,15 @@ class Argparse:
|
|||
for package in repo_packages:
|
||||
for pkg in packages:
|
||||
|
||||
if pkg in package:
|
||||
if method == 'install' and pkg in package:
|
||||
repo_ver = SBoQueries(package).version()
|
||||
choices += [(package, repo_ver, False)]
|
||||
|
||||
if method == 'upgrade':
|
||||
pkg = self.utils.is_installed(package)
|
||||
inst_ver = self.utils.split_installed_pkg(pkg)[1]
|
||||
choices += [(package, f'{inst_ver} -> {repo_ver}', True)]
|
||||
else:
|
||||
choices += [(package, repo_ver, False)]
|
||||
elif method == 'upgrade' and pkg == package:
|
||||
repo_ver = SBoQueries(package).version()
|
||||
pkg = self.utils.is_installed(package)
|
||||
inst_ver = self.utils.split_installed_pkg(pkg)[1]
|
||||
choices += [(package, f'{inst_ver} -> {repo_ver}', True)]
|
||||
|
||||
if not choices:
|
||||
return packages
|
||||
|
|
|
@ -7,7 +7,6 @@ import subprocess
|
|||
|
||||
from pathlib import Path
|
||||
from collections import OrderedDict
|
||||
from distutils.version import LooseVersion
|
||||
from multiprocessing import Process, cpu_count
|
||||
|
||||
from slpkg.checksum import Md5sum
|
||||
|
@ -89,9 +88,6 @@ class Slackbuilds:
|
|||
self.utils.is_installed(dep)):
|
||||
continue
|
||||
|
||||
if dep in self.slackbuilds:
|
||||
self.slackbuilds.remove(dep)
|
||||
|
||||
self.dependencies.append(dep)
|
||||
|
||||
# Remove duplicate packages and keeps the order.
|
||||
|
@ -100,6 +96,11 @@ class Slackbuilds:
|
|||
if dependencies:
|
||||
self.dependencies = self.choose_dependencies(dependencies)
|
||||
|
||||
# Clean up the main packages if they were selected for dependencies
|
||||
for dep in self.dependencies:
|
||||
if dep in self.slackbuilds:
|
||||
self.slackbuilds.remove(dep)
|
||||
|
||||
self.install_order.extend(self.dependencies)
|
||||
|
||||
def choose_dependencies(self, dependencies: list):
|
||||
|
@ -134,7 +135,7 @@ class Slackbuilds:
|
|||
|
||||
def creating_main_for_build(self):
|
||||
""" List with the main slackbuilds. """
|
||||
[self.install_order.append(main) for main in self.sbos.keys()]
|
||||
[self.install_order.append(main) for main in self.sbos.keys() if main not in self.install_order]
|
||||
|
||||
def view_before_build(self):
|
||||
""" View slackbuilds before proceed. """
|
||||
|
@ -149,20 +150,12 @@ class Slackbuilds:
|
|||
|
||||
def download_slackbuilds_and_build(self):
|
||||
""" Downloads files and sources and starting the build. """
|
||||
inst_ver = '0'
|
||||
|
||||
for sbo in self.install_order:
|
||||
|
||||
package = self.utils.is_installed(sbo)
|
||||
|
||||
if package:
|
||||
inst_ver = self.utils.split_installed_pkg(package)[1]
|
||||
|
||||
repo_ver = SBoQueries(sbo).version()
|
||||
|
||||
if (self.mode == 'install' and LooseVersion(repo_ver) > LooseVersion(inst_ver) or
|
||||
self.mode == 'upgrade' and package and LooseVersion(repo_ver) > LooseVersion(inst_ver) or
|
||||
package and self.flag_reinstall in self.flags and self.mode == 'install' or self.mode == 'build'):
|
||||
if (not package or self.utils.is_repo_version_bigger(sbo) or
|
||||
self.mode == 'build' or self.flag_reinstall in self.flags):
|
||||
|
||||
file = f'{sbo}{self.configs.sbo_tar_suffix}'
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.queries import SBoQueries
|
||||
from slpkg.utilities import Utilities
|
||||
|
@ -31,16 +28,11 @@ class Upgrade:
|
|||
for pkg in installed:
|
||||
inst_pkg_name = self.utils.split_installed_pkg(pkg)[0]
|
||||
|
||||
if (pkg.endswith(self.configs.sbo_repo_tag)
|
||||
and inst_pkg_name not in black):
|
||||
if inst_pkg_name not in black and inst_pkg_name in repo_packages:
|
||||
|
||||
if inst_pkg_name in repo_packages:
|
||||
inst_ver = self.utils.split_installed_pkg(pkg)[1]
|
||||
repo_ver = SBoQueries(inst_pkg_name).version()
|
||||
|
||||
if LooseVersion(repo_ver) > LooseVersion(inst_ver):
|
||||
requires += Requires(inst_pkg_name).resolve()
|
||||
upgrade.append(inst_pkg_name)
|
||||
if self.utils.is_repo_version_bigger(inst_pkg_name):
|
||||
requires += Requires(inst_pkg_name).resolve()
|
||||
upgrade.append(inst_pkg_name)
|
||||
|
||||
# Clean the packages if they are dependencies
|
||||
for pkg in upgrade:
|
||||
|
|
|
@ -5,8 +5,10 @@ import time
|
|||
import shutil
|
||||
import tarfile
|
||||
from pathlib import Path
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.queries import SBoQueries
|
||||
from slpkg.blacklist import Blacklist
|
||||
|
||||
|
||||
|
@ -87,3 +89,12 @@ class Utilities:
|
|||
print(f'\n{self.yellow}Finished Successfully:{self.endc}',
|
||||
time.strftime(f'[{self.cyan}%H:%M:%S{self.endc}]',
|
||||
time.gmtime(elapsed_time)))
|
||||
|
||||
def is_repo_version_bigger(self, package):
|
||||
""" Compare two versions. """
|
||||
installed = self.is_installed(package)
|
||||
if installed:
|
||||
installed_version = self.split_installed_pkg(installed)[1]
|
||||
repository_version = SBoQueries(package).version()
|
||||
|
||||
return LooseVersion(repository_version) > LooseVersion(installed_version)
|
||||
|
|
|
@ -5,7 +5,7 @@ class Version:
|
|||
""" Print the version. """
|
||||
|
||||
def __init__(self):
|
||||
self.version_info = (4, 4, 8)
|
||||
self.version_info = (4, 4, 9)
|
||||
self.version = '{0}.{1}.{2}'.format(*self.version_info)
|
||||
self.license = 'MIT License'
|
||||
self.author = 'Dimitris Zlatanidis (dslackw)'
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
import os
|
||||
from typing import Any
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.views.ascii import Ascii
|
||||
|
@ -41,9 +40,16 @@ class ViewMessage:
|
|||
|
||||
def view_packages(self, package, version, mode):
|
||||
""" Printing the main packages. """
|
||||
is_installed = self.utils.is_installed(package)
|
||||
inst_ver = self.utils.split_installed_pkg(is_installed)[1]
|
||||
|
||||
color = self.cyan
|
||||
if mode == 'install' and self.utils.is_installed(package):
|
||||
if mode == 'install' and is_installed:
|
||||
color = self.grey
|
||||
if mode == 'install' and self.flag_reinstall in self.flags and is_installed:
|
||||
color = self.yellow
|
||||
if mode == 'install' and self.utils.is_repo_version_bigger(package):
|
||||
color = self.violet
|
||||
if mode == 'remove':
|
||||
color = self.red
|
||||
if mode == 'build':
|
||||
|
@ -51,6 +57,9 @@ class ViewMessage:
|
|||
if mode == 'upgrade':
|
||||
color = self.violet
|
||||
|
||||
if inst_ver:
|
||||
package = f'{package}-{inst_ver}'
|
||||
|
||||
self.ascii.draw_view_package(package, version, color)
|
||||
|
||||
def view_skipping_packages(self, sbo, version):
|
||||
|
@ -121,12 +130,13 @@ class ViewMessage:
|
|||
dependencies += requires[0].split()
|
||||
|
||||
if dependencies and self.flag_resolve_off not in self.flags:
|
||||
dependencies = self.choose_dependencies_for_remove(dependencies)
|
||||
dependencies = self.choose_dependencies_for_remove(list(set(dependencies)))
|
||||
|
||||
self.ascii.draw_package_title_box('The following packages will be removed:', 'Remove Packages')
|
||||
|
||||
for pkg in slackbuilds:
|
||||
self._view_removed(pkg)
|
||||
if pkg not in dependencies:
|
||||
self._view_removed(pkg)
|
||||
|
||||
if dependencies and self.flag_resolve_off not in self.flags:
|
||||
self.ascii.draw_middle_line()
|
||||
|
@ -181,17 +191,13 @@ class ViewMessage:
|
|||
install = upgrade = remove = 0
|
||||
|
||||
for sbo in slackbuilds:
|
||||
inst_ver = repo_ver = 0
|
||||
installed = self.utils.is_installed(sbo)
|
||||
if installed:
|
||||
inst_ver = self.utils.split_installed_pkg(installed)[1]
|
||||
repo_ver = SBoQueries(sbo).version()
|
||||
|
||||
if not installed:
|
||||
install += 1
|
||||
elif installed and self.flag_reinstall in self.flags:
|
||||
upgrade += 1
|
||||
elif (installed and LooseVersion(repo_ver) > LooseVersion(inst_ver) and
|
||||
elif (installed and self.utils.is_repo_version_bigger(sbo) and
|
||||
self.flag_reinstall not in self.flags):
|
||||
upgrade += 1
|
||||
elif installed and option == 'remove':
|
||||
|
|
Loading…
Add table
Reference in a new issue