feat(cleanup): add a maintenance page for unused and legacy packages
Leftovers pile up on a machine: dependencies that no installed package requires any more, and installs coming from the AUR or manual builds that the sync databases know nothing about. The new Nettoyage page lists both (orphans first, since they are the ones that can be removed in bulk), shows which provider reported each row, and frees the space held by the caches: paccache (or pacman -Sc) and flatpak's unused runtimes. Cleanup is an optional capability of IPackageManager, so providers that only install packages keep working unchanged. Generated with Codebuff 🤖 Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
1 parent
b8f8dc569f
commit
632cdf1dea
10 files changed
+750
-6
No files matched your search
@@ -461,3 +461,22 @@ bool FlatpakManager::refresh(ProgressCallback progressCallback) {
|
||||
integrateAllInstalled();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FlatpakManager::cleanCache(ProgressCallback progressCallback) {
|
||||
m_lastError.clear();
|
||||
if (progressCallback) {
|
||||
progressCallback("Suppression des runtimes Flatpak inutilisés...", -1);
|
||||
}
|
||||
|
||||
// Runtimes left behind by uninstalled applications weigh several hundred
|
||||
// megabytes each; flatpak only removes those no installed app references.
|
||||
std::string output = exec(
|
||||
"flatpak uninstall --unused --noninteractive --assumeyes 2>&1");
|
||||
streamOutput(output, progressCallback);
|
||||
|
||||
if (output.find("error:") != std::string::npos) {
|
||||
m_lastError = lastOutputLines(output);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -49,6 +49,11 @@ public:
|
||||
std::vector<PackageInfo> listUpdates() override;
|
||||
bool refresh(ProgressCallback progressCallback = nullptr) override;
|
||||
|
||||
// Cleanup: flatpak knows which runtimes no installed application uses any
|
||||
// more, so it can reclaim them from the maintenance page.
|
||||
bool canCleanCache() const override { return true; }
|
||||
bool cleanCache(ProgressCallback progressCallback = nullptr) override;
|
||||
|
||||
// Make an app appear in the desktop's application launcher (wofi, GNOME,
|
||||
// KDE, ...) regardless of XDG_DATA_DIRS, like a pacman install would: link
|
||||
// its .desktop entries and icons from flatpak's exports into the user's
|
||||
|
||||
Reference in new issue
Block a user