From 4350752e328ec69b6c5568714de2b356da937bc5 Mon Sep 17 00:00:00 2001 From: morganamilo Date: Sun, 18 Feb 2018 14:48:49 +0000 Subject: [PATCH] Give error when failing to parse .SRCINFO Instead of panicking later on. --- install.go | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/install.go b/install.go index c493feb4..25178b41 100644 --- a/install.go +++ b/install.go @@ -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 } } }