Fix ppp
This commit is contained in:
parent
bc609ee9e2
commit
dcfd766e59
22
src/main.go
22
src/main.go
@ -63,14 +63,13 @@ func processFile(url string) map[string]packageInfo {
|
|||||||
packages := make(map[string]packageInfo)
|
packages := make(map[string]packageInfo)
|
||||||
var currentPackage string
|
var currentPackage string
|
||||||
scanner := bufio.NewScanner(rdr)
|
scanner := bufio.NewScanner(rdr)
|
||||||
|
const maxCapacity = 4096 * 4096
|
||||||
|
buf := make([]byte, maxCapacity)
|
||||||
|
scanner.Buffer(buf, maxCapacity)
|
||||||
|
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
line := scanner.Text()
|
line := scanner.Text()
|
||||||
|
|
||||||
if line == "" {
|
|
||||||
currentPackage = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
if currentPackage == "" {
|
|
||||||
if strings.HasPrefix(line, "Package: ") {
|
if strings.HasPrefix(line, "Package: ") {
|
||||||
pkName := strings.TrimPrefix(line, "Package: ") + " "
|
pkName := strings.TrimPrefix(line, "Package: ") + " "
|
||||||
_, broken := brokenPackages[pkName]
|
_, broken := brokenPackages[pkName]
|
||||||
@ -82,9 +81,7 @@ func processFile(url string) map[string]packageInfo {
|
|||||||
} else {
|
} else {
|
||||||
currentPackage = ""
|
currentPackage = ""
|
||||||
}
|
}
|
||||||
}
|
} else if strings.HasPrefix(line, "Version: ") && currentPackage != "" {
|
||||||
} else {
|
|
||||||
if strings.HasPrefix(line, "Version: ") {
|
|
||||||
ver, err := version.Parse(strings.TrimPrefix(line, "Version: "))
|
ver, err := version.Parse(strings.TrimPrefix(line, "Version: "))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
@ -93,15 +90,17 @@ func processFile(url string) map[string]packageInfo {
|
|||||||
Name: currentPackage,
|
Name: currentPackage,
|
||||||
Version: ver,
|
Version: ver,
|
||||||
}
|
}
|
||||||
}
|
} else if strings.HasPrefix(line, "Filename: ") && currentPackage != "" {
|
||||||
if strings.HasPrefix(line, "Filename: ") {
|
|
||||||
packages[currentPackage] = packageInfo{
|
packages[currentPackage] = packageInfo{
|
||||||
Name: currentPackage,
|
Name: currentPackage,
|
||||||
Version: packages[currentPackage].Version,
|
Version: packages[currentPackage].Version,
|
||||||
FilePath: strings.TrimPrefix(line, "Filename: "),
|
FilePath: strings.TrimPrefix(line, "Filename: "),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if line == "" {
|
||||||
|
currentPackage = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return packages
|
return packages
|
||||||
}
|
}
|
||||||
@ -110,7 +109,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 version.Compare(info.Version, baseVersion.Version) > 0 {
|
if version.Compare(info.Version, baseVersion.Version) != 0 {
|
||||||
output[pack] = info
|
output[pack] = info
|
||||||
if !download {
|
if !download {
|
||||||
os.Stdout.WriteString(pack)
|
os.Stdout.WriteString(pack)
|
||||||
@ -232,5 +231,4 @@ var brokenPackages = map[string]bool{
|
|||||||
"libnvidia-common-390 ": true,
|
"libnvidia-common-390 ": true,
|
||||||
"libnvidia-common-530 ": true,
|
"libnvidia-common-530 ": true,
|
||||||
"midisport-firmware ": true,
|
"midisport-firmware ": true,
|
||||||
"librust-winapi-dev ": true,
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user