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 2016/12/06 01:29:04 UTC
[1/2] incubator-mynewt-newt git commit: newt - Continue reading pkgs
on repo read error.
Repository: incubator-mynewt-newt
Updated Branches:
refs/heads/develop 7407ff141 -> 8e6024c5a
newt - Continue reading pkgs on repo read error.
The process of populating the package list was aborting when there was a
repo read error. This left newt with an incomplete package list.
Worse, the order that repos get read in is indeterminate, so the results
were inconsistent.
Now, newt prints a warning message when there is a repo read error, but
continues reading the remaining repositories.
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/9b02be47
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/9b02be47
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/9b02be47
Branch: refs/heads/develop
Commit: 9b02be47de76d2c4ca6845ac0a1595dee7277587
Parents: 7407ff1
Author: Christopher Collins <cc...@apache.org>
Authored: Mon Dec 5 16:56:46 2016 -0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Mon Dec 5 16:59:02 2016 -0800
----------------------------------------------------------------------
newt/project/project.go | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/9b02be47/newt/project/project.go
----------------------------------------------------------------------
diff --git a/newt/project/project.go b/newt/project/project.go
index e7fe60d..5d9d7e3 100644
--- a/newt/project/project.go
+++ b/newt/project/project.go
@@ -585,7 +585,10 @@ func (proj *Project) loadPackageList() error {
for name, repo := range repos {
list, warnings, err := pkg.ReadLocalPackages(repo, repo.Path())
if err != nil {
- return err
+ /* Failed to read the repo's package list. Report the failure as a
+ * warning and move on to the next repo.
+ */
+ util.StatusMessage(util.VERBOSITY_QUIET, err.Error())
} else {
proj.packages[name] = list
}
[2/2] incubator-mynewt-newt git commit: MYNEWT-504 newt - Verify repo
isn't too old
Posted by cc...@apache.org.
MYNEWT-504 newt - Verify repo isn't too old
Check if the specified repo is compatible with this version of newt.
This function only verifies that the repo is new enough; it doesn't
check that newt is new enough. Verifying the opposite case would
require some larger changes.
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/8e6024c5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/8e6024c5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/8e6024c5
Branch: refs/heads/develop
Commit: 8e6024c5a2144a508f1064f8a32facb50cc11051
Parents: 9b02be4
Author: Christopher Collins <cc...@apache.org>
Authored: Mon Dec 5 17:27:59 2016 -0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Mon Dec 5 17:27:59 2016 -0800
----------------------------------------------------------------------
newt/newtutil/newtutil.go | 17 ++++++++++++
newt/repo/repo.go | 59 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 76 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/8e6024c5/newt/newtutil/newtutil.go
----------------------------------------------------------------------
diff --git a/newt/newtutil/newtutil.go b/newt/newtutil/newtutil.go
index f10c9d5..2c433fd 100644
--- a/newt/newtutil/newtutil.go
+++ b/newt/newtutil/newtutil.go
@@ -39,6 +39,23 @@ var NewtBlinkyTag string = "develop"
const NEWTRC_DIR string = ".newt"
const REPOS_FILENAME string = "repos.yml"
+const CORE_REPO_NAME string = "apache-mynewt-core"
+
+type RepoCommitEntry struct {
+ Version string
+ Hash string
+}
+
+// A warning is displayed if newt requires a newer version of a repo.
+var RepoMinCommits = map[string]*RepoCommitEntry{
+ // Newt no longer invokes the shell for external commands. Some YAML files
+ // in core had to be fixed to accommodate this change.
+ CORE_REPO_NAME: &RepoCommitEntry{
+ Version: "develop",
+ Hash: "5c5a987ef72ae9b3eb682f19d7d0bdc85f7e500c",
+ },
+}
+
// Contains general newt settings read from $HOME/.newt
var newtrc *viper.Viper
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/8e6024c5/newt/repo/repo.go
----------------------------------------------------------------------
diff --git a/newt/repo/repo.go b/newt/repo/repo.go
index 25c0d94..83ff137 100644
--- a/newt/repo/repo.go
+++ b/newt/repo/repo.go
@@ -31,6 +31,7 @@ import (
"mynewt.apache.org/newt/newt/downloader"
"mynewt.apache.org/newt/newt/interfaces"
+ "mynewt.apache.org/newt/newt/newtutil"
"mynewt.apache.org/newt/util"
"mynewt.apache.org/newt/viper"
)
@@ -51,6 +52,10 @@ type Repo struct {
ignDirs []string
updated bool
local bool
+
+ // The minimim git commit the repo must have to interoperate with this
+ // version of newt.
+ minCommit *newtutil.RepoCommitEntry
}
type RepoDesc struct {
@@ -551,6 +556,44 @@ func (r *Repo) ReadDesc() (*RepoDesc, []*Repo, error) {
return rdesc, repos, nil
}
+// Checks if the specified repo is compatible with this version of newt. This
+// function only verifies that the repo is new enough; it doesn't check that
+// newt is new enough.
+func (r *Repo) HasMinCommit() (bool, error) {
+ if r.minCommit == nil {
+ return true, nil
+ }
+
+ // Change back to the initial directory when this function returns.
+ cwd, err := os.Getwd()
+ if err != nil {
+ return false, util.ChildNewtError(err)
+ }
+ defer os.Chdir(cwd)
+
+ if err := os.Chdir(r.localPath); err != nil {
+ return false, util.ChildNewtError(err)
+ }
+
+ cmd := []string{
+ "git",
+ "rev-list",
+ r.minCommit.Hash + "..HEAD",
+ }
+
+ o, err := util.ShellCommand(cmd, nil)
+ if err != nil {
+ return false, util.ChildNewtError(err)
+ }
+
+ if len(o) == 0 {
+ // No output means the commit does not exist in the current branch.
+ return false, nil
+ }
+
+ return true, nil
+}
+
func (r *Repo) Init(repoName string, rversreq string, d downloader.Downloader) error {
var err error
@@ -568,6 +611,22 @@ func (r *Repo) Init(repoName string, rversreq string, d downloader.Downloader) e
r.localPath = filepath.Clean(path)
} else {
r.localPath = filepath.Clean(path + "/" + REPOS_DIR + "/" + r.name)
+ r.minCommit = newtutil.RepoMinCommits[repoName]
+
+ upToDate, err := r.HasMinCommit()
+ if err != nil {
+ return err
+ }
+
+ if !upToDate {
+ util.StatusMessage(util.VERBOSITY_QUIET,
+ "Warning: repo \"%s\" is out of date for this version of "+
+ "newt. Please upgrade the repo to meet these "+
+ "requirements:\n"+
+ " * Version: %s\n"+
+ " * Commit: %s\n",
+ r.name, r.minCommit.Version, r.minCommit.Hash)
+ }
}
return nil