From 1e5bcb6a9f4c28c63c3f50e856f60b767103d982 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 18 Jun 2022 21:25:14 +0300 Subject: [PATCH] Fixed installation --- install.sh | 2 +- setup.py | 6 +++--- slackbuild/doinst.sh | 1 + slackbuild/slpkg.SlackBuild | 3 ++- slpkg/main.py | 3 ++- slpkg/metadata.py | 12 +++++++++++- slpkg/version.py | 13 +++++++++++++ 7 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 slpkg/version.py diff --git a/install.sh b/install.sh index 694e9aa2..4e61f9e8 100755 --- a/install.sh +++ b/install.sh @@ -24,7 +24,7 @@ __version() { # Grab version from __metadata_.py file -cat slpkg/metadata.py | grep "version_info: tuple = (" \ +cat slpkg/version.py | grep "version_info: tuple = (" \ | tr -d [[:space:]] | cut -c21-25 | tr , . } diff --git a/setup.py b/setup.py index 0a2756fb..59844439 100755 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from setuptools import setup -from slpkg.metadata import Metadata +from slpkg.version import Version install_requires = ['SQLAlchemy>=1.4.36'] @@ -13,12 +13,12 @@ setup( name='slpkg', packages=['slpkg', 'slpkg/models', 'slpkg/views'], scripts=['bin/slpkg'], - version=Metadata.version, + version=Version.version, description='Package manager for Slackware installations', long_description=open('README.rst').read(), keywords=['slackware', 'slpkg', 'update', 'build', 'install', 'remove', 'slackpkg', 'tool'], - author=Metadata.author, + author='dslackw', url='https://dslackw.gitlab.io/slpkg/', package_data={'': ['LICENSE.txt', 'README.rst', 'ChangeLog.txt']}, data_files=[('/etc/slpkg', ['config/slpkg.json']), diff --git a/slackbuild/doinst.sh b/slackbuild/doinst.sh index 095e2b41..01508eeb 100644 --- a/slackbuild/doinst.sh +++ b/slackbuild/doinst.sh @@ -9,6 +9,7 @@ config() { } config etc/slpkg/slpkg.json.new +config etc/slpkg/blacklist.json.new if [ -x /usr/bin/update-desktop-database ]; then /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1 diff --git a/slackbuild/slpkg.SlackBuild b/slackbuild/slpkg.SlackBuild index e695ac42..2cd3a9fb 100755 --- a/slackbuild/slpkg.SlackBuild +++ b/slackbuild/slpkg.SlackBuild @@ -24,7 +24,7 @@ __version() { # Grab version from __metadata_.py file -cat ../slpkg/metadata.py | grep "version_info: tuple = (" \ +cat ../slpkg/version.py | grep "version_info: tuple = (" \ | tr -d [[:space:]] | cut -c21-25 | tr , . } @@ -99,6 +99,7 @@ find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | gr # install configuration files mkdir -p $PKG/etc/slpkg install -D -m0644 config/slpkg.json $PKG/etc/slpkg/slpkg.json.new +install -D -m0644 config/blacklist.json $PKG/etc/slpkg/blacklist.json.new mkdir -p $PKG/usr/man/man1 cp man/slpkg.1 $PKG/usr/man/man1 diff --git a/slpkg/main.py b/slpkg/main.py index 2350b046..e669c82b 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -12,6 +12,7 @@ from slpkg.remove_packages import RemovePackages from slpkg.update_repository import UpdateRepository from slpkg.clean_logs import CleanLogsDependencies from slpkg.checks import Check +from slpkg.version import Version @dataclass @@ -49,7 +50,7 @@ class Argparse: usage(0) if self.args[0] in ['--version', '-v']: - print(f'{Metadata.prog_name}: {Metadata.version}') + print(f'{Metadata.prog_nama}: {Version.version}') raise SystemExit() if self.args[0] == 'clean-logs': diff --git a/slpkg/metadata.py b/slpkg/metadata.py index 865c8f18..c469dae4 100644 --- a/slpkg/metadata.py +++ b/slpkg/metadata.py @@ -9,12 +9,13 @@ from dataclasses import dataclass @dataclass class Metadata: - # Project info + # Programme name prog_name: str = 'slpkg' ''' Default configurations. ''' # OS architecture by default os_arch: str = 'x86_64' + # All necessary paths tmp_path: str = '/tmp' tmp_slpkg: str = f'{tmp_path}/{prog_name}' @@ -24,8 +25,10 @@ class Metadata: db_path: str = f'/var/lib/{prog_name}/database' sbo_repo_path: str = f'/var/lib/{prog_name}/repository' log_packages: str = '/var/log/packages' + # Database name database: str = f'database.{prog_name}' + # Repository details repo_version: str = '15.0' sbo_url: str = f'http://slackbuilds.org/slackbuilds/{repo_version}' @@ -33,10 +36,12 @@ class Metadata: tar_suffix: str = '.tar.gz' pkg_suffix: str = '.tgz' repo_tag: str = '_SBo' + # Slackware commands installpkg: str = 'upgradepkg --install-new' reinstall: str = 'upgradepkg --reinstall' removepkg: str = 'removepkg' + # Other configs colors: str = 'on' wget_options = '-c -N' @@ -47,6 +52,7 @@ class Metadata: # OS architecture by default os_arch: str = config['os_arch'] + # All necessary paths tmp_path: str = config['tmp_path'] tmp_slpkg: str = config['tmp_slpkg'] @@ -56,8 +62,10 @@ class Metadata: 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'] + # Repository details repo_version: str = config['repo_version'] sbo_url: str = config['sbo_url'] @@ -65,10 +73,12 @@ class Metadata: tar_suffix: str = config['tar_suffix'] pkg_suffix: str = config['pkg_suffix'] repo_tag: str = config['repo_tag'] + # Slackware commands installpkg: str = config['installpkg'] reinstall: str = config['reinstall'] removepkg: str = config['removepkg'] + # Other configs colors: str = config['colors'] wget_options: str = config['wget_options'] diff --git a/slpkg/version.py b/slpkg/version.py new file mode 100644 index 00000000..d1471ae4 --- /dev/null +++ b/slpkg/version.py @@ -0,0 +1,13 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- + + +from dataclasses import dataclass + + +@dataclass +class Version: + version_info: tuple = (4, 1, 0) + version: str = '{0}.{1}.{2}'.format(*version_info) + license: str = 'MIT License' + author: str = 'dslackw'