Merge branch 'develop'

This commit is contained in:
Dimitris Zlatanidis 2023-03-02 20:38:04 +02:00
commit 8f1b281a31
9 changed files with 45 additions and 34 deletions

View file

@ -31,8 +31,8 @@ Install from the official third-party `SBo repository <https://slackbuilds.org/r
.. code-block:: bash .. code-block:: bash
$ tar xvf slpkg-4.5.3.tar.gz $ tar xvf slpkg-4.5.4.tar.gz
$ cd slpkg-4.5.3 $ cd slpkg-4.5.4
$ ./install.sh $ ./install.sh
Screenshots Screenshots
@ -54,7 +54,7 @@ Usage
.. code-block:: bash .. code-block:: bash
$ slpkg --help $ slpkg --help
USAGE: slpkg [OPTIONS] [COMMAND] <packages> USAGE: slpkg [OPTIONS] [COMMAND] [packages...]
DESCRIPTION: DESCRIPTION:
Package manager utility for Slackware. Package manager utility for Slackware.
@ -66,15 +66,15 @@ Usage
-g, configs Edit the configuration file. -g, configs Edit the configuration file.
-L, clean-logs Clean dependencies log tracking. -L, clean-logs Clean dependencies log tracking.
-D, clean-tmp Deletes all the downloaded sources. -D, clean-tmp Deletes all the downloaded sources.
-b, build <packages> Build only the packages. -b, build [packages...] Build only the packages.
-i, install <packages> Build and install the packages. -i, install [packages...] Build and install the packages.
-d, download <packages> Download only the scripts and sources. -d, download [packages...] Download only the scripts and sources.
-R, remove <packages> Remove installed packages. -R, remove [packages...] Remove installed packages.
-f, find <packages> Find installed packages. -f, find [packages...] Find installed packages.
-w, view <packages> View packages from the repository. -w, view [packages...] View packages from the repository.
-s, search <packages> Search packages from the repository. -s, search [packages...] Search packages from the repository.
-e, dependees <packages> Show which packages depend. -e, dependees [packages...] Show which packages depend.
-t, tracking <packages> Tracking the packages dependencies. -t, tracking [packages...] Tracking the packages dependencies.
OPTIONS: OPTIONS:
-y, --yes Answer Yes to all questions. -y, --yes Answer Yes to all questions.
@ -93,7 +93,7 @@ Usage
-v, --version Print version and exit. -v, --version Print version and exit.
If you need more information try to use slpkg manpage. If you need more information try to use slpkg manpage.
Extra help for the commands, use: 'slpkg help <command>'. Extra help for the commands, use: 'slpkg help [command]'.
Edit the config file in the /etc/slpkg/slpkg.toml or 'slpkg configs'. Edit the config file in the /etc/slpkg/slpkg.toml or 'slpkg configs'.
@ -109,6 +109,16 @@ Configuration files
/etc/slpkg/blacklist.toml /etc/slpkg/blacklist.toml
Blacklist of packages Blacklist of packages
Repositories
------------
Two repositories are supported, please read the config file.
- `slackbuilds.org <https://slackbuilds.org>`_ repository
- `ponce <https://cgit.ponce.cc/slackbuilds/>`_ repository
Donate Donate
------ ------

View file

