updated SPM
This commit is contained in:
parent
ce82b78e4e
commit
b50133a06a
3 changed files with 35 additions and 5 deletions
31
spm/auto.go
31
spm/auto.go
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue