fix: Ensure the flatpak list is filtered before checking for empty (#443)
Some checks failed
build-individual / build-individual (push) Failing after 2s
build-unified / build-unified (push) Failing after 2s

In order for the logic to work properly, the flatpak list needs to be
filtered down before checking for empty. Otherwise, in the `if` clause,
the list would become empty, and would cause the flatpak call to fail.

Signed-off-by: Brad P. Crochet <brad@crochet.net>
This commit is contained in:
Brad P. Crochet 2025-08-18 01:36:33 -04:00 committed by GitHub
parent 077f39e7f0
commit 0ee5aa76d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 20 deletions

View file

@ -22,17 +22,17 @@ def main [] {
if ($systemRemotes | any {|remote| $remote == "fedora-testing"}) {
flatpak remote-delete --system fedora-testing --force
}
let fedoraAppList = (flatpak list --system --app --columns=origin,application | detect columns --no-headers | default [] | where column0 == fedora)
if ($fedoraAppList | is-not-empty) {
let fedoraApps = $fedoraAppList | get column1
flatpak remove --user --noninteractive ...$fedoraApps
}
let appList = (flatpak list --system --app --columns=origin,application)
if ($appList | is-not-empty) {
let fedoraApps = $appList | detect columns --no-headers | where column0 == fedora | get column1
flatpak remove --system --noninteractive ...$fedoraApps
}
let runtimeList = (flatpak list --system --runtime --columns=origin,application,arch,branch)
if ($runtimeList | is-not-empty) {
let fedoraRuntimes = $runtimeList | detect columns --no-headers | where column0 == fedora | each {|i| $"($i.column1)/($i.column2)/($i.column3)" }
flatpak remove --system --noninteractive ...$fedoraRuntimes
}
let fedoraRuntimeList = (flatpak list --system --runtime --columns=origin,application,arch,branch | detect columns --no-headers | default [] | where column0 == fedora)
if ($fedoraRuntimeList | is-not-empty) {
let fedoraRuntimes = $fedoraRuntimeList | each {|i| $"($i.column1)/($i.column2)/($i.column3)" }
flatpak remove --user --noninteractive ...$fedoraRuntimes
}
}
for config in ($configFile | where scope == system) {

View file

@ -19,17 +19,17 @@ def main [] {
flatpak remote-delete --user fedora-testing --force
}
let appList = (flatpak list --user --app --columns=origin,application)
if ($appList | is-not-empty) {
let fedoraApps = $appList | detect columns --no-headers | where column0 == fedora | get column1
flatpak remove --user --noninteractive ...$fedoraApps
}
let fedoraAppList = (flatpak list --user --app --columns=origin,application | detect columns --no-headers | default [] | where column0 == fedora)
if ($fedoraAppList | is-not-empty) {
let fedoraApps = $fedoraAppList | get column1
flatpak remove --user --noninteractive ...$fedoraApps
}
let runtimeList = (flatpak list --user --runtime --columns=origin,application,arch,branch)
if ($runtimeList | is-not-empty) {
let fedoraRuntimes = $runtimeList | detect columns --no-headers | where column0 == fedora | each {|i| $"($i.column1)/($i.column2)/($i.column3)" }
flatpak remove --user --noninteractive ...$fedoraRuntimes
}
let fedoraRuntimeList = (flatpak list --user --runtime --columns=origin,application,arch,branch | detect columns --no-headers | default [] | where column0 == fedora)
if ($fedoraRuntimeList | is-not-empty) {
let fedoraRuntimes = $fedoraRuntimeList | each {|i| $"($i.column1)/($i.column2)/($i.column3)" }
flatpak remove --user --noninteractive ...$fedoraRuntimes
}
}
for config in ($configFile | where scope == user) {