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 9a05103 newt upgrade: Fix Repo Commit Checkout
9a05103 is described below
commit 9a05103892a35d44a3c15161181051109ee21245
Author: Naveen Kaje <[email protected]>
AuthorDate: Fri Oct 11 12:58:35 2019 -0500
newt upgrade: Fix Repo Commit Checkout
Checking out various repositories to a particular set of commit versions
is broken. Fix this by looking at the dependency graph's node's
required versions.
Example Usage in repository.yml
```
repo.versions:
"0.0.0" : "master"
"1.0.0" : "release_1_0_0"
repo.deps:
apache-mynewt-core:
type: git
url: [email protected]:apache/mynewt-core.git
vers:
master: 0-dev
release_1_0_0: 'f3d0ff2ab8db0da99f6b35938caf25c36950e181-commit'
apache-mynewt-nimble:
type: git
url: [email protected]:apache/mynewt-nimble.git
vers:
master: 0-dev
release_1_0_0: '7624744d90c159b8c9ab0bf3d890b0c3a3c43928-commit'
```
Note that the version specifier (such as `release_1_0_0`) can be a tag.
The project that houses this repository.yml gets checked out to
`release_1_0_0` and the dependencies get checked out to the versions
specified as shown above.
Signed-off-by: Naveen Kaje <[email protected]>
---
newt/install/install.go | 31 +++++++++++++++++++++----------
1 file changed, 21 insertions(+), 10 deletions(-)
diff --git a/newt/install/install.go b/newt/install/install.go
index 9d25b27..b71a265 100644
--- a/newt/install/install.go
+++ b/newt/install/install.go
@@ -646,18 +646,29 @@ func (inst *Installer) calcVersionMap(candidates
[]*repo.Repo) (
return nil, deprepo.ConflictError(conflicts)
}
- // If project.yml specified any specific git commits, ensure we get
them.
+ // Check all repo dependencies for specified git commits, ensure we get
them.
+ rg := dg.Reverse()
for name, ver := range vm {
- reqs := inst.reqs[name]
- if len(reqs) > 0 {
- keep, err := inst.shouldKeepCommit(name,
reqs[0].Ver.Commit)
- if err != nil {
- return nil, err
- }
- if keep {
- ver.Commit = reqs[0].Ver.Commit
+ for _, node := range rg[name] {
+ if len(node.VerReqs) > 0 {
+ for _, vreq := range node.VerReqs {
+ if vreq.Ver.Commit != "" {
+ keep, err :=
inst.shouldKeepCommit(name, vreq.Ver.Commit)
+ if err != nil {
+ return nil, err
+ }
+ if keep {
+ if ver.Commit == "" {
+ ver.Commit =
vreq.Ver.Commit
+ } else {
+ return nil,
util.FmtNewtError("repo %s: multiple commits %s and %s",
+ name,
ver.Commit, vreq.Ver.Commit)
+ }
+ }
+ vm[name] = ver
+ }
+ }
}
- vm[name] = ver
}
}