mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-30 20:34:38 +01:00
Bugfixed to check if database is empty #145
Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
parent
ddadb5ef37
commit
6569bdf721
2 changed files with 15 additions and 2 deletions
|
@ -14,10 +14,11 @@ class Check:
|
|||
''' Some checks before proceed. '''
|
||||
log_packages: str = Configs.log_packages
|
||||
sbo_repo_tag: str = Configs.sbo_repo_tag
|
||||
db_path: str = Configs.db_path
|
||||
database_name: str = Configs.database
|
||||
|
||||
def exists(self, slackbuilds: list):
|
||||
''' Checking if the slackbuild exists in the repository. '''
|
||||
self.database()
|
||||
packages = []
|
||||
|
||||
for sbo in slackbuilds:
|
||||
|
@ -59,6 +60,7 @@ class Check:
|
|||
|
||||
def database(self):
|
||||
''' Checking for empty table '''
|
||||
if not SBoQueries('').names():
|
||||
db = f'{self.db_path}/{self.database_name}'
|
||||
if not SBoQueries('').names() or not os.path.isfile(db):
|
||||
raise SystemExit('\nYou need to update the package lists first.\n'
|
||||
'Please run slpkg update.\n')
|
||||
|
|
|
@ -70,6 +70,8 @@ class Argparse:
|
|||
upgrade = Upgrade()
|
||||
packages = list(upgrade.packages())
|
||||
|
||||
self.check.database()
|
||||
|
||||
if not packages:
|
||||
print('\nEverything is up-to-date.\n')
|
||||
raise SystemExit()
|
||||
|
@ -83,6 +85,7 @@ class Argparse:
|
|||
if len(self.args) >= 2 and '--reinstall' not in self.flags:
|
||||
packages = list(set(self.args[1:]))
|
||||
|
||||
self.check.database()
|
||||
self.check.exists(packages)
|
||||
self.check.unsupported(packages)
|
||||
|
||||
|
@ -95,6 +98,7 @@ class Argparse:
|
|||
if len(self.args) >= 2:
|
||||
packages = list(set(self.args[1:]))
|
||||
|
||||
self.check.database()
|
||||
self.check.exists(packages)
|
||||
self.check.unsupported(packages)
|
||||
|
||||
|
@ -110,6 +114,7 @@ class Argparse:
|
|||
if len(self.args) >= 2:
|
||||
packages = list(set(self.args[1:]))
|
||||
|
||||
self.check.database()
|
||||
self.check.exists(packages)
|
||||
download = Download(self.flags)
|
||||
download.packages(packages)
|
||||
|
@ -125,6 +130,7 @@ class Argparse:
|
|||
packages = list(set(self.args[1:]))
|
||||
packages = self.check.blacklist(packages)
|
||||
|
||||
self.check.database()
|
||||
self.check.installed(packages)
|
||||
|
||||
remove = RemovePackages(packages, self.flags)
|
||||
|
@ -137,6 +143,7 @@ class Argparse:
|
|||
packages = list(set(self.args[1:]))
|
||||
packages = self.check.blacklist(packages)
|
||||
|
||||
self.check.database()
|
||||
self.check.exists(packages)
|
||||
|
||||
view = ViewPackage()
|
||||
|
@ -149,6 +156,7 @@ class Argparse:
|
|||
packages = list(set(self.args[1:]))
|
||||
packages = self.check.blacklist(packages)
|
||||
|
||||
self.check.database()
|
||||
search = SearchPackage()
|
||||
search.package(packages)
|
||||
raise SystemExit()
|
||||
|
@ -159,6 +167,7 @@ class Argparse:
|
|||
packages = list(set(self.args[1:]))
|
||||
packages = self.check.blacklist(packages)
|
||||
|
||||
self.check.database()
|
||||
find = FindInstalled()
|
||||
find.find(packages)
|
||||
raise SystemExit()
|
||||
|
@ -169,6 +178,8 @@ class Argparse:
|
|||
usage(1)
|
||||
|
||||
if len(self.args) == 1:
|
||||
self.check.database()
|
||||
|
||||
logs = CleanLogsDependencies(self.flags)
|
||||
logs.clean()
|
||||
raise SystemExit()
|
||||
|
|
Loading…
Add table
Reference in a new issue