Added new option

This commit is contained in:
Dimitris Zlatanidis 2023-03-05 17:08:43 +02:00
parent a9c3c368cc
commit 9cdd26dd49
5 changed files with 37 additions and 13 deletions

View file

@ -1,3 +1,10 @@
4.5.6 - 02/03/2023
Updated:
- Ponce repository
- slpkg.toml file for ponce repository
Added:
- New option --generate-only for ponce repository
4.5.5 - 02/03/2023
Fixed:
- Genarator type to list return

View file

@ -152,6 +152,12 @@ Disable silent mode if it is enabled in the configuration file. (to be used with
Print the repository package version. (to be used with: -e, dependees, -t, tracking, -w, view)
.RE
.P
.B -G, --generate-only
.RS
It is used only with the ponce repository and when you want to generate only the SLACKBUILDS.TXT
without downloading the whole repository. (to be used with: -u, update)
.RE
.P
.BI "-z," "" " \-\-directory=[" PATH "]
.RS
The directory is the path where the files will be saved. (to be used with: -d, download)

View file

@ -63,6 +63,8 @@ class Argparse(Configs):
self.flag_short_no_silent: str = '-n'
self.flag_pkg_version: str = '--pkg-version'
self.flag_short_pkg_version: str = '-p'
self.flag_generate: str = '--generate-only'
self.flag_short_generate: str = '-G'
self.flag_directory: str = '--directory='
self.flag_short_directory: str = '-z='
self.flag_file_pattern: str = '--file-pattern='
@ -89,10 +91,12 @@ class Argparse(Configs):
self.flag_short_search,
self.flag_no_silent,
self.flag_short_no_silent,
self.flag_directory,
self.flag_short_directory,
self.flag_pkg_version,
self.flag_short_pkg_version,
self.flag_generate,
self.flag_short_generate,
self.flag_directory,
self.flag_short_directory,
self.flag_file_pattern,
self.flag_short_file_pattern
]
@ -105,7 +109,9 @@ class Argparse(Configs):
self.flag_yes,
self.flag_short_yes,
self.flag_no_silent,
self.flag_short_no_silent
self.flag_short_no_silent,
self.flag_generate,
self.flag_short_generate
],
'upgrade': [
self.flag_yes,

View file

@ -8,6 +8,7 @@ from pathlib import Path
from multiprocessing import Process
from slpkg.configs import Configs
from slpkg.utilities import Utilities
from slpkg.downloader import Downloader
from slpkg.create_data import CreateData
from slpkg.models.models import SBoTable
@ -17,11 +18,13 @@ from slpkg.check_updates import CheckUpdates
from slpkg.models.models import session as Session
class UpdateRepository(Configs):
class UpdateRepository(Configs, Utilities):
""" Deletes and install the data. """
def __init__(self, flags: list):
super(Configs, self).__init__()
super(Utilities, self).__init__()
self.flags: list = flags
self.session = Session
@ -29,6 +32,7 @@ class UpdateRepository(Configs):
self.color = self.colour()
self.endc: str = self.color['endc']
self.flag_generate: list = ['-G', '--generate-only']
def sbo(self) -> None:
""" Updated the sbo repository. """
@ -36,18 +40,16 @@ class UpdateRepository(Configs):
view.question()
print('Updating the package list.\n')
if self.ponce_repo:
print("Downloading the 'ponce' repository, please wait...\n")
subprocess.call(f'lftp {self.lftp_mirror_options} {self.ponce_repo_url} {self.ponce_repo_path}',
shell=True)
print(f'Generating the {self.ponce_txt} file... ', end='', flush=True)
print('\n')
if not self.is_option(self.flag_generate, self.flags):
print('Updating the package list.\n')
print("Downloading the 'ponce' repository, please wait...\n")
subprocess.call(f'lftp {self.lftp_mirror_options} {self.ponce_repo_url} {self.ponce_repo_path}',
shell=True)
# Generating the SLACKBUILDS.TXT file.
print(f'Generating the {self.ponce_txt} file... ', end='', flush=True)
os.chdir(self.ponce_repo_path)
subprocess.call(f'./gen_sbo_txt.sh > {self.ponce_txt}', shell=True)
@ -57,6 +59,7 @@ class UpdateRepository(Configs):
self.delete_sbo_data()
else:
print('Updating the package list.\n')
self.delete_file(self.sbo_repo_path, self.sbo_txt)
self.delete_file(self.sbo_repo_path, self.sbo_chglog_txt)
@ -71,6 +74,7 @@ class UpdateRepository(Configs):
down_sbo_changelog = Downloader(self.sbo_repo_path, changelog_txt, self.flags)
down_sbo_changelog.download()
print()
data = CreateData()
data.insert_sbo_table()

View file

@ -28,7 +28,7 @@ class Usage(Configs):
f' slpkg [{self.cyan}COMMAND{self.endc}] [-e, dependees, -t, tracking] [packages...]\n'
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-y, --yes, -j, --jobs, -o, --resolve-off, -r, --reinstall]\n'
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-k, --skip-installed, -E, --full-reverse, -S, --search]\n'
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-n, --no-silent, -p, --pkg-version]\n'
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-n, --no-silent, -p, --pkg-version, -G, --generate-only]\n'
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-z, --directory=[PATH], -F, --file-pattern=[PATTERN]]\n'
" \nIf you need more information please try 'slpkg --help'.")
@ -67,6 +67,7 @@ class Usage(Configs):
f' {self.yellow}-S, --search{self.endc} Search packages from the repository.\n'
f' {self.yellow}-n, --no-silent{self.endc} Disable silent mode.\n'
f' {self.yellow}-p, --pkg-version{self.endc} Print the repository package version.\n'
f' {self.yellow}-G, --generate-only{self.endc} Generates only the SLACKBUILDS.TXT file.\n'
f' {self.yellow}-z, --directory={self.endc}[PATH] Download files to a specific path.\n'
f' {self.yellow}-F, --file-pattern={self.endc}[PATTERN] Include specific installed files.\n'
'\n -h, --help Show this message and exit.\n'