Updated for gen sbo

This commit is contained in:
Dimitris Zlatanidis 2023-05-02 22:06:49 +03:00
parent 32dc5ccda3
commit b65dcb0ec5

View file

@ -634,21 +634,8 @@ class UpdateRepository(Configs):
self.utils.process(lftp_command)
gen_script: Path = Path(self.repos.ponce_repo_path, 'gen_sbo_txt.sh')
if not gen_script.is_file():
with open(gen_script, 'w') as file:
file.write(self.__class__.gen_sbo_script.__doc__)
os.chmod(gen_script, 0o775)
# Generating the ponce SLACKBUILDS.TXT file.
print(f'Generating the {self.repos.ponce_repo_slackbuilds} file... ', end='', flush=True)
os.chdir(self.repos.ponce_repo_path)
gen_command: str = f'./gen_sbo_txt.sh > {self.repos.ponce_repo_slackbuilds}'
self.utils.process(gen_command)
self.generate_the_slackbuilds_txt(self.repos.ponce_repo_path, self.repos.ponce_repo_slackbuilds)
self.delete_last_updated(self.repos.ponce_repo_name)
print('\n')
else:
if not self.option_for_install_data:
@ -730,7 +717,27 @@ class UpdateRepository(Configs):
self.session.query(LastRepoUpdated).where(LastRepoUpdated.repo == repo).delete()
self.session.commit()
def gen_sbo_script(self):
def generate_the_slackbuilds_txt(self, path: Path, slackbuilds_txt: str) -> None:
""" Generates the SLACKBUILDS.TXT file. """
sbo_txt: Path = Path(path, slackbuilds_txt)
gen_script: Path = Path(path, 'gen_sbo_txt.sh')
if not sbo_txt.is_file():
if not gen_script.is_file():
with open(gen_script, 'w') as file:
file.write(self.__class__.gen_sbo_script.__doc__)
os.chmod(gen_script, 0o775)
# Generating the SLACKBUILDS.TXT file.
print(f'Generating the {slackbuilds_txt} file... ', end='', flush=True)
os.chdir(path)
self.utils.process(f'./gen_sbo_txt.sh > {slackbuilds_txt}')
print(f'{self.byellow}Done{self.endc}\n')
def gen_sbo_script(self) -> None:
"""#!/bin/bash
# gen_sbo_txt.sh is a script to build a SLACKBUILDS.TXT file.