mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-02-07 08:46:21 +01:00
Updated for install data
This commit is contained in:
parent
a375d07cc7
commit
fad68f7ae4
3 changed files with 78 additions and 53 deletions
|
@ -27,7 +27,7 @@ class InstallData(Configs):
|
|||
if line.startswith(days):
|
||||
return line.replace('\n', '')
|
||||
|
||||
def install_sbos_data(self) -> None:
|
||||
def install_sbo_data(self) -> None:
|
||||
""" Install the data for SBo repository. """
|
||||
sbo_tags = [
|
||||
'SLACKBUILD NAME:',
|
||||
|
@ -41,22 +41,15 @@ class InstallData(Configs):
|
|||
'SLACKBUILD REQUIRES:',
|
||||
'SLACKBUILD SHORT DESCRIPTION:'
|
||||
]
|
||||
sbo_table = SBoTable
|
||||
sbo_name: str = self.repos.sbo_repo_name
|
||||
|
||||
path_slackbuilds: Path = Path(self.repos.sbo_repo_path, self.repos.sbo_repo_slackbuilds)
|
||||
path_changelog: Path = Path(self.repos.sbo_repo_path, self.repos.sbo_repo_changelog)
|
||||
|
||||
if self.repos.ponce_repo:
|
||||
sbo_table = PonceTable
|
||||
sbo_name: str = self.repos.ponce_repo_name
|
||||
path_slackbuilds = Path(self.repos.ponce_repo_path, self.repos.ponce_repo_slackbuilds)
|
||||
path_changelog: Path = Path(self.repos.ponce_repo_path, self.repos.ponce_repo_changelog)
|
||||
|
||||
slackbuilds_txt: list = self.utils.read_file(path_slackbuilds)
|
||||
|
||||
cache: list = [] # init cache
|
||||
|
||||
print(f"Updating the database for '{self.cyan}{sbo_name}{self.endc}'... ", end='', flush=True)
|
||||
print(f"Updating the database for '{self.cyan}{self.repos.sbo_repo_name}{self.endc}'... ", end='', flush=True)
|
||||
|
||||
for i, line in enumerate(slackbuilds_txt, 1):
|
||||
|
||||
|
@ -66,20 +59,69 @@ class InstallData(Configs):
|
|||
cache.append(line)
|
||||
|
||||
if (i % 11) == 0:
|
||||
data: str = sbo_table(name=cache[0], location=cache[1].split('/')[1],
|
||||
files=cache[2], version=cache[3],
|
||||
download=cache[4], download64=cache[5],
|
||||
md5sum=cache[6], md5sum64=cache[7],
|
||||
requires=cache[8], short_description=cache[9])
|
||||
data: str = SBoTable(name=cache[0], location=cache[1].split('/')[1],
|
||||
files=cache[2], version=cache[3],
|
||||
download=cache[4], download64=cache[5],
|
||||
md5sum=cache[6], md5sum64=cache[7],
|
||||
requires=cache[8], short_description=cache[9])
|
||||
self.session.add(data)
|
||||
|
||||
cache: list = [] # reset cache after 11 lines
|
||||
|
||||
last_updated: str = self.last_updated(path_changelog)
|
||||
date: str = LastRepoUpdated(repo=sbo_name, date=last_updated)
|
||||
date: str = LastRepoUpdated(repo=self.repos.sbo_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
print(f'{self.byellow}Done{self.endc}\n')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
def install_ponce_data(self) -> None:
|
||||
""" Install the data for SBo repository. """
|
||||
sbo_tags = [
|
||||
'SLACKBUILD NAME:',
|
||||
'SLACKBUILD LOCATION:',
|
||||
'SLACKBUILD FILES:',
|
||||
'SLACKBUILD VERSION:',
|
||||
'SLACKBUILD DOWNLOAD:',
|
||||
'SLACKBUILD DOWNLOAD_x86_64:',
|
||||
'SLACKBUILD MD5SUM:',
|
||||
'SLACKBUILD MD5SUM_x86_64:',
|
||||
'SLACKBUILD REQUIRES:',
|
||||
'SLACKBUILD SHORT DESCRIPTION:'
|
||||
]
|
||||
|
||||
path_slackbuilds = Path(self.repos.ponce_repo_path, self.repos.ponce_repo_slackbuilds)
|
||||
path_changelog: Path = Path(self.repos.ponce_repo_path, self.repos.ponce_repo_changelog)
|
||||
|
||||
slackbuilds_txt: list = self.utils.read_file(path_slackbuilds)
|
||||
|
||||
cache: list = [] # init cache
|
||||
|
||||
print(f"Updating the database for '{self.cyan}{self.repos.ponce_repo_name}{self.endc}'... ", end='', flush=True)
|
||||
|
||||
for i, line in enumerate(slackbuilds_txt, 1):
|
||||
|
||||
for tag in sbo_tags:
|
||||
if line.startswith(tag):
|
||||
line = line.replace(tag, '').strip()
|
||||
cache.append(line)
|
||||
|
||||
if (i % 11) == 0:
|
||||
data: str = PonceTable(name=cache[0], location=cache[1].split('/')[1],
|
||||
files=cache[2], version=cache[3],
|
||||
download=cache[4], download64=cache[5],
|
||||
md5sum=cache[6], md5sum64=cache[7],
|
||||
requires=cache[8], short_description=cache[9])
|
||||
self.session.add(data)
|
||||
|
||||
cache: list = [] # reset cache after 11 lines
|
||||
|
||||
last_updated: str = self.last_updated(path_changelog)
|
||||
date: str = LastRepoUpdated(repo=self.repos.ponce_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}\n')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
|
@ -171,7 +213,7 @@ class InstallData(Configs):
|
|||
date: str = LastRepoUpdated(repo=self.repos.slack_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
print(f'{self.byellow}Done{self.endc}\n')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
|
@ -263,7 +305,7 @@ class InstallData(Configs):
|
|||
date: str = LastRepoUpdated(repo=self.repos.slack_extra_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
print(f'{self.byellow}Done{self.endc}\n')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
|
@ -355,7 +397,7 @@ class InstallData(Configs):
|
|||
date: str = LastRepoUpdated(repo=self.repos.slack_patches_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
print(f'{self.byellow}Done{self.endc}\n')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
|
@ -453,7 +495,7 @@ class InstallData(Configs):
|
|||
date: str = LastRepoUpdated(repo=self.repos.alien_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
print(f'{self.byellow}Done{self.endc}\n')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
|
@ -545,7 +587,7 @@ class InstallData(Configs):
|
|||
date: str = LastRepoUpdated(repo=self.repos.multilib_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
print(f'{self.byellow}Done{self.endc}\n')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
|
@ -637,7 +679,7 @@ class InstallData(Configs):
|
|||
date: str = LastRepoUpdated(repo=self.repos.restricted_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
print(f'{self.byellow}Done{self.endc}\n')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
|
@ -730,7 +772,7 @@ class InstallData(Configs):
|
|||
date: str = LastRepoUpdated(repo=self.repos.gnome_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
print(f'{self.byellow}Done{self.endc}\n')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
|
@ -822,7 +864,7 @@ class InstallData(Configs):
|
|||
date: str = LastRepoUpdated(repo=self.repos.msb_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
print(f'{self.byellow}Done{self.endc}\n')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
|
@ -914,7 +956,7 @@ class InstallData(Configs):
|
|||
date: str = LastRepoUpdated(repo=self.repos.csb_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
print(f'{self.byellow}Done{self.endc}\n')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
|
@ -1007,7 +1049,7 @@ class InstallData(Configs):
|
|||
date: str = LastRepoUpdated(repo=self.repos.conraid_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
print(f'{self.byellow}Done{self.endc}\n')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
|
@ -1105,7 +1147,7 @@ class InstallData(Configs):
|
|||
date: str = LastRepoUpdated(repo=self.repos.slackonly_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
print(f'{self.byellow}Done{self.endc}\n')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
|
@ -1211,7 +1253,7 @@ class InstallData(Configs):
|
|||
date: str = LastRepoUpdated(repo=self.repos.salixos_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
print(f'{self.byellow}Done{self.endc}\n')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
|
@ -1318,7 +1360,7 @@ class InstallData(Configs):
|
|||
date: str = LastRepoUpdated(repo=self.repos.salixos_extra_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
print(f'{self.byellow}Done{self.endc}\n')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
|
@ -1425,7 +1467,7 @@ class InstallData(Configs):
|
|||
date: str = LastRepoUpdated(repo=self.repos.salixos_patches_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
print(f'{self.byellow}Done{self.endc}\n')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
|
@ -1531,7 +1573,7 @@ class InstallData(Configs):
|
|||
date: str = LastRepoUpdated(repo=self.repos.slackel_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
print(f'{self.byellow}Done{self.endc}\n')
|
||||
|
||||
self.session.commit()
|
||||
|
||||
|
@ -1637,6 +1679,6 @@ class InstallData(Configs):
|
|||
date: str = LastRepoUpdated(repo=self.repos.slint_repo_name, date=last_updated)
|
||||
self.session.add(date)
|
||||
|
||||
print(f'{self.byellow}Done{self.endc}')
|
||||
print(f'{self.byellow}Done{self.endc}\n')
|
||||
|
||||
self.session.commit()
|
||||
|
|
|
@ -21,8 +21,8 @@ class SBoQueries(Configs):
|
|||
table: dict = {
|
||||
self.repos.sbo_repo_name: SBoTable,
|
||||
self.repos.ponce_repo_name: PonceTable,
|
||||
|
||||
}
|
||||
|
||||
if repository == '*':
|
||||
repository = self.repos.default_repository
|
||||
|
||||
|
|
|
@ -114,7 +114,6 @@ class UpdateRepository(Configs):
|
|||
self.delete_bin_database_data(self.repos.slack_repo_name)
|
||||
self.delete_last_updated(self.repos.slack_repo_name)
|
||||
self.data.install_slack_data()
|
||||
print()
|
||||
|
||||
def slack_extra_repository(self):
|
||||
if not self.option_for_install_data:
|
||||
|
@ -148,7 +147,6 @@ class UpdateRepository(Configs):
|
|||
self.delete_bin_database_data(self.repos.slack_extra_repo_name)
|
||||
self.delete_last_updated(self.repos.slack_extra_repo_name)
|
||||
self.data.install_slack_extra_data()
|
||||
print()
|
||||
|
||||
def slack_patches_repository(self):
|
||||
if not self.option_for_install_data:
|
||||
|
@ -184,7 +182,6 @@ class UpdateRepository(Configs):
|
|||
self.delete_bin_database_data(self.repos.slack_patches_repo_name)
|
||||
self.delete_last_updated(self.repos.slack_patches_repo_name)
|
||||
self.data.install_slack_patches_data()
|
||||
print()
|
||||
|
||||
def alien_repository(self):
|
||||
if not self.option_for_install_data:
|
||||
|
@ -217,7 +214,6 @@ class UpdateRepository(Configs):
|
|||
self.delete_bin_database_data(self.repos.alien_repo_name)
|
||||
self.delete_last_updated(self.repos.alien_repo_name)
|
||||
self.data.install_alien_data()
|
||||
print()
|
||||
|
||||
def multilib_repository(self) -> None:
|
||||
if not self.option_for_install_data:
|
||||
|
@ -250,7 +246,6 @@ class UpdateRepository(Configs):
|
|||
self.delete_bin_database_data(self.repos.multilib_repo_name)
|
||||
self.delete_last_updated(self.repos.multilib_repo_name)
|
||||
self.data.install_multilib_data()
|
||||
print()
|
||||
|
||||
def restricted_repository(self) -> None:
|
||||
if not self.option_for_install_data:
|
||||
|
@ -283,7 +278,6 @@ class UpdateRepository(Configs):
|
|||
self.delete_bin_database_data(self.repos.restricted_repo_name)
|
||||
self.delete_last_updated(self.repos.restricted_repo_name)
|
||||
self.data.install_restricted_data()
|
||||
print()
|
||||
|
||||
def gnome_repository(self) -> None:
|
||||
if not self.option_for_install_data:
|
||||
|
@ -315,7 +309,6 @@ class UpdateRepository(Configs):
|
|||
self.delete_bin_database_data(self.repos.gnome_repo_name)
|
||||
self.delete_last_updated(self.repos.gnome_repo_name)
|
||||
self.data.install_gnome_data()
|
||||
print()
|
||||
|
||||
def msb_repository(self) -> None:
|
||||
if not self.option_for_install_data:
|
||||
|
@ -348,7 +341,6 @@ class UpdateRepository(Configs):
|
|||
self.delete_bin_database_data(self.repos.msb_repo_name)
|
||||
self.delete_last_updated(self.repos.msb_repo_name)
|
||||
self.data.install_msb_data()
|
||||
print()
|
||||
|
||||
def csb_repository(self) -> None:
|
||||
if not self.option_for_install_data:
|
||||
|
@ -380,7 +372,6 @@ class UpdateRepository(Configs):
|
|||
self.delete_bin_database_data(self.repos.csb_repo_name)
|
||||
self.delete_last_updated(self.repos.csb_repo_name)
|
||||
self.data.install_csb_data()
|
||||
print()
|
||||
|
||||
def conraid_repository(self) -> None:
|
||||
if not self.option_for_install_data:
|
||||
|
@ -412,7 +403,6 @@ class UpdateRepository(Configs):
|
|||
self.delete_bin_database_data(self.repos.conraid_repo_name)
|
||||
self.delete_last_updated(self.repos.conraid_repo_name)
|
||||
self.data.install_conraid_data()
|
||||
print()
|
||||
|
||||
def slackonly_repository(self) -> None:
|
||||
if not self.option_for_install_data:
|
||||
|
@ -444,7 +434,6 @@ class UpdateRepository(Configs):
|
|||
self.delete_bin_database_data(self.repos.slackonly_repo_name)
|
||||
self.delete_last_updated(self.repos.slackonly_repo_name)
|
||||
self.data.install_slackonly_data()
|
||||
print()
|
||||
|
||||
def salixos_repository(self) -> None:
|
||||
if not self.option_for_install_data:
|
||||
|
@ -476,7 +465,6 @@ class UpdateRepository(Configs):
|
|||
self.delete_bin_database_data(self.repos.salixos_repo_name)
|
||||
self.delete_last_updated(self.repos.salixos_repo_name)
|
||||
self.data.install_salixos_data()
|
||||
print()
|
||||
|
||||
def salixos_extra_repository(self) -> None:
|
||||
if not self.option_for_install_data:
|
||||
|
@ -507,12 +495,10 @@ class UpdateRepository(Configs):
|
|||
|
||||
down = Downloader(self.repos.salixos_extra_repo_path, urls, self.flags)
|
||||
down.download()
|
||||
print()
|
||||
|
||||
self.delete_bin_database_data(self.repos.salixos_extra_repo_name)
|
||||
self.delete_last_updated(self.repos.salixos_extra_repo_name)
|
||||
self.data.install_salixos_extra_data()
|
||||
print()
|
||||
|
||||
def salixos_patches_repository(self) -> None:
|
||||
if not self.option_for_install_data:
|
||||
|
@ -550,7 +536,6 @@ class UpdateRepository(Configs):
|
|||
self.delete_bin_database_data(self.repos.salixos_patches_repo_name)
|
||||
self.delete_last_updated(self.repos.salixos_patches_repo_name)
|
||||
self.data.install_salixos_patches_data()
|
||||
print()
|
||||
|
||||
def slackel_repository(self) -> None:
|
||||
if not self.option_for_install_data:
|
||||
|
@ -582,7 +567,6 @@ class UpdateRepository(Configs):
|
|||
self.delete_bin_database_data(self.repos.slackel_repo_name)
|
||||
self.delete_last_updated(self.repos.slackel_repo_name)
|
||||
self.data.install_slackel_data()
|
||||
print()
|
||||
|
||||
def slint_repository(self) -> None:
|
||||
if not self.option_for_install_data:
|
||||
|
@ -614,7 +598,6 @@ class UpdateRepository(Configs):
|
|||
self.delete_bin_database_data(self.repos.slint_repo_name)
|
||||
self.delete_last_updated(self.repos.slint_repo_name)
|
||||
self.data.install_slint_data()
|
||||
print()
|
||||
|
||||
def ponce_repository(self) -> None:
|
||||
""" Update the slackbuild repositories. """
|
||||
|
@ -636,7 +619,7 @@ class UpdateRepository(Configs):
|
|||
|
||||
self.delete_last_updated(self.repos.ponce_repo_name)
|
||||
self.delete_sbo_database_data()
|
||||
self.data.install_sbos_data()
|
||||
self.data.install_ponce_data()
|
||||
|
||||
def sbo_repository(self) -> None:
|
||||
if not self.option_for_install_data:
|
||||
|
@ -659,7 +642,7 @@ class UpdateRepository(Configs):
|
|||
|
||||
self.delete_last_updated(self.repos.sbo_repo_name)
|
||||
self.delete_sbo_database_data()
|
||||
self.data.install_sbos_data()
|
||||
self.data.install_sbo_data()
|
||||
|
||||
def generate_sbo(self, path: Path, sbo_txt: str) -> None:
|
||||
""" Creates the SLACKBUILDS.TXT file. """
|
||||
|
|
Loading…
Add table
Reference in a new issue