diff --git a/newt/newtutil/repo_version.go b/newt/newtutil/repo_version.go index b8516db6b..4569dba67 100644 --- a/newt/newtutil/repo_version.go +++ b/newt/newtutil/repo_version.go @@ -51,6 +51,7 @@ type RepoVersion struct { Revision int64 Stability string Commit string + Rc bool } func (v *RepoVersion) IsNormalized() bool { @@ -117,6 +118,10 @@ func (ver *RepoVersion) String() string { s += fmt.Sprintf("-%s", ver.Stability) } + if ver.Rc { + s += fmt.Sprintf(" (rc)") + } + return s } diff --git a/newt/repo/version.go b/newt/repo/version.go index bc31af2aa..8329e9da8 100644 --- a/newt/repo/version.go +++ b/newt/repo/version.go @@ -23,6 +23,7 @@ package repo import ( "mynewt.apache.org/newt/newt/downloader" + "regexp" "strings" log "github.com/sirupsen/logrus" @@ -196,9 +197,18 @@ func (r *Repo) HashFromVer(ver newtutil.RepoVersion) (string, error) { // commits exist, they are not considered here. func (r *Repo) VersFromCommit(commit string) []newtutil.RepoVersion { var vers []newtutil.RepoVersion + var rc bool + + restr := `rc\d+_tag` + re := regexp.MustCompile(restr) + if re.MatchString(commit) { + commit = re.ReplaceAllString(commit, "tag") + rc = true + } for v, c := range r.vers { if c == commit { + v.Rc = rc vers = append(vers, v) } }