Commit e17d72c3 authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Make sure pacman database is updated before we get group packages

parent 50dd0523
......@@ -23,12 +23,32 @@ from .asyncsubprocess import AsyncSubprocess
class Pacman:
"""The Pacman class handles running pacman."""
# This property tells us if the database was updated
_database_updated: bool
def __init__(self):
"""Initialize our class."""
self._database_updated = False
def update_database(self):
"""Update pacman database."""
# Run pacman to update its database
proc = AsyncSubprocess(['pacman', '-Sy'])
output =
# Raise an exception if we didn't get a positive response back
if proc.retcode != 0:
raise OSError(f'Failed to run pacman, return code {proc.retcode}: {output}')
def get_group_packages(self, group: str) -> List[str]:
"""Get packages from a group."""
# Make sure our database was updated
if not self._database_updated:
# Run pacman
proc = AsyncSubprocess(['pacman', '-Sg', group])
output =
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment