forked from ALHP/ALHP.GO
only write failed list if changed
This commit is contained in:
18
utils.go
18
utils.go
@@ -322,11 +322,13 @@ func isPkgFailed(pkg *BuildPackage) bool {
|
|||||||
failed := false
|
failed := false
|
||||||
var newContent []string
|
var newContent []string
|
||||||
scanner := bufio.NewScanner(file)
|
scanner := bufio.NewScanner(file)
|
||||||
|
found := false
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
line := scanner.Text()
|
line := scanner.Text()
|
||||||
splitPkg := strings.Split(line, "==")
|
splitPkg := strings.Split(line, "==")
|
||||||
|
|
||||||
if splitPkg[0] == pkg.Pkgbase {
|
if splitPkg[0] == pkg.Pkgbase {
|
||||||
|
found = true
|
||||||
pkgVer := constructVersion(pkg.Srcinfo.Pkgver, pkg.Srcinfo.Pkgrel, pkg.Srcinfo.Epoch)
|
pkgVer := constructVersion(pkg.Srcinfo.Pkgver, pkg.Srcinfo.Pkgrel, pkg.Srcinfo.Epoch)
|
||||||
|
|
||||||
// try to build new versions of previously failed packages
|
// try to build new versions of previously failed packages
|
||||||
@@ -340,15 +342,17 @@ func isPkgFailed(pkg *BuildPackage) bool {
|
|||||||
newContent = append(newContent, line+"\n")
|
newContent = append(newContent, line+"\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
check(scanner.Err())
|
check(scanner.Err())
|
||||||
sort.Strings(newContent)
|
|
||||||
|
|
||||||
_, err = file.Seek(0, 0)
|
if found {
|
||||||
check(err)
|
sort.Strings(newContent)
|
||||||
check(file.Truncate(0))
|
|
||||||
_, err = file.WriteString(strings.Join(newContent, ""))
|
_, err = file.Seek(0, 0)
|
||||||
check(err)
|
check(err)
|
||||||
|
check(file.Truncate(0))
|
||||||
|
_, err = file.WriteString(strings.Join(newContent, ""))
|
||||||
|
check(err)
|
||||||
|
}
|
||||||
|
|
||||||
return failed
|
return failed
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user