filter out all.deb for i386
This commit is contained in:
parent
31de084f32
commit
ad2790bc3e
14
src/main.go
14
src/main.go
@ -25,6 +25,7 @@ func main() {
|
||||
Source: os.Args[1],
|
||||
Target: os.Args[2],
|
||||
Download: false,
|
||||
Is32bit: false,
|
||||
}
|
||||
|
||||
if len(os.Args) > 3 {
|
||||
@ -33,10 +34,14 @@ func main() {
|
||||
config.Output = os.Args[4]
|
||||
}
|
||||
|
||||
if strings.Contains(config.Source, "i386") {
|
||||
config.Is32bit = true
|
||||
}
|
||||
|
||||
basePackages := processFile(config.Source)
|
||||
targetPackages := processFile(config.Target)
|
||||
|
||||
changed := compare(basePackages, targetPackages, config.Download)
|
||||
changed := compare(basePackages, targetPackages, config.Download, config.Is32bit)
|
||||
if config.Download {
|
||||
download(changed, config.DlUrl, config.Output)
|
||||
}
|
||||
@ -107,17 +112,17 @@ func processFile(url string) map[string]packageInfo {
|
||||
return packages
|
||||
}
|
||||
|
||||
func compare(basePackages map[string]packageInfo, targetPackages map[string]packageInfo, download bool) map[string]packageInfo {
|
||||
func compare(basePackages map[string]packageInfo, targetPackages map[string]packageInfo, download bool, is32bit bool) map[string]packageInfo {
|
||||
output := make(map[string]packageInfo)
|
||||
for pack, info := range targetPackages {
|
||||
if baseVersion, ok := basePackages[pack]; ok {
|
||||
if baseVersion.Version != info.Version {
|
||||
if baseVersion.Version != info.Version && (!is32bit || !strings.HasSuffix(info.FilePath, "all.deb")) {
|
||||
output[pack] = info
|
||||
if !download {
|
||||
os.Stdout.WriteString(pack)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else if !is32bit || !strings.HasSuffix(info.FilePath, "all.deb") {
|
||||
output[pack] = info
|
||||
if !download {
|
||||
os.Stdout.WriteString(pack)
|
||||
@ -248,6 +253,7 @@ type config struct {
|
||||
Download bool
|
||||
DlUrl string
|
||||
Output string
|
||||
Is32bit bool
|
||||
}
|
||||
|
||||
type packageInfo struct {
|
||||
|
Loading…
Reference in New Issue
Block a user