updated SPM
All checks were successful
/ test-on-windows (push) Successful in 6s
/ test-on-alpine (push) Successful in 4s

This commit is contained in:
partisan 2025-02-13 10:58:16 +01:00
parent ce82b78e4e
commit b50133a06a
3 changed files with 35 additions and 5 deletions

View file

@ -4,6 +4,7 @@ import (
"fmt"
"os"
"path/filepath"
"strings"
)
// pendingUpdates holds info about packages that have been downloaded/decompressed
@ -82,11 +83,24 @@ func AutoDownloadUpdates() error {
// 5) Download the package into a temporary download folder
downloadDir := GetTempDir()
fmt.Printf("[INFO] Downloading package '%s' to temporary folder: %s\n", matchingEntry.Name, downloadDir)
fmt.Printf("[INFO] Downloading package '%s' to temporary folder: %s\n",
matchingEntry.Name, downloadDir)
err = DownloadPackageFromAppIndex(appIndexPath, matchingEntry.Name, matchingEntry.Release, matchingEntry.Type, downloadDir)
err = DownloadPackageFromAppIndex(
appIndexPath,
matchingEntry.Name,
matchingEntry.Release,
matchingEntry.Type,
downloadDir,
)
if err != nil {
return fmt.Errorf("[ERROR] Failed to download package '%s': %w", matchingEntry.Name, err)
// If the package is already up-to-date, skip it instead of erroring out
if strings.Contains(err.Error(), "Already up-to-date") {
fmt.Printf("[INFO] Package '%s' is already up-to-date, skipping.\n", matchingEntry.Name)
continue
}
return fmt.Errorf("[ERROR] Failed to download package '%s': %w",
matchingEntry.Name, err)
}
fmt.Printf("[INFO] Package '%s' downloaded successfully to: %s\n", matchingEntry.Name, downloadDir)
@ -223,7 +237,8 @@ func AutoDownloadSpecified(specs []AppIndexEntry) error {
// 5) Download the package
downloadDir := GetTempDir()
fmt.Printf("[INFO] Downloading package '%s' to temporary folder: %s\n", matchingEntry.Name, downloadDir)
fmt.Printf("[INFO] Downloading package '%s' to temporary folder: %s\n",
matchingEntry.Name, downloadDir)
if err := DownloadPackageFromAppIndex(
appIndexPath,
matchingEntry.Name,
@ -231,7 +246,13 @@ func AutoDownloadSpecified(specs []AppIndexEntry) error {
matchingEntry.Type,
downloadDir,
); err != nil {
return fmt.Errorf("[ERROR] Failed to download package '%s': %w", matchingEntry.Name, err)
// Again, if "Already up-to-date", skip
if strings.Contains(err.Error(), "Already up-to-date") {
fmt.Printf("[INFO] Package '%s' is already up-to-date, skipping.\n", matchingEntry.Name)
continue
}
return fmt.Errorf("[ERROR] Failed to download package '%s': %w",
matchingEntry.Name, err)
}
fmt.Printf("[INFO] Package '%s' downloaded successfully to: %s\n", matchingEntry.Name, downloadDir)