Merge branch 'develop'

This commit is contained in:
Dimitris Zlatanidis 2022-06-27 16:00:31 +03:00
commit dfeadc4c07
9 changed files with 27 additions and 39 deletions

View file

@ -1,3 +1,9 @@
4.1.3 - 26/06/2022
Bugfixed:
- /tmp permissions after installation
Updated:
- find installation binary file in /tmp folder
4.1.2 - 24/06/2022
Bugfixed:
- Installing noarch 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.1.2.tar.gz
$ cd slpkg-4.1.2
$ tar xvf slpkg-4.1.3.tar.gz
$ cd slpkg-4.1.3
$ ./install.sh

View file

@ -25,8 +25,7 @@ setup(
data_files=[('/etc/slpkg', ['configs/slpkg.yaml']),
('/etc/slpkg', ['configs/blacklist.yaml']),
('/var/lib/slpkg/database', []),
('/var/lib/slpkg/repository', []),
('/tmp/slpkg/build', [])],
('/var/lib/slpkg/repository', [])],
install_requires=install_requires,
classifiers=[
'Development Status :: 5 - Production/Stable',

View file

@ -48,6 +48,10 @@ class Configs:
colors: str = 'on'
wget_options = '-c -N'
# Creating the build path
if not os.path.isdir(build_path):
os.makedirs(build_path)
''' Overwrite with user configuration. '''
config_file: str = f'{etc_path}/{prog_name}.yaml'
if os.path.isfile(config_file):

View file

@ -105,7 +105,7 @@ class Slackbuilds:
sources = SBoQueries(sbo).sources()
self.download_sources(sbo, sources)
self.execute_the_script(self.build_path, sbo)
self.build_the_script(self.build_path, sbo)
if self.install:
@ -147,13 +147,18 @@ class Slackbuilds:
''' Creating a list with all the finished packages for
installation.
'''
build_tag, arch = self.utils.read_dot_slackbuild(self.build_path, name)
version = SBoQueries(name).version()
return (f'{name}-{version}-{arch}-{build_tag[0]}'
f'{self.repo_tag}{self.pkg_suffix}')
packages = []
pkg = f'{name}-{version}'
def execute_the_script(self, path: str, name: str):
for package in os.listdir(self.tmp_path):
if pkg in package:
packages.append(package)
return max(packages)
def build_the_script(self, path: str, name: str):
''' Run the .SlackBuild script. '''
folder = f'{path}/{name}/'
slackbuild = f'./{name}.SlackBuild'

View file

@ -3,7 +3,6 @@
import os
import re
import shutil
import tarfile
@ -15,28 +14,6 @@ from slpkg.configs import Configs
@dataclass
class Utilities:
log_packages: str = Configs.log_packages
os_arch: str = Configs.os_arch
def read_dot_slackbuild(self, path: str, name: str):
''' Opens the .SlackBuild file and reads the BUILD TAG and ARCH. '''
folder = f'{path}/{name}'
slackbuild = f'{name}.SlackBuild'
if os.path.isfile(f'{folder}/{slackbuild}'):
with open(f'{folder}/{slackbuild}', 'r', encoding='utf-8') as sbo:
lines = sbo.read().splitlines()
build_tag = arch = ''
for line in lines:
if line.startswith('BUILD'):
build_tag = re.findall(r'\d+', line)
if line.startswith('ARCH'):
arch = line.replace('ARCH=', '')
if not arch:
arch = self.os_arch
return build_tag, arch
def untar_archive(self, path: str, archive: str, ext_path: str):
''' Untar the file to the build folder. '''

View file

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

View file

@ -13,7 +13,7 @@ class TestConfigs(unittest.TestCase):
self.os_arch = Configs.os_arch
def test_repo_version(self):
self.assertEqual('15.0', self.repo_version)
self.assertEqual(15.0, self.repo_version)
def test_sbo_txt(self):
self.assertEqual('SLACKBUILDS.TXT', self.sbo_txt)

View file

@ -9,12 +9,9 @@ class TestUtilities(unittest.TestCase):
self.utils = Utilities()
self.build_path = Configs.build_path
def test_build_tag(self):
self.assertEqual(['2'], self.utils.build_tag(self.build_path,
'fish'))
def test_ins_installed(self):
self.assertEqual(True, self.utils.is_installed('fish-3.4.0'))
self.assertEqual('fish-3.4.0-x86_64-2_SBo', self.utils.is_installed(
'fish-3.4.0'))
if __name__ == '__main__':