Give error when failing to parse .SRCINFO

Instead of panicking later on.
This commit is contained in:
morganamilo 2018-02-18 14:48:49 +00:00
parent 0f3ccbce93
commit 4350752e32
No known key found for this signature in database
GPG key ID: 6FE9E7996B0B082E

View file

@ -280,7 +280,6 @@ func askEditPkgBuilds(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg) error {
}
func parsesrcinfos(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD) error {
for _, pkg := range pkgs {
dir := config.BuildDir + pkg.PackageBase + "/"
@ -294,16 +293,18 @@ func parsesrcinfos(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD) error {
}
pkgbuild, err := gopkg.ParseSRCINFOContent(srcinfo)
if err == nil {
srcinfos[pkg.PackageBase] = pkgbuild
if err != nil {
return fmt.Errorf("%s: %s", pkg.Name, err)
}
for _, pkgsource := range pkgbuild.Source {
owner, repo := parseSource(pkgsource)
if owner != "" && repo != "" {
err = branchInfo(pkg.Name, owner, repo)
if err != nil {
return err
}
srcinfos[pkg.PackageBase] = pkgbuild
for _, pkgsource := range pkgbuild.Source {
owner, repo := parseSource(pkgsource)
if owner != "" && repo != "" {
err = branchInfo(pkg.Name, owner, repo)
if err != nil {
return err
}
}
}