Fix ArchUpdaterService error codes (once more)
ArchUpdaterService: Update yay error code (1 also means no updates available just like in paru)
This commit is contained in:
parent
1eae0eb3d4
commit
8395b2640e
1 changed files with 61 additions and 13 deletions
|
|
@ -211,20 +211,15 @@ Singleton {
|
||||||
// Start AUR helper detection
|
// Start AUR helper detection
|
||||||
getAurHelper()
|
getAurHelper()
|
||||||
|
|
||||||
// Use a timer to check for AUR helper after detection completes
|
// Set up a fallback timer in case detection takes too long
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
if (cachedAurHelper !== "") {
|
if (cachedAurHelper === "") {
|
||||||
checkAurUpdatesProcess.command = [cachedAurHelper, "-Qu"]
|
// No AUR helper found after reasonable time
|
||||||
checkAurOnlyProcess.command = [cachedAurHelper, getAurOnlyFlag()]
|
|
||||||
checkAurUpdatesProcess.running = true
|
|
||||||
lastPollTime = Date.now()
|
|
||||||
} else {
|
|
||||||
// No AUR helper found
|
|
||||||
checkFailed = true
|
checkFailed = true
|
||||||
lastCheckError = "No AUR helper found (yay or paru not installed)"
|
lastCheckError = "No AUR helper found (yay or paru not installed)"
|
||||||
Logger.warn("ArchUpdater", "No AUR helper found (yay or paru)")
|
Logger.warn("ArchUpdater", "No AUR helper found (yay or paru)")
|
||||||
}
|
}
|
||||||
}, 1000)
|
}, 5000) // 5 second fallback
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
@ -236,7 +231,8 @@ Singleton {
|
||||||
id: checkAurUpdatesProcess
|
id: checkAurUpdatesProcess
|
||||||
command: []
|
command: []
|
||||||
onExited: function (exitCode) {
|
onExited: function (exitCode) {
|
||||||
if (exitCode !== 0) {
|
// For both yay and paru: exit code 0 = updates available, exit code 1 = no updates
|
||||||
|
if (exitCode !== 0 && exitCode !== 1) {
|
||||||
Logger.warn("ArchUpdater", "AUR helper check failed (code:", exitCode, ")")
|
Logger.warn("ArchUpdater", "AUR helper check failed (code:", exitCode, ")")
|
||||||
checkFailed = true
|
checkFailed = true
|
||||||
lastCheckError = "Failed to check for updates (exit code: " + exitCode + ")"
|
lastCheckError = "Failed to check for updates (exit code: " + exitCode + ")"
|
||||||
|
|
@ -248,6 +244,7 @@ Singleton {
|
||||||
stdout: StdioCollector {
|
stdout: StdioCollector {
|
||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
allUpdatesOutput = text
|
allUpdatesOutput = text
|
||||||
|
Logger.log("ArchUpdater", "First process output length:", text.length, "content:", text.trim())
|
||||||
// Now get AUR-only updates to compare
|
// Now get AUR-only updates to compare
|
||||||
checkAurOnlyProcess.running = true
|
checkAurOnlyProcess.running = true
|
||||||
}
|
}
|
||||||
|
|
@ -259,8 +256,7 @@ Singleton {
|
||||||
id: checkAurOnlyProcess
|
id: checkAurOnlyProcess
|
||||||
command: []
|
command: []
|
||||||
onExited: function (exitCode) {
|
onExited: function (exitCode) {
|
||||||
// For paru -Qua, exit code 1 means "no AUR updates available", which is valid
|
// For both yay and paru: exit code 0 = updates available, exit code 1 = no updates
|
||||||
// For yay -Qua, exit code 0 means success
|
|
||||||
if (exitCode !== 0 && exitCode !== 1) {
|
if (exitCode !== 0 && exitCode !== 1) {
|
||||||
Logger.warn("ArchUpdater", "AUR helper AUR-only check failed (code:", exitCode, ")")
|
Logger.warn("ArchUpdater", "AUR helper AUR-only check failed (code:", exitCode, ")")
|
||||||
checkFailed = true
|
checkFailed = true
|
||||||
|
|
@ -278,6 +274,7 @@ Singleton {
|
||||||
}
|
}
|
||||||
stdout: StdioCollector {
|
stdout: StdioCollector {
|
||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
|
Logger.log("ArchUpdater", "Processing update results - all updates output length:", allUpdatesOutput.length)
|
||||||
parseAllUpdatesOutput(allUpdatesOutput, text)
|
parseAllUpdatesOutput(allUpdatesOutput, text)
|
||||||
Logger.log("ArchUpdater", "found", repoPackages.length, "repo package(s) and", aurPackages.length,
|
Logger.log("ArchUpdater", "found", repoPackages.length, "repo package(s) and", aurPackages.length,
|
||||||
"AUR package(s) to upgrade")
|
"AUR package(s) to upgrade")
|
||||||
|
|
@ -370,6 +367,12 @@ Singleton {
|
||||||
|
|
||||||
// Check if we have a cached AUR helper
|
// Check if we have a cached AUR helper
|
||||||
if (cachedAurHelper !== "") {
|
if (cachedAurHelper !== "") {
|
||||||
|
// Clear error state when helper is available
|
||||||
|
if (checkFailed && lastCheckError.includes("No AUR helper found")) {
|
||||||
|
checkFailed = false
|
||||||
|
lastCheckError = ""
|
||||||
|
}
|
||||||
|
|
||||||
checkAurUpdatesProcess.command = [cachedAurHelper, "-Qu"]
|
checkAurUpdatesProcess.command = [cachedAurHelper, "-Qu"]
|
||||||
checkAurOnlyProcess.command = [cachedAurHelper, getAurOnlyFlag()]
|
checkAurOnlyProcess.command = [cachedAurHelper, getAurOnlyFlag()]
|
||||||
|
|
||||||
|
|
@ -506,6 +509,8 @@ Singleton {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Logger.log("ArchUpdater", "Force refresh requested")
|
||||||
|
|
||||||
// Clear error states when refreshing
|
// Clear error states when refreshing
|
||||||
updateFailed = false
|
updateFailed = false
|
||||||
lastUpdateError = ""
|
lastUpdateError = ""
|
||||||
|
|
@ -514,6 +519,13 @@ Singleton {
|
||||||
|
|
||||||
// Check if we have a cached AUR helper
|
// Check if we have a cached AUR helper
|
||||||
if (cachedAurHelper !== "") {
|
if (cachedAurHelper !== "") {
|
||||||
|
// Clear error state when helper is available
|
||||||
|
if (checkFailed && lastCheckError.includes("No AUR helper found")) {
|
||||||
|
checkFailed = false
|
||||||
|
lastCheckError = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.log("ArchUpdater", "Force refresh using", cachedAurHelper)
|
||||||
checkAurUpdatesProcess.command = [cachedAurHelper, "-Qu"]
|
checkAurUpdatesProcess.command = [cachedAurHelper, "-Qu"]
|
||||||
checkAurOnlyProcess.command = [cachedAurHelper, getAurOnlyFlag()]
|
checkAurOnlyProcess.command = [cachedAurHelper, getAurOnlyFlag()]
|
||||||
|
|
||||||
|
|
@ -541,7 +553,14 @@ Singleton {
|
||||||
onExited: function (exitCode) {
|
onExited: function (exitCode) {
|
||||||
if (exitCode === 0) {
|
if (exitCode === 0) {
|
||||||
cachedAurHelper = "yay"
|
cachedAurHelper = "yay"
|
||||||
Logger.log("ArchUpdater", "Found yay AUR helper")
|
Logger.log("ArchUpdater", "Found yay AUR helper (preferred)")
|
||||||
|
// Clear error state when helper is found
|
||||||
|
if (checkFailed && lastCheckError.includes("No AUR helper found")) {
|
||||||
|
checkFailed = false
|
||||||
|
lastCheckError = ""
|
||||||
|
}
|
||||||
|
// Trigger initial check when helper is found
|
||||||
|
triggerInitialCheck()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -552,9 +571,19 @@ Singleton {
|
||||||
command: ["which", "paru"]
|
command: ["which", "paru"]
|
||||||
onExited: function (exitCode) {
|
onExited: function (exitCode) {
|
||||||
if (exitCode === 0) {
|
if (exitCode === 0) {
|
||||||
|
// Only use paru if yay wasn't found (yay is preferred)
|
||||||
if (cachedAurHelper === "") {
|
if (cachedAurHelper === "") {
|
||||||
cachedAurHelper = "paru"
|
cachedAurHelper = "paru"
|
||||||
Logger.log("ArchUpdater", "Found paru AUR helper")
|
Logger.log("ArchUpdater", "Found paru AUR helper")
|
||||||
|
// Clear error state when helper is found
|
||||||
|
if (checkFailed && lastCheckError.includes("No AUR helper found")) {
|
||||||
|
checkFailed = false
|
||||||
|
lastCheckError = ""
|
||||||
|
}
|
||||||
|
// Trigger initial check when helper is found
|
||||||
|
triggerInitialCheck()
|
||||||
|
} else {
|
||||||
|
Logger.log("ArchUpdater", "Found paru but using", cachedAurHelper, "(preferred)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -592,6 +621,25 @@ Singleton {
|
||||||
return "-Qua" // fallback
|
return "-Qua" // fallback
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Helper function to trigger the initial package check
|
||||||
|
function triggerInitialCheck() {
|
||||||
|
// Only trigger if this is the first time (no packages have been checked yet)
|
||||||
|
if (repoPackages.length === 0 && aurPackages.length === 0 && !aurBusy) {
|
||||||
|
// Clear any previous error state
|
||||||
|
checkFailed = false
|
||||||
|
lastCheckError = ""
|
||||||
|
|
||||||
|
// Wait a bit for the system to be ready before the first check
|
||||||
|
Qt.callLater(() => {
|
||||||
|
checkAurUpdatesProcess.command = [cachedAurHelper, "-Qu"]
|
||||||
|
checkAurOnlyProcess.command = [cachedAurHelper, getAurOnlyFlag()]
|
||||||
|
checkAurUpdatesProcess.running = true
|
||||||
|
lastPollTime = Date.now()
|
||||||
|
Logger.log("ArchUpdater", "Initial package check started with", cachedAurHelper)
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// PACKAGE SELECTION FUNCTIONS
|
// PACKAGE SELECTION FUNCTIONS
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue