Skip to content

Commit

Permalink
Merge pull request #135 from endlessm/T34603-handle-missing-flatpaks
Browse files Browse the repository at this point in the history
Handle missing Flatpaks gracefully
  • Loading branch information
wjt authored Nov 30, 2023
2 parents b6df58d + 0d9191f commit e1648e2
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions lib/eibflatpak.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,15 +793,32 @@ def _check_excluded_operations(self, operations):
)

def _add_installs(self, transaction):
missing = []

for remote in self.remotes.values():
for app in remote.apps:
ref = remote.match(app, Flatpak.RefKind.APP)
logger.info('Adding app %s from %s', ref.ref, remote.name)
transaction.add_install(remote.name, ref.ref, None)
for runtime in remote.runtimes:
ref = remote.match(runtime, Flatpak.RefKind.RUNTIME)
logger.info('Adding runtime %s from %s', ref.ref, remote.name)
transaction.add_install(remote.name, ref.ref, None)
for kind, ref_strs in (
(Flatpak.RefKind.APP, remote.apps),
(Flatpak.RefKind.RUNTIME, remote.runtimes),
):
kind_str = kind.value_nick
for ref_str in ref_strs:
ref = remote.match(ref_str, kind)
if ref is not None:
logger.info(
'Adding %s %s from %s', kind_str, ref.ref, remote.name
)
transaction.add_install(remote.name, ref.ref, None)
else:
logger.error(
'%s %s not found from %s', kind_str, ref_str, remote.name
)
missing.append(ref_str)

if missing:
raise FlatpakError(
'Could not find listed flatpaks:',
', '.join(missing)
)

def _new_transaction(self):
txn = Flatpak.Transaction.new_for_installation(self.installation)
Expand Down

0 comments on commit e1648e2

Please sign in to comment.