mirror of
https://github.com/EnumeratedDev/bpm.git
synced 2026-10-31 19:01:48 +00:00
Improved version comparison
This commit is contained in:
1 parent
2d35ac12a1
commit
e6cfd112ea
4 files changed
+29
-8
No files matched your search
@@ -6,6 +6,7 @@ import (
|
||||
"compress/gzip"
|
||||
"errors"
|
||||
"fmt"
|
||||
version "github.com/knqyf263/go-rpm-version"
|
||||
"gopkg.in/yaml.v3"
|
||||
"io"
|
||||
"io/fs"
|
||||
@@ -48,6 +49,13 @@ const (
|
||||
Unknown 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)
|
||||
|
||||
Reference in new issue
Block a user