sysupdate: hide flatpak updates when flatpak is excluded

Port 2.0
This commit is contained in:
purian23
2026-10-23 06:28:01 -04:00
parent 0cd03e0180
commit efd9324a4d
3 changed files with 20 additions and 2 deletions
@@ -61,7 +61,7 @@ Item {
readonly property bool busy: SystemUpdateService.isChecking || SystemUpdateService.isUpgrading
// A refresh clears the log, so a log next to an error means the upgrade itself failed.
readonly property bool upgradeFailed: SystemUpdateService.hasError && !busy && (SystemUpdateService.recentLog || []).length > 0
readonly property var installablePackages: SystemUpdateService.availableUpdates.filter(p => SettingsData.updaterIncludeFlatpak || p.repo !== "flatpak")
readonly property var installablePackages: SystemUpdateService.availableUpdates
readonly property bool anythingToInstall: installablePackages.length > 0 && SystemUpdateService.helperAvailable
readonly property var notesRelease: SystemUpdateService.notesRelease
readonly property int serviceLastCheckUnix: SystemUpdateService.lastCheckUnix
@@ -124,6 +124,9 @@ Singleton {
function onUpdaterAllowAURChanged() {
root._refilter();
}
function onUpdaterIncludeFlatpakChanged() {
root._refilter();
}
function onUpdaterIgnoredPackagesChanged() {
root._refilter();
}
@@ -275,6 +278,8 @@ Singleton {
return (pkgs || []).filter(p => {
if (!SettingsData.updaterAllowAUR && p.repo === "aur")
return false;
if (!SettingsData.updaterIncludeFlatpak && p.repo === "flatpak")
return false;
if (!canIgnorePackage(p))
return true;
return !_isIgnored(p);
+14 -1
View File
@@ -12,7 +12,7 @@ const extract = (name) => {
};
const scope = vm.createContext({
SettingsData: { updaterIgnoredPackages: [], updaterAllowAUR: true },
SettingsData: { updaterIgnoredPackages: [], updaterAllowAUR: true, updaterIncludeFlatpak: true },
pkgManager: "portage",
systemHoldsAllowed: true,
});
@@ -59,3 +59,16 @@ test("portage ignores drop the update from the list", () => {
const kept = scope._filterUpdates(pkgs);
assert.deepEqual(kept.map(p => p.name), ["mail-client/thunderbird"]);
});
test("excluded flatpak updates are dropped from the list", () => {
scope.SettingsData.updaterIgnoredPackages = [];
const pkgs = [
{ name: "org.freedesktop.Platform", repo: "flatpak", backend: "flatpak" },
{ name: "mail-client/thunderbird", repo: "gentoo (ebuild)", backend: "portage" },
];
for (const [include, want] of [[true, ["org.freedesktop.Platform", "mail-client/thunderbird"]], [false, ["mail-client/thunderbird"]]]) {
scope.SettingsData.updaterIncludeFlatpak = include;
assert.deepEqual(scope._filterUpdates(pkgs).map(p => p.name), want, `includeFlatpak=${include}`);
}
scope.SettingsData.updaterIncludeFlatpak = true;
});