You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2017/10/28 00:50:33 UTC
[GitHub] ccollins476ad closed pull request #105: MYNEWT-860 Newt - Empty `pkg.yml` issues.
ccollins476ad closed pull request #105: MYNEWT-860 Newt - Empty `pkg.yml` issues.
URL: https://github.com/apache/mynewt-newt/pull/105
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/newt/pkg/localpackage.go b/newt/pkg/localpackage.go
index 7a6beb4..7919a06 100644
--- a/newt/pkg/localpackage.go
+++ b/newt/pkg/localpackage.go
@@ -294,8 +294,7 @@ func (pkg *LocalPackage) Save() error {
return nil
}
-// Load reads everything that isn't identity specific into the
-// package
+// Load reads everything that isn't identity specific into the package
func (pkg *LocalPackage) Load() error {
// Load configuration
log.Debugf("Loading configuration for package %s", pkg.basePath)
@@ -311,6 +310,11 @@ func (pkg *LocalPackage) Load() error {
// Set package name from the package
pkg.name = pkg.PkgV.GetString("pkg.name")
+ if pkg.name == "" {
+ return util.FmtNewtError(
+ "Package \"%s\" missing \"pkg.name\" field in its `pkg.yml` file",
+ pkg.basePath)
+ }
typeString := pkg.PkgV.GetString("pkg.type")
pkg.packageType = PACKAGE_TYPE_LIB
@@ -387,6 +391,11 @@ func (pkg *LocalPackage) Clone(newRepo *repo.Repo,
func LoadLocalPackage(repo *repo.Repo, pkgDir string) (*LocalPackage, error) {
pkg := NewLocalPackage(repo, pkgDir)
err := pkg.Load()
+ if err != nil {
+ err = util.FmtNewtError("%s; ignoring package.", err.Error())
+ return nil, err
+ }
+
return pkg, err
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services