mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-29 20:34:22 +01:00
Updated for check db
This commit is contained in:
parent
c07098648d
commit
06eedf1b80
1 changed files with 13 additions and 5 deletions
|
@ -69,18 +69,26 @@ class Check(Configs):
|
|||
|
||||
def is_empty_database(self) -> None:
|
||||
""" Checking for empty table and database file. """
|
||||
count: int = 0
|
||||
sbo_table: dict = {
|
||||
self.repos.sbo_repo_name: SBoTable,
|
||||
self.repos.ponce_repo_name: PonceTable
|
||||
}
|
||||
|
||||
if self.repository != '*':
|
||||
if self.repository == '*':
|
||||
for repository in list(self.repos.repositories.keys()):
|
||||
if self.utils.is_binary_repo(repository):
|
||||
count: int = self.session.query(BinariesTable.id).where(
|
||||
BinariesTable.repo == repository).count()
|
||||
else:
|
||||
count: int = self.session.query(sbo_table[repository].id).count()
|
||||
else:
|
||||
if self.is_binary:
|
||||
count: int = self.session.query(BinariesTable.id).where(BinariesTable.repo == self.repository).count()
|
||||
else:
|
||||
count: int = self.session.query(sbo_table[self.repository].id).count()
|
||||
|
||||
if count == 0:
|
||||
self.errors.raise_error_message("You need to update the package lists first, run:\n\n"
|
||||
" $ slpkg update",
|
||||
exit_status=1)
|
||||
if count == 0:
|
||||
self.errors.raise_error_message("You need to update the package lists first, run:\n\n"
|
||||
" $ slpkg update",
|
||||
exit_status=1)
|
||||
|
|
Loading…
Add table
Reference in a new issue