You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2019/11/26 19:01:52 UTC

[mynewt-newt] branch master updated: install: in conflict detection, ignore unused vers

This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git


The following commit(s) were added to refs/heads/master by this push:
     new be434b5  install: in conflict detection, ignore unused vers
be434b5 is described below

commit be434b5c9f938d37215b77cad774ac1a56d3af07
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Mon Nov 25 09:49:42 2019 -0800

    install: in conflict detection, ignore unused vers
    
    Newt reports a conflict and aborts an upgrade if there are dependencies
    on different commit hashes of the same repo.  The check for this kind of
    conflict was not correct - it was including dependencies from versions
    of repos that aren't even part of the build.
    
    This commit fixes the check such that only the used versions of each
    repo are considered.
---
 newt/install/install.go | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/newt/install/install.go b/newt/install/install.go
index 756ce86..dd2909f 100644
--- a/newt/install/install.go
+++ b/newt/install/install.go
@@ -610,7 +610,10 @@ func (inst *Installer) assignCommits(vm deprepo.VersionMap, repoName string,
 			}
 
 			if keep {
-				if !override && vm[repoName].Commit != "" {
+				prevCommit := vm[repoName].Commit
+				newCommit := req.Ver.Commit
+
+				if !override && prevCommit != "" && prevCommit != newCommit {
 					return util.FmtNewtError(
 						"repo %s: multiple commits: %s, %s",
 						repoName, vm[repoName].Commit, req.Ver.Commit)
@@ -683,8 +686,10 @@ func (inst *Installer) calcVersionMap(candidates []*repo.Repo) (
 	rg := dg.Reverse()
 	for name, nodes := range rg {
 		for _, node := range nodes {
-			if err := inst.assignCommits(vm, name, node.VerReqs, false); err != nil {
-				return nil, err
+			if newtutil.CompareRepoVersions(node.Ver, vm[node.Name]) == 0 {
+				if err := inst.assignCommits(vm, name, node.VerReqs, false); err != nil {
+					return nil, err
+				}
 			}
 		}
 	}