Small changes for ArchUpdaterService
ArchUpdaterService: remove duplicate AUR helper check and remove any pacman occurrence
This commit is contained in:
parent
560f601190
commit
714f6c058f
1 changed files with 17 additions and 103 deletions
|
|
@ -42,11 +42,10 @@ Singleton {
|
||||||
// Refresh timer for post-update polling
|
// Refresh timer for post-update polling
|
||||||
Timer {
|
Timer {
|
||||||
id: refreshTimer
|
id: refreshTimer
|
||||||
interval: 5000 // Increased delay to ensure updates complete
|
interval: 5000
|
||||||
repeat: false
|
repeat: false
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
console.log("ArchUpdater: Refreshing package lists after update...")
|
Logger.log("ArchUpdater", "Refreshing package lists after update...")
|
||||||
// Just refresh package lists without syncing database
|
|
||||||
doPoll()
|
doPoll()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -57,7 +56,7 @@ Singleton {
|
||||||
interval: 30000 // Increased to 30 seconds to allow more time
|
interval: 30000 // Increased to 30 seconds to allow more time
|
||||||
repeat: false
|
repeat: false
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
console.log("ArchUpdater: Update timeout reached, checking for failures...")
|
Logger.log("ArchUpdater", "Update timeout reached, checking for failures...")
|
||||||
checkForUpdateFailures()
|
checkForUpdateFailures()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -81,11 +80,11 @@ Singleton {
|
||||||
// Process to monitor update completion
|
// Process to monitor update completion
|
||||||
Process {
|
Process {
|
||||||
id: updateStatusProcess
|
id: updateStatusProcess
|
||||||
command: ["pgrep", "-f", "(pacman|yay|paru).*(-S|-Syu)"]
|
command: ["pgrep", "-f", "(yay|paru).*(-S|-Syu)"]
|
||||||
onExited: function (exitCode) {
|
onExited: function (exitCode) {
|
||||||
if (exitCode !== 0 && updateInProgress) {
|
if (exitCode !== 0 && updateInProgress) {
|
||||||
// No update processes found, update likely completed
|
// No update processes found, update likely completed
|
||||||
console.log("ArchUpdater: No update processes detected, marking update as complete")
|
Logger.log("ArchUpdater", "No update processes detected, marking update as complete")
|
||||||
updateInProgress = false
|
updateInProgress = false
|
||||||
updateMonitorTimer.stop()
|
updateMonitorTimer.stop()
|
||||||
|
|
||||||
|
|
@ -107,16 +106,13 @@ Singleton {
|
||||||
onExited: function (exitCode) {
|
onExited: function (exitCode) {
|
||||||
if (exitCode === 0 && updateInProgress) {
|
if (exitCode === 0 && updateInProgress) {
|
||||||
// Error found in log
|
// Error found in log
|
||||||
console.log("ArchUpdater: Error detected in log file")
|
Logger.error("ArchUpdater", "Error detected in log file")
|
||||||
updateInProgress = false
|
updateInProgress = false
|
||||||
updateFailed = true
|
updateFailed = true
|
||||||
updateCompleteTimer.stop()
|
updateCompleteTimer.stop()
|
||||||
updateMonitorTimer.stop()
|
updateMonitorTimer.stop()
|
||||||
lastUpdateError = "Build or update error detected"
|
lastUpdateError = "Build or update error detected"
|
||||||
|
|
||||||
// Read full log file for debugging
|
|
||||||
logReaderProcess.running = true
|
|
||||||
|
|
||||||
// Refresh to check actual state
|
// Refresh to check actual state
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
doPoll()
|
doPoll()
|
||||||
|
|
@ -126,7 +122,7 @@ Singleton {
|
||||||
stdout: StdioCollector {
|
stdout: StdioCollector {
|
||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
if (text && text.trim() !== "") {
|
if (text && text.trim() !== "") {
|
||||||
console.log("ArchUpdater: Captured error from log:", text.trim())
|
Logger.error("ArchUpdater", "Captured error from log:", text.trim())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -154,24 +150,6 @@ Singleton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process to read full log file for debugging
|
|
||||||
Process {
|
|
||||||
id: logReaderProcess
|
|
||||||
command: ["cat", "/tmp/archupdater_output.log"]
|
|
||||||
onExited: function (exitCode) {
|
|
||||||
if (exitCode === 0) {
|
|
||||||
console.log("ArchUpdater: Full log file contents:")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
if (text) {
|
|
||||||
console.log(text)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Timer to check for success more frequently when update is in progress
|
// Timer to check for success more frequently when update is in progress
|
||||||
Timer {
|
Timer {
|
||||||
id: errorCheckTimer
|
id: errorCheckTimer
|
||||||
|
|
@ -195,7 +173,7 @@ Singleton {
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkForUpdateFailures() {
|
function checkForUpdateFailures() {
|
||||||
console.log("ArchUpdater: Checking for update failures...")
|
Logger.error("ArchUpdater", "Checking for update failures...")
|
||||||
updateInProgress = false
|
updateInProgress = false
|
||||||
updateFailed = true
|
updateFailed = true
|
||||||
updateCompleteTimer.stop()
|
updateCompleteTimer.stop()
|
||||||
|
|
@ -209,7 +187,6 @@ Singleton {
|
||||||
|
|
||||||
// Initial check
|
// Initial check
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
getAurHelper()
|
|
||||||
// Initial poll without cooldown restriction
|
// Initial poll without cooldown restriction
|
||||||
const aurHelper = getAurHelper()
|
const aurHelper = getAurHelper()
|
||||||
if (aurHelper) {
|
if (aurHelper) {
|
||||||
|
|
@ -381,7 +358,7 @@ Singleton {
|
||||||
updateFailed = false
|
updateFailed = false
|
||||||
lastUpdateError = ""
|
lastUpdateError = ""
|
||||||
updateInProgress = true
|
updateInProgress = true
|
||||||
console.log("ArchUpdater: Starting full system update...")
|
Logger.log("ArchUpdater", "Starting full system update...")
|
||||||
|
|
||||||
const terminal = Quickshell.env("TERMINAL") || "xterm"
|
const terminal = Quickshell.env("TERMINAL") || "xterm"
|
||||||
|
|
||||||
|
|
@ -391,10 +368,6 @@ Singleton {
|
||||||
// Use AUR helper for full system update (handles both repo and AUR)
|
// Use AUR helper for full system update (handles both repo and AUR)
|
||||||
const command = generateUpdateCommand(aurHelper + " -Syu")
|
const command = generateUpdateCommand(aurHelper + " -Syu")
|
||||||
Quickshell.execDetached([terminal, "-e", "bash", "-c", command])
|
Quickshell.execDetached([terminal, "-e", "bash", "-c", command])
|
||||||
} else if (updates > 0) {
|
|
||||||
// Fallback to pacman if no AUR helper or only repo updates
|
|
||||||
const command = generateUpdateCommand("sudo pacman -Syu")
|
|
||||||
Quickshell.execDetached([terminal, "-e", "bash", "-c", command])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start monitoring and timeout timers
|
// Start monitoring and timeout timers
|
||||||
|
|
@ -412,7 +385,7 @@ Singleton {
|
||||||
updateFailed = false
|
updateFailed = false
|
||||||
lastUpdateError = ""
|
lastUpdateError = ""
|
||||||
updateInProgress = true
|
updateInProgress = true
|
||||||
console.log("ArchUpdater: Starting selective update for", selectedPackages.length, "packages")
|
Logger.log("ArchUpdater", "Starting selective update for", selectedPackages.length, "packages")
|
||||||
|
|
||||||
const terminal = Quickshell.env("TERMINAL") || "xterm"
|
const terminal = Quickshell.env("TERMINAL") || "xterm"
|
||||||
|
|
||||||
|
|
@ -432,22 +405,15 @@ Singleton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update repo packages with sudo
|
// Update all packages with AUR helper (handles both repo and AUR)
|
||||||
if (repoPkgs.length > 0) {
|
if (selectedPackages.length > 0) {
|
||||||
const packageList = repoPkgs.join(" ")
|
|
||||||
const command = generateUpdateCommand("sudo pacman -S " + packageList)
|
|
||||||
Quickshell.execDetached([terminal, "-e", "bash", "-c", command])
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update AUR packages with yay/paru
|
|
||||||
if (aurPkgs.length > 0) {
|
|
||||||
const aurHelper = getAurHelper()
|
const aurHelper = getAurHelper()
|
||||||
if (aurHelper) {
|
if (aurHelper) {
|
||||||
const packageList = aurPkgs.join(" ")
|
const packageList = selectedPackages.join(" ")
|
||||||
const command = generateUpdateCommand(aurHelper + " -S " + packageList)
|
const command = generateUpdateCommand(aurHelper + " -S " + packageList)
|
||||||
Quickshell.execDetached([terminal, "-e", "bash", "-c", command])
|
Quickshell.execDetached([terminal, "-e", "bash", "-c", command])
|
||||||
} else {
|
} else {
|
||||||
Logger.warn("ArchUpdater", "No AUR helper found for packages:", aurPkgs.join(", "))
|
Logger.warn("ArchUpdater", "No AUR helper found for packages:", selectedPackages.join(", "))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -510,7 +476,7 @@ Singleton {
|
||||||
onExited: function (exitCode) {
|
onExited: function (exitCode) {
|
||||||
if (exitCode === 0) {
|
if (exitCode === 0) {
|
||||||
cachedAurHelper = "yay"
|
cachedAurHelper = "yay"
|
||||||
console.log("ArchUpdater: Found yay AUR helper")
|
Logger.log("ArchUpdater", "Found yay AUR helper")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -523,36 +489,12 @@ Singleton {
|
||||||
if (exitCode === 0) {
|
if (exitCode === 0) {
|
||||||
if (cachedAurHelper === "") {
|
if (cachedAurHelper === "") {
|
||||||
cachedAurHelper = "paru"
|
cachedAurHelper = "paru"
|
||||||
console.log("ArchUpdater: Found paru AUR helper")
|
Logger.log("ArchUpdater", "Found paru AUR helper")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process for syncing package databases with sudo
|
|
||||||
Process {
|
|
||||||
id: syncDatabaseProcess
|
|
||||||
command: ["sudo", "pacman", "-Sy"]
|
|
||||||
onStarted: {
|
|
||||||
console.log("ArchUpdater: Starting database sync with sudo...")
|
|
||||||
}
|
|
||||||
onExited: function (exitCode) {
|
|
||||||
console.log("ArchUpdater: Database sync exited with code:", exitCode)
|
|
||||||
if (exitCode === 0) {
|
|
||||||
console.log("ArchUpdater: Database sync successful")
|
|
||||||
} else {
|
|
||||||
console.log("ArchUpdater: Database sync failed")
|
|
||||||
}
|
|
||||||
|
|
||||||
// After sync completes, wait a moment then refresh package lists
|
|
||||||
console.log("ArchUpdater: Database sync complete, waiting before refresh...")
|
|
||||||
Qt.callLater(() => {
|
|
||||||
console.log("ArchUpdater: Refreshing package lists after database sync...")
|
|
||||||
doPoll()
|
|
||||||
}, 2000)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cached AUR helper detection
|
// Cached AUR helper detection
|
||||||
property string cachedAurHelper: ""
|
property string cachedAurHelper: ""
|
||||||
|
|
||||||
|
|
@ -564,7 +506,7 @@ Singleton {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for AUR helpers using Process objects
|
// Check for AUR helpers using Process objects
|
||||||
console.log("ArchUpdater: Detecting AUR helper...")
|
Logger.log("ArchUpdater", "Detecting AUR helper...")
|
||||||
|
|
||||||
// Start the detection processes
|
// Start the detection processes
|
||||||
yayCheckProcess.running = true
|
yayCheckProcess.running = true
|
||||||
|
|
@ -606,34 +548,6 @@ Singleton {
|
||||||
// REFRESH FUNCTIONS
|
// REFRESH FUNCTIONS
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
// Function to manually sync package databases (separate from refresh)
|
|
||||||
function syncPackageDatabases() {
|
|
||||||
console.log("ArchUpdater: Manual database sync requested...")
|
|
||||||
const terminal = Quickshell.env("TERMINAL") || "xterm"
|
|
||||||
const command = "sudo pacman -Sy && echo 'Database sync complete! Press Enter to close...' && read -p 'Press Enter to continue...'"
|
|
||||||
console.log("ArchUpdater: Executing sync command:", command)
|
|
||||||
console.log("ArchUpdater: Terminal:", terminal)
|
|
||||||
Quickshell.execDetached([terminal, "-e", "bash", "-c", command])
|
|
||||||
}
|
|
||||||
|
|
||||||
// Function to force a complete refresh (sync + check)
|
|
||||||
function forceCompleteRefresh() {
|
|
||||||
console.log("ArchUpdater: Force complete refresh requested...")
|
|
||||||
|
|
||||||
// Start database sync process (will trigger refresh when complete)
|
|
||||||
console.log("ArchUpdater: Starting complete refresh process...")
|
|
||||||
syncDatabaseProcess.running = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// Function to sync database and refresh package lists
|
|
||||||
function syncDatabaseAndRefresh() {
|
|
||||||
console.log("ArchUpdater: Syncing database and refreshing package lists...")
|
|
||||||
|
|
||||||
// Start database sync process (will trigger refresh when complete)
|
|
||||||
console.log("ArchUpdater: Starting database sync process...")
|
|
||||||
syncDatabaseProcess.running = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// UTILITY FUNCTIONS
|
// UTILITY FUNCTIONS
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue