Add 'ignored' status for package version checking

This commit is contained in:
2025-09-09 19:05:57 +03:00
parent 334eb15c94
commit d5abad3371
+17
View File
@@ -163,6 +163,7 @@ func checkVersionsFunc(repo string) {
} }
pkgsWithoutScript := make([]string, 0) pkgsWithoutScript := make([]string, 0)
pkgsIgnored := make([]string, 0)
pkgsWithError := make(map[string]error) pkgsWithError := make(map[string]error)
pkgsWithUpdates := make(map[string]struct { pkgsWithUpdates := make(map[string]struct {
OldVersion string OldVersion string
@@ -196,6 +197,16 @@ func checkVersionsFunc(repo string) {
} }
latestVersion = strings.TrimSpace(string(output)) latestVersion = strings.TrimSpace(string(output))
// Check if package should be ignored
if latestVersion == "ignore" {
pkgsIgnored = append(pkgsIgnored, pkgInfo.Name)
// Remove cached status
delete(cachedVersions, pkgInfo.Name)
continue
}
// Ensure latest version is valid // Ensure latest version is valid
if latestVersion == "" || latestVersion == "null" { if latestVersion == "" || latestVersion == "null" {
pkgsWithError[pkgInfo.Name] = fmt.Errorf("invalid version number \"%s\"", latestVersion) pkgsWithError[pkgInfo.Name] = fmt.Errorf("invalid version number \"%s\"", latestVersion)
@@ -241,6 +252,11 @@ func checkVersionsFunc(repo string) {
} }
if verbose { if verbose {
// Print ignored packages
for _, pkg := range pkgsIgnored {
log.Printf("Warning: package (%s) was ignored\n", pkg)
}
// Print packages without check-version.sh script // Print packages without check-version.sh script
for _, pkg := range pkgsWithoutScript { for _, pkg := range pkgsWithoutScript {
log.Printf("Warning: package (%s) has no check-version.sh script\n", pkg) log.Printf("Warning: package (%s) has no check-version.sh script\n", pkg)
@@ -259,6 +275,7 @@ func checkVersionsFunc(repo string) {
fmt.Println("Available updates:", len(pkgsWithUpdates)) fmt.Println("Available updates:", len(pkgsWithUpdates))
fmt.Println("Up to date:", pkgsUpToDate) fmt.Println("Up to date:", pkgsUpToDate)
fmt.Println("Missing script:", len(pkgsWithoutScript)) fmt.Println("Missing script:", len(pkgsWithoutScript))
fmt.Println("Ignored: ", len(pkgsIgnored))
fmt.Println("Errors:", len(pkgsWithError)) fmt.Println("Errors:", len(pkgsWithError))
} }