@ -42,7 +42,12 @@ class Downloader(Configs, Utilities):
self.flag_no_silent: list = ['-n', '--no-silent'] self.flag_no_silent: list = ['-n', '--no-silent']
def transfer_tools(self) -> NoReturn: def transfer_tools(self) -> NoReturn:
""" Wget downloader. """ """ Downloader tools.
wget, curl and lftp works with SBo repository.
lftp works with the ponce repository only.
"""
if self.downloader == 'wget': if self.downloader == 'wget':
self.output = subprocess.call(f'{self.downloader} {self.wget_options} --directory-prefix={self.path} ' self.output = subprocess.call(f'{self.downloader} {self.wget_options} --directory-prefix={self.path} '
f'"{self.url}"', shell=True, stderr=self.stderr, stdout=self.stdout) f'"{self.url}"', shell=True, stderr=self.stderr, stdout=self.stdout)
@ -54,7 +59,7 @@ class Downloader(Configs, Utilities):
if self.ponce_repo and 'ponce' in self.url: if self.ponce_repo and 'ponce' in self.url:
# Download files from a directory. # Download files from a directory.
self.output = subprocess.call(f"lftp {self.lftp_mirror_options} {self.url} {self.path}", self.output = subprocess.call(f'lftp {self.lftp_mirror_options} {self.url} {self.path}',
shell=True, stderr=self.stderr, stdout=self.stdout) shell=True, stderr=self.stderr, stdout=self.stdout)
# Create /path/name.Slackbuild # Create /path/name.Slackbuild
slackbuild = Path(self.path, f'{str(self.path).split("/")[-1]}.SlackBuild') slackbuild = Path(self.path, f'{str(self.path).split("/")[-1]}.SlackBuild')
@ -63,7 +68,7 @@ class Downloader(Configs, Utilities):
os.chmod(slackbuild, 0o775) os.chmod(slackbuild, 0o775)
else: else:
# Download binaries files and the sources. # Download binaries files and the sources.
self.output = subprocess.call(f"lftp {self.lftp_get_options} {self.url} -o {self.path}", self.output = subprocess.call(f'lftp {self.lftp_get_options} {self.url} -o {self.path}',
shell=True, stderr=self.stderr, stdout=self.stdout) shell=True, stderr=self.stderr, stdout=self.stdout)
else: else:
@ -118,9 +123,6 @@ class Downloader(Configs, Utilities):
# Restore the terminal cursor # Restore the terminal cursor
print('\x1b[?25h', self.endc) print('\x1b[?25h', self.endc)
else: else:
# if self.ponce_repo and 'ponce' in self.url:
# self.lftp()
# else:
self.transfer_tools() self.transfer_tools()
self.check_if_downloaded() self.check_if_downloaded()

View file

@ -257,6 +257,7 @@ class Slackbuilds(Configs):
if self.utils.is_option(self.flag_jobs, self.flags): if self.utils.is_option(self.flag_jobs, self.flags):
self.set_makeflags() self.set_makeflags()
name = f'{name}.SlackBuild'
message: str = f'{self.red}Build{self.endc}' message: str = f'{self.red}Build{self.endc}'
self.process_message: str = f"package '{name}' to build" self.process_message: str = f"package '{name}' to build"

View file

@ -33,7 +33,8 @@ class UpdateRepository(Configs):
view.question() view.question()
print('Updating the package list...\n') print('Updating the package list.\n')
print('Downloading some necessary files, please wait...\n')
self.delete_file(self.sbo_repo_path, self.sbo_txt) self.delete_file(self.sbo_repo_path, self.sbo_txt)
self.delete_file(self.sbo_repo_path, self.sbo_chglog_txt) self.delete_file(self.sbo_repo_path, self.sbo_chglog_txt)
self.delete_file(self.slack_chglog_path, self.slack_chglog_txt) self.delete_file(self.slack_chglog_path, self.slack_chglog_txt)

View file

@ -72,7 +72,7 @@ class Usage(Configs):
'\n -h, --help Show this message and exit.\n' '\n -h, --help Show this message and exit.\n'
' -v, --version Print version and exit.\n' ' -v, --version Print version and exit.\n'
"\nIf you need more information try to use slpkg manpage.\n" "\nIf you need more information try to use slpkg manpage.\n"
"Extra help for the commands, use: 'slpkg help <command>'.\n" "Extra help for the commands, use: 'slpkg help [command]'.\n"
"Edit the config file in the /etc/slpkg/slpkg.toml or 'slpkg configs'.") "Edit the config file in the /etc/slpkg/slpkg.toml or 'slpkg configs'.")
print(args) print(args)

View file

@ -60,10 +60,7 @@ class Help(Configs):
help_commands['-e']: dict = help_commands['dependees'] help_commands['-e']: dict = help_commands['dependees']
help_commands['-t']: dict = help_commands['tracking'] help_commands['-t']: dict = help_commands['tracking']
print(f'Usage: {self.prog_name} [{self.yellow}OPTIONS{self.endc}] ' print(f'\n{self.bold}{self.green}Help: {self.endc}{help_commands[self.command]}\n')
f'[{self.cyan}COMMAND{self.endc}] [PACKAGES...]')
print(f"Try 'slpkg --help' for help.\n")
print(f'{self.bold}{self.green}Help: {self.endc}{help_commands[self.command]}\n')
print(f"{self.bold}COMMAND{self.endc}: {self.cyan}{self.command}{self.endc}") print(f"{self.bold}COMMAND{self.endc}: {self.cyan}{self.command}{self.endc}")
print(f"{self.bold}OPTIONS:{self.endc} {self.yellow}{', '.join(self.flags)}{self.endc}\n") print(f"{self.bold}OPTIONS:{self.endc} {self.yellow}{', '.join(self.flags)}{self.endc}\n")
print('If you need more information try to use slpkg manpage.') print('If you need more information try to use slpkg manpage.\n')

