mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-03 20:18:31 -04:00
feat(dms updater): add support for ignoring specific packages during system updates
- Added UI component & popout settings to manage ignored packages
- Added CLI support available in danklinux docs
Fixes: #2827
Closes: #2344, #1741
Port 1.5
(cherry picked from commit e4657aa5f9)
This commit is contained in:
@@ -15,10 +15,12 @@ Singleton {
|
||||
property bool sysupdateAvailable: false
|
||||
|
||||
property var availableUpdates: []
|
||||
property var _rawUpdates: []
|
||||
property bool isChecking: false
|
||||
property bool isUpgrading: false
|
||||
property bool hasError: false
|
||||
property string errorMessage: ""
|
||||
property string errorHint: ""
|
||||
property string errorCode: ""
|
||||
property var backends: []
|
||||
property string distribution: ""
|
||||
@@ -31,6 +33,7 @@ Singleton {
|
||||
property int nextCheckUnix: 0
|
||||
|
||||
readonly property int updateCount: availableUpdates.length
|
||||
readonly property int hiddenUpdateCount: _rawUpdates.length - availableUpdates.length
|
||||
readonly property bool helperAvailable: sysupdateAvailable && backends.length > 0
|
||||
|
||||
Connections {
|
||||
@@ -57,6 +60,12 @@ Singleton {
|
||||
function onUpdaterCheckOnStartChanged() {
|
||||
Qt.callLater(() => root._maybeStartupCheck());
|
||||
}
|
||||
function onUpdaterAllowAURChanged() {
|
||||
root._refilter();
|
||||
}
|
||||
function onUpdaterIgnoredPackagesChanged() {
|
||||
root._refilter();
|
||||
}
|
||||
function on_HasLoadedChanged() {
|
||||
Qt.callLater(() => root._maybeStartupCheck());
|
||||
}
|
||||
@@ -100,7 +109,8 @@ Singleton {
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
availableUpdates = data.packages || [];
|
||||
_rawUpdates = data.packages || [];
|
||||
availableUpdates = _filterUpdates(_rawUpdates);
|
||||
backends = data.backends || [];
|
||||
distribution = data.distro || "";
|
||||
distributionPretty = data.distroPretty || "";
|
||||
@@ -129,10 +139,12 @@ Singleton {
|
||||
hasError = true;
|
||||
errorMessage = data.error.message || "";
|
||||
errorCode = data.error.code || "";
|
||||
errorHint = data.error.hint || "";
|
||||
} else {
|
||||
hasError = false;
|
||||
errorMessage = "";
|
||||
errorCode = "";
|
||||
errorHint = "";
|
||||
}
|
||||
|
||||
if (backends.length > 0) {
|
||||
@@ -143,6 +155,29 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
function _filterUpdates(pkgs) {
|
||||
const ignored = SettingsData.updaterIgnoredPackages || [];
|
||||
return (pkgs || []).filter(p => {
|
||||
if (!SettingsData.updaterAllowAUR && p.repo === "aur")
|
||||
return false;
|
||||
return ignored.indexOf(p.name) === -1;
|
||||
});
|
||||
}
|
||||
|
||||
function _refilter() {
|
||||
availableUpdates = _filterUpdates(_rawUpdates);
|
||||
}
|
||||
|
||||
function ignorePackage(name) {
|
||||
if (!name)
|
||||
return;
|
||||
const list = (SettingsData.updaterIgnoredPackages || []).slice();
|
||||
if (list.indexOf(name) !== -1)
|
||||
return;
|
||||
list.push(name);
|
||||
SettingsData.set("updaterIgnoredPackages", list);
|
||||
}
|
||||
|
||||
function checkForUpdates() {
|
||||
DMSService.sysupdateRefresh(false, null);
|
||||
}
|
||||
@@ -153,6 +188,7 @@ Singleton {
|
||||
_runCustomTerminalCommand();
|
||||
return;
|
||||
}
|
||||
params.ignored = SettingsData.updaterIgnoredPackages || [];
|
||||
DMSService.sysupdateUpgrade(params, null);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user