Updated for ponce

This commit is contained in:
Dimitris Zlatanidis 2023-02-28 23:23:57 +02:00
parent 3b1d238dd4
commit a215c18474
4 changed files with 13 additions and 12 deletions

View file

@ -86,7 +86,7 @@
# include in the ponce repository. #
#########################################################################
PONCE_REPO = false
PONCE_REPO_URL = "https://cgit.ponce.cc/slackbuilds/plain"
PONCE_URL = "https://cgit.ponce.cc/slackbuilds/plain"
SLACK_CURRENT_MIRROR = "https://mirrors.slackware.com/slackware/slackware64-current"
SLACK_CHGLOG_TXT = "ChangeLog.txt"
SLACK_CHGLOG_PATH = "/var/lib/slpkg/repository/slack_current"

View file

@ -56,7 +56,7 @@ class Configs:
# Ponce repo configs.
ponce_repo: bool = False
ponce_repo_url: str = 'https://cgit.ponce.cc/slackbuilds/plain'
ponce_url: str = 'https://cgit.ponce.cc/slackbuilds/plain'
slack_current_mirror: str = 'https://mirrors.slackware.com/slackware/slackware64-current'
slack_chglog_txt: str = 'ChangeLog.txt'
slack_chglog_path: str = Path('/var/lib/slpkg/repository/slack_current')
@ -116,7 +116,7 @@ class Configs:
# Ponce repo configs.
ponce_repo: bool = config['PONCE_REPO']
ponce_repo_url: str = config['PONCE_REPO_URL']
ponce_url: str = config['PONCE_URL']
slack_current_mirror: str = config['SLACK_CURRENT_MIRROR']
slack_chglog_txt: str = config['SLACK_CHGLOG_TXT']
slack_chglog_path: str = config['SLACK_CHGLOG_PATH']

View file

@ -12,6 +12,7 @@ from slpkg.dialog_box import DialogBox
class FormConfigs(Configs):
def __init__(self):
super(Configs).__init__()
self.orig_configs = None
self.load_configs = LoadConfigs()
self.dialogbox = DialogBox()
@ -27,7 +28,7 @@ class FormConfigs(Configs):
configs = self.load_configs.file(self.etc_path, self.prog_name)
# Creating the elements for the dialog form.
for i, (key, value) in enumerate(configs['configs'].items(), start=1):
for i, (key, value) in enumerate(configs['CONFIGS'].items(), start=1):
if value is True:
value = 'true'
elif value is False:
@ -36,7 +37,7 @@ class FormConfigs(Configs):
(key, i, 1, value, i, 17, 47, 200, '0x0')
]
height = 28
height = 35
width = 70
text = f'Edit the configuration file: {config_file}'
title = ' Configuration File '
@ -62,13 +63,13 @@ class FormConfigs(Configs):
def check_configs(self, configs: dict, tags: list) -> bool:
""" Check for true of false values. """
for key, value in zip(configs['configs'].keys(), tags):
for key, value in zip(configs['CONFIGS'].keys(), tags):
if key in ['colors', 'dialog', 'silent_mode', 'ascii_characters'] and value not in ['true', 'false']:
if key in ['COLORS', 'DIALOG', 'SILENT_MODE', 'ASCII_CHARACTERS', 'PONCE_REPO'] and value not in ['true', 'false']:
self.dialogbox.msgbox(f"\nError value for {key}. It must be 'true' or 'false'\n", height=7, width=60)
return False
if key in ['downloader'] and value not in ['wget', 'curl']:
if key in ['DOWNLOADER'] and value not in ['wget', 'curl']:
self.dialogbox.msgbox(f"\nError value for {key}. It must be 'wget' or 'curl'\n", height=7, width=60)
return False
@ -84,9 +85,9 @@ class FormConfigs(Configs):
self.read_configs()
with open(self.config_file, 'w') as patch_toml:
for line in self.orig_configs:
for key, value in zip(configs['configs'].keys(), tags):
for key, value in zip(configs['CONFIGS'].keys(), tags):
if line.lstrip().startswith(key):
line = f' {key} = "{value}"\n'
if line.lstrip().startswith(('colors =', 'dialog =', 'silent_mode =', 'ascii_characters =')):
if line.lstrip().startswith(('COLORS =', 'DIALOG =', 'SILENT_MODE =', 'ASCII_CHARACTERS =', 'PONCE_REPO =')):
line = line.replace('"', '')
patch_toml.write(line)

View file

@ -139,9 +139,9 @@ class Slackbuilds(Configs):
location = SBoQueries(sbo).location()
sbo_url = f'{self.sbo_repo_url}/{location}/{file}'
ponce_url = f'{self.ponce_repo_url}/{location}/{sbo}'
ponce_url = f'{self.ponce_url}/{location}/{sbo}'
if self.ponce_repo and self.ponce_repo_url:
if self.ponce_repo and self.ponce_url:
path = Path(self.build_path, sbo)
lftp = Downloader(path, ponce_url, self.flags)
lftp.download()