View file

@ -34,7 +34,7 @@ class ViewMessage(Configs):
self.grey: str = self.color['grey'] self.grey: str = self.color['grey']
self.violet: str = self.color['violet'] self.violet: str = self.color['violet']
self.endc: str = self.color['endc'] self.endc: str = self.color['endc']
self.download_only = None self.download_only = self.tmp_slpkg
self.installed_packages: list = [] self.installed_packages: list = []
self.flag_resolve_off: list = ['-o', '--resolve-off'] self.flag_resolve_off: list = ['-o', '--resolve-off']
self.flag_reinstall: list = ['-r', '--reinstall'] self.flag_reinstall: list = ['-r', '--reinstall']

View file

@ -15,16 +15,16 @@ class TestSBoQueries(unittest.TestCase):
def test_sources(self): def test_sources(self):
self.assertEqual(['https://gitlab.com/dslackw/slpkg/-/archive' self.assertEqual(['https://gitlab.com/dslackw/slpkg/-/archive'
'/4.3.7/slpkg-4.3.7.tar.gz'], self.query.sources()) '/4.5.3/slpkg-4.5.3.tar.gz'], self.query.sources())
def test_requires(self): def test_requires(self):
self.assertEqual(['SQLAlchemy', 'python-toml'], self.query.requires()) self.assertEqual(['SQLAlchemy', 'python3-pythondialog', 'python3-progress'], self.query.requires())
def test_version(self): def test_version(self):
self.assertEqual('4.3.7', self.query.version()) self.assertEqual('4.5.3', self.query.version())
def test_checksum(self): def test_checksum(self):
self.assertListEqual(['5a55fd350004b3e49a060835a7ada3e9'], self.assertListEqual(['d76c95208a4c1cc2d6121417885eb8a8'],
self.query.checksum()) self.query.checksum())
def test_files(self): def test_files(self):

View file

@ -10,7 +10,7 @@ class TestUtilities(unittest.TestCase):
self.configs = Configs() self.configs = Configs()
self.file_pattern = f'*{self.configs.sbo_repo_tag}' self.file_pattern = f'*{self.configs.sbo_repo_tag}'
self.build_path = Configs.build_path self.build_path = Configs.build_path
self.package = 'fish-3.4.0-x86_64-2_SBo' self.package = 'fish-3.6.0-x86_64-1_SBo'
def test_ins_installed(self): def test_ins_installed(self):
self.assertEqual(self.package, self.utils.is_installed('fish', self.file_pattern)) self.assertEqual(self.package, self.utils.is_installed('fish', self.file_pattern))
@ -19,13 +19,13 @@ class TestUtilities(unittest.TestCase):
self.assertEqual('fish', self.utils.split_installed_pkg(self.package)[0]) self.assertEqual('fish', self.utils.split_installed_pkg(self.package)[0])
def test_split_version(self): def test_split_version(self):
self.assertEqual('3.4.0', self.utils.split_installed_pkg(self.package)[1]) self.assertEqual('3.6.0', self.utils.split_installed_pkg(self.package)[1])
def test_split_arch(self): def test_split_arch(self):
self.assertEqual('x86_64', self.utils.split_installed_pkg(self.package)[2]) self.assertEqual('x86_64', self.utils.split_installed_pkg(self.package)[2])
def test_split_build(self): def test_split_build(self):
self.assertEqual('2', self.utils.split_installed_pkg(self.package)[3]) self.assertEqual('1', self.utils.split_installed_pkg(self.package)[3])
def test_split_tag(self): def test_split_tag(self):
self.assertEqual('SBo', self.utils.split_installed_pkg(self.package)[4]) self.assertEqual('SBo', self.utils.split_installed_pkg(self.package)[4])