You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by st...@apache.org on 2017/03/09 23:15:50 UTC

[1/3] incubator-mynewt-newt git commit: Warns on unmatched pkg.name and pkg.path

Repository: incubator-mynewt-newt
Updated Branches:
  refs/heads/develop 23ce34bce -> 04972811d


Warns on unmatched pkg.name and pkg.path

Add a warning (in verbose mode, -v) if the pkg.name doesn't match the path.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/1193eccf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/1193eccf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/1193eccf

Branch: refs/heads/develop
Commit: 1193eccf6c89dec384d0578c19e968f351ff853e
Parents: 1fb9697
Author: Fabio Utzig <ut...@utzig.org>
Authored: Tue Mar 7 16:48:43 2017 -0300
Committer: Fabio Utzig <ut...@utzig.org>
Committed: Tue Mar 7 16:52:51 2017 -0300

----------------------------------------------------------------------
 newt/interfaces/interfaces.go |  1 +
 newt/pkg/package.go           |  2 ++
 newt/project/project.go       | 27 +++++++++++++++++++++++++++
 3 files changed, 30 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/1193eccf/newt/interfaces/interfaces.go
----------------------------------------------------------------------
diff --git a/newt/interfaces/interfaces.go b/newt/interfaces/interfaces.go
index 6d54f8a..c12b58b 100644
--- a/newt/interfaces/interfaces.go
+++ b/newt/interfaces/interfaces.go
@@ -22,6 +22,7 @@ package interfaces
 type PackageInterface interface {
 	Name() string
 	FullName() string
+	BasePath() string
 	Repo() RepoInterface
 	Type() PackageType
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/1193eccf/newt/pkg/package.go
----------------------------------------------------------------------
diff --git a/newt/pkg/package.go b/newt/pkg/package.go
index d5d9403..58bf523 100644
--- a/newt/pkg/package.go
+++ b/newt/pkg/package.go
@@ -71,6 +71,8 @@ type Package interface {
 	FullName() string
 	// The type of package (lib, target, bsp, etc.)
 	Type() interfaces.PackageType
+	// BasePath is the path on disk if it's a local package
+	BasePath() string
 	// Hash of the contents of the package
 	Hash() (string, error)
 	// Description of this package

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/1193eccf/newt/project/project.go
----------------------------------------------------------------------
diff --git a/newt/project/project.go b/newt/project/project.go
index cc68c30..cec5102 100644
--- a/newt/project/project.go
+++ b/newt/project/project.go
@@ -497,15 +497,42 @@ func (proj *Project) Init(dir string) error {
 	return nil
 }
 
+func matchNamePath(name, path string) bool {
+	// assure that name and path use the same path separator...
+	names := filepath.SplitList(name)
+	name = filepath.Join(names...)
+
+	if strings.HasSuffix(path, name) {
+		return true
+	}
+	return false
+}
+
 func (proj *Project) ResolveDependency(dep interfaces.DependencyInterface) interfaces.PackageInterface {
+	type NamePath struct {
+		name string
+		path string
+	}
+
+	var errorPkgs []NamePath
 	for _, pkgList := range proj.packages {
 		for _, pkg := range *pkgList {
+			name := pkg.Name()
+			path := pkg.BasePath()
+			if !matchNamePath(name, path) {
+				errorPkgs = append(errorPkgs, NamePath{name: name, path: path})
+			}
 			if dep.SatisfiesDependency(pkg) {
 				return pkg
 			}
 		}
 	}
 
+	for _, namepath := range errorPkgs {
+		util.StatusMessage(util.VERBOSITY_VERBOSE,
+			"Package name \"%s\" doesn't match path \"%s\"\n", namepath.name, namepath.path)
+	}
+
 	return nil
 }
 


[2/3] incubator-mynewt-newt git commit: Fix to print correct pkg dependecy

Posted by st...@apache.org.
Fix to print correct pkg dependecy


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/437fbb55
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/437fbb55
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/437fbb55

Branch: refs/heads/develop
Commit: 437fbb55c542c9d147e34446644b78cc79dc8c21
Parents: 1193ecc
Author: Fabio Utzig <ut...@utzig.org>
Authored: Tue Mar 7 18:29:49 2017 -0300
Committer: Fabio Utzig <ut...@utzig.org>
Committed: Tue Mar 7 18:29:49 2017 -0300

----------------------------------------------------------------------
 newt/resolve/resolve.go | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/437fbb55/newt/resolve/resolve.go
----------------------------------------------------------------------
diff --git a/newt/resolve/resolve.go b/newt/resolve/resolve.go
index 283e96c..6e03592 100644
--- a/newt/resolve/resolve.go
+++ b/newt/resolve/resolve.go
@@ -131,12 +131,12 @@ func NewResolvePkg(lpkg *pkg.LocalPackage) *ResolvePackage {
 	}
 }
 
-func (r *Resolver) resolveDep(dep *pkg.Dependency) (*pkg.LocalPackage, error) {
+func (r *Resolver) resolveDep(dep *pkg.Dependency, depender string) (*pkg.LocalPackage, error) {
 	proj := project.GetProject()
 
 	if proj.ResolveDependency(dep) == nil {
 		return nil, util.FmtNewtError("Could not resolve package dependency: "+
-			"%s; depender: %s", dep.String(), dep.Name)
+			"%s; depender: %s", dep.String(), depender)
 	}
 	lpkg := proj.ResolveDependency(dep).(*pkg.LocalPackage)
 
@@ -284,13 +284,14 @@ func (r *Resolver) loadDepsForPkg(rpkg *ResolvePackage) (bool, error) {
 	changed := false
 	newDeps := newtutil.GetStringSliceFeatures(rpkg.Lpkg.PkgV, features,
 		"pkg.deps")
+	depender := rpkg.Lpkg.Name()
 	for _, newDepStr := range newDeps {
 		newDep, err := pkg.NewDependency(rpkg.Lpkg.Repo(), newDepStr)
 		if err != nil {
 			return false, err
 		}
 
-		lpkg, err := r.resolveDep(newDep)
+		lpkg, err := r.resolveDep(newDep, depender)
 		if err != nil {
 			return false, err
 		}


[3/3] incubator-mynewt-newt git commit: This closes #52

Posted by st...@apache.org.
This closes #52

This adds a warning (when running in verbose mode) if a pkg.name is not equal to the current pkg path.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/04972811
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/04972811
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/04972811

Branch: refs/heads/develop
Commit: 04972811d14bcf5e5460de01a498db765004ff17
Parents: 23ce34b 437fbb5
Author: Sterling Hughes <st...@runtime.io>
Authored: Thu Mar 9 15:15:38 2017 -0800
Committer: Sterling Hughes <st...@runtime.io>
Committed: Thu Mar 9 15:15:38 2017 -0800

----------------------------------------------------------------------
 newt/interfaces/interfaces.go |  1 +
 newt/pkg/package.go           |  2 ++
 newt/project/project.go       | 27 +++++++++++++++++++++++++++
 newt/resolve/resolve.go       |  7 ++++---
 4 files changed, 34 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/04972811/newt/project/project.go
----------------------------------------------------------------------