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/03/25 20:47:10 UTC

[mynewt-newt] branch master updated (e73b109 -> b8147e0)

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 e73b109  newt new: Infer latest "rc" tag for blinky
     new 2faa8ca  downloader: Return base commit if no rc tag
     new b8147e0  Use rc-tag-inference in inter-repo dependencies

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/downloader/downloader.go | 11 ++++++-----
 newt/install/install.go       |  5 +++++
 newt/repo/repo.go             |  2 +-
 3 files changed, 12 insertions(+), 6 deletions(-)


[mynewt-newt] 02/02: Use rc-tag-inference in inter-repo dependencies

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 b8147e0284cf75765799a79f6ec0f57a49542a50
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Tue Mar 24 16:54:37 2020 -0700

    Use rc-tag-inference in inter-repo dependencies
    
    A repo can specify dependencies in its `repository.yml` file, e.g.,
    
        repo.deps:
            apache-mynewt-nimble:
                type: github
                user: apache
                repo: mynewt-nimble
                vers:
                    mynewt_1_4_0_tag: 1.0.0
    
    The `mynewt_1_4_0_tag` tag of *this repo* depends on nimble 1.0.0.  If
    `mynewt_1_4_0_tag` does not exist, then `newt upgrade` would fail.
    
    The tag-validity check that newt was doing here was too strict.  If the
    specified tag doesn't exist, newt should attempt rc-tag-inference.  For
    example, if `mynewt_1_4_0_tag` does not exist, newt should check for the
    latest corresponding rc tag (e.g., `mynewt_1_4_0_rc1_tag`).  If one is
    found, then the dependency list is valid after all.
    
    Newt already applies this rc-tag-inference procedure when it actually
    performs the upgrade.  However, the check that happens before the
    upgrade was not using rc-tag-inference.  This commit adds
    rc-tag-inference to this check.
---
 newt/install/install.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/newt/install/install.go b/newt/install/install.go
index 5bc5f0c..c26e956 100644
--- a/newt/install/install.go
+++ b/newt/install/install.go
@@ -423,6 +423,11 @@ func (inst *Installer) calcVersionMap(candidates []*repo.Repo) (
 
 	for _, r := range repoList {
 		for commit, _ := range r.CommitDepMap() {
+			commit, err := r.Downloader().LatestRc(r.Path(), commit)
+			if err != nil {
+				return nil, err
+			}
+
 			equiv, err := r.Downloader().CommitsFor(r.Path(), commit)
 			if err != nil {
 				return nil, err


[mynewt-newt] 01/02: downloader: Return base commit if no rc tag

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 2faa8ca9b2670b724d396d7affd3b88d71d2b089
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Tue Mar 24 16:54:46 2020 -0700

    downloader: Return base commit if no rc tag
    
    downloader.LatestRc() infers the latest "rc" tag given a base string
    (e.g., "mynewt_1_8_0_tag" might resolve to "mynewt_1_8_0_rc3_tag").
    
    If there are no rc tags for the given base, this function used to return
    "".  This is error prone and it requires the caller to stash the base
    string until he has inspected the return value.
    
    This commit changes this function so that it returns the base string
    unmodified if there are no rc tags.
---
 newt/downloader/downloader.go | 11 ++++++-----
 newt/repo/repo.go             |  2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/newt/downloader/downloader.go b/newt/downloader/downloader.go
index 506b798..2230db1 100644
--- a/newt/downloader/downloader.go
+++ b/newt/downloader/downloader.go
@@ -728,14 +728,11 @@ func (gd *GenericDownloader) LatestRc(path string,
 
 	notag := strings.TrimSuffix(base, "_tag")
 	if notag == base {
-		return "", nil
+		return base, nil
 	}
 
 	restr := fmt.Sprintf("^%s_rc(\\d+)_tag$", regexp.QuoteMeta(notag))
-	re, err := regexp.Compile(restr)
-	if err != nil {
-		return "", util.FmtNewtError("internal error: %s", err.Error())
-	}
+	re := regexp.MustCompile(restr)
 
 	bestNum := -1
 	bestStr := ""
@@ -750,6 +747,10 @@ func (gd *GenericDownloader) LatestRc(path string,
 		}
 	}
 
+	if bestStr == "" {
+		bestStr = base
+	}
+
 	return bestStr, nil
 }
 
diff --git a/newt/repo/repo.go b/newt/repo/repo.go
index 0770c90..5f1ccce 100644
--- a/newt/repo/repo.go
+++ b/newt/repo/repo.go
@@ -291,7 +291,7 @@ func (r *Repo) updateRepo(commit string) error {
 				"Error updating \"%s\": %s", r.Name(), err.Error())
 		}
 
-		if newCommit != "" {
+		if newCommit != commit {
 			util.StatusMessage(util.VERBOSITY_DEFAULT,
 				"in repo \"%s\": commit \"%s\" does not exist; "+
 					"using \"%s\" instead\n",