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 2020/01/16 00:24:28 UTC

[mynewt-newt] branch master updated (3330958 -> c9b5137)

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

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


    from 3330958  Include repo name in compat map warning
     new 4655fa1  Sort result of VersionMap.String()
     new c9b5137  Allow repo hash to correspond to version number

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 newt/deprepo/deprepo.go |  6 ++++--
 newt/install/install.go | 40 ++++------------------------------------
 2 files changed, 8 insertions(+), 38 deletions(-)


[mynewt-newt] 01/02: Sort result of VersionMap.String()

Posted by cc...@apache.org.
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

commit 4655fa1d214df01d20e3cfe831c56e75b7eec2d8
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Mon Jan 13 16:08:58 2020 -0800

    Sort result of VersionMap.String()
---
 newt/deprepo/deprepo.go | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/newt/deprepo/deprepo.go b/newt/deprepo/deprepo.go
index c6878dc..f42a5d7 100644
--- a/newt/deprepo/deprepo.go
+++ b/newt/deprepo/deprepo.go
@@ -75,11 +75,13 @@ func (rm RepoMap) Sorted() []*repo.Repo {
 func (vm VersionMap) String() string {
 	s := ""
 
-	for repoName, ver := range vm {
+	names := vm.SortedNames()
+	for _, name := range names {
+		ver := vm[name]
 		if len(s) > 0 {
 			s += "\n"
 		}
-		s += fmt.Sprintf("%s:%s", repoName, ver.String())
+		s += fmt.Sprintf("%s:%s", name, ver.String())
 	}
 	return s
 }


[mynewt-newt] 02/02: Allow repo hash to correspond to version number

Posted by cc...@apache.org.
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

commit c9b5137025e8081b34401bfefed1ccef56287eb1
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Mon Jan 13 17:18:52 2020 -0800

    Allow repo hash to correspond to version number
    
    When resolving repo versions, newt uses this procedure:
    
    1. Resolve inter-repo dependencies.
    2. Resolve project.yml dependencies. Allow project.yml to override
    dependencies from step 1.
    
    There was a bug affecting both steps in the procedure.  If a dependency
    specifies a commit hash that corresponds exactly to a version number,
    then the dependency was ignored.
    
    This commit fixes the problem so that commit hashes are always honored,
    whether or not they correspond to version numbers.
---
 newt/install/install.go | 40 ++++------------------------------------
 1 file changed, 4 insertions(+), 36 deletions(-)

diff --git a/newt/install/install.go b/newt/install/install.go
index 7ce2792..313b759 100644
--- a/newt/install/install.go
+++ b/newt/install/install.go
@@ -527,35 +527,6 @@ func (inst *Installer) installPrompt(vm deprepo.VersionMap, op installOp,
 	}
 }
 
-// Determines whether a repo version's `Commit` field should be maintained.  If
-// the commit corresponds exactly to a repo version in `repository.yml` (as
-// opposed to simply indicating its version in a `version.yml` file), then the
-// commit string should be discarded.  If the commit string is kept, newt
-// interprets the version as being different from the official release version,
-// triggering an upgrade.
-func (inst *Installer) shouldKeepCommit(
-	repoName string, commit string) (bool, error) {
-
-	if commit == "" {
-		return false, nil
-	}
-
-	r := inst.repos[repoName]
-	if r == nil {
-		return false, nil
-	}
-
-	vers, err := r.VersFromEquivCommit(commit)
-	if err != nil {
-		return false, err
-	}
-	if len(vers) > 0 {
-		return false, nil
-	}
-
-	return true, nil
-}
-
 // Filters out repos from a version map, keeping only those which are present
 // in the supplied slice.
 func filterVersionMap(
@@ -604,12 +575,7 @@ func (inst *Installer) assignCommits(vm deprepo.VersionMap, repoName string,
 	for _, req := range reqs {
 		curVer := vm[repoName]
 		if curVer.Satisfies(req) {
-			keep, err := inst.shouldKeepCommit(repoName, req.Ver.Commit)
-			if err != nil {
-				return err
-			}
-
-			if keep {
+			if req.Ver.Commit != "" {
 				prevCommit := vm[repoName].Commit
 				newCommit := req.Ver.Commit
 
@@ -676,7 +642,6 @@ func (inst *Installer) calcVersionMap(candidates []*repo.Repo) (
 	// Try to find a version set that satisfies the dependency graph.  If no
 	// such set exists, report the conflicts and abort.
 	vm, conflicts := deprepo.FindAcceptableVersions(m, dg)
-	log.Debugf("Repo version map:\n%s\n", vm.String())
 	if len(conflicts) > 0 {
 		return nil, deprepo.ConflictError(conflicts)
 	}
@@ -702,6 +667,9 @@ func (inst *Installer) calcVersionMap(candidates []*repo.Repo) (
 		}
 	}
 
+	log.Debugf("repo version map after project.yml overrides:\n%s",
+		vm.String())
+
 	// Now that we know which repo versions we want, we can eliminate some
 	// false-positives from the repo list.
 	repoList = inst.ensureDepsInList(candidates, vm)