Add 'vercmp' subcommand for package version comparisons in scripts

This commit is contained in:
2025-12-08 16:08:55 +02:00
parent 1895fabfb0
commit 2c91a9332b
5 changed files with 29 additions and 10 deletions
-8
View File
@@ -17,7 +17,6 @@ import (
"strings"
"syscall"
version "github.com/knqyf263/go-rpm-version"
"gopkg.in/yaml.v3"
)
@@ -121,13 +120,6 @@ const (
InstallationReasonUnknown InstallationReason = "unknown"
)
func ComparePackageVersions(info1, info2 PackageInfo) int {
v1 := version.NewVersion(info1.GetFullVersion())
v2 := version.NewVersion(info2.GetFullVersion())
return v1.Compare(v2)
}
func GetInstallationReason(pkg, rootDir string) InstallationReason {
installedDir := path.Join(rootDir, "var/lib/bpm/installed/")
pkgDir := path.Join(installedDir, pkg)