only update for newer versions
This commit is contained in:
parent
45634ba02d
commit
d93765e41e
@ -5,3 +5,5 @@ go 1.21.0
|
|||||||
require github.com/ulikunitz/xz v0.5.11
|
require github.com/ulikunitz/xz v0.5.11
|
||||||
|
|
||||||
require github.com/klauspost/compress v1.16.7
|
require github.com/klauspost/compress v1.16.7
|
||||||
|
|
||||||
|
require pault.ag/go/debian v0.15.0 // indirect
|
||||||
|
@ -2,3 +2,5 @@ github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGC
|
|||||||
github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
||||||
github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8=
|
github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8=
|
||||||
github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
|
github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
|
||||||
|
pault.ag/go/debian v0.15.0 h1:x2VLkGx/nTvGdgW0+FzFSgQZKt7zo9zSVYkikRjNTns=
|
||||||
|
pault.ag/go/debian v0.15.0/go.mod h1:JFl0XWRCv9hWBrB5MDDZjA5GSEs1X3zcFK/9kCNIUmE=
|
||||||
|
11
src/main.go
11
src/main.go
@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/klauspost/compress/gzip"
|
"github.com/klauspost/compress/gzip"
|
||||||
|
|
||||||
"github.com/ulikunitz/xz"
|
"github.com/ulikunitz/xz"
|
||||||
|
"pault.ag/go/debian/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -101,9 +102,13 @@ func processFile(url string) map[string]packageInfo {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if strings.HasPrefix(line, "Version: ") {
|
if strings.HasPrefix(line, "Version: ") {
|
||||||
|
ver, err := version.Parse(strings.TrimPrefix(line, "Version: "))
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
packages[currentPackage] = packageInfo{
|
packages[currentPackage] = packageInfo{
|
||||||
Name: currentPackage,
|
Name: currentPackage,
|
||||||
Version: strings.TrimPrefix(line, "Version: "),
|
Version: ver,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(line, "Filename: ") {
|
if strings.HasPrefix(line, "Filename: ") {
|
||||||
@ -122,7 +127,7 @@ func compare(basePackages map[string]packageInfo, targetPackages map[string]pack
|
|||||||
output := make(map[string]packageInfo)
|
output := make(map[string]packageInfo)
|
||||||
for pack, info := range targetPackages {
|
for pack, info := range targetPackages {
|
||||||
if baseVersion, ok := basePackages[pack]; ok {
|
if baseVersion, ok := basePackages[pack]; ok {
|
||||||
if baseVersion.Version != info.Version && (!is32bit || !strings.HasSuffix(info.FilePath, "all.deb")) {
|
if version.Compare(info.Version, baseVersion.Version) > 0 && (!is32bit || !strings.HasSuffix(info.FilePath, "all.deb")) {
|
||||||
output[pack] = info
|
output[pack] = info
|
||||||
if !download {
|
if !download {
|
||||||
os.Stdout.WriteString(pack)
|
os.Stdout.WriteString(pack)
|
||||||
@ -298,7 +303,7 @@ type config struct {
|
|||||||
|
|
||||||
type packageInfo struct {
|
type packageInfo struct {
|
||||||
Name string
|
Name string
|
||||||
Version string
|
Version version.Version
|
||||||
FilePath string
|
FilePath string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user