}
// Will return false if stg is not installed.
-func (r Repo) IsStg(branch string) (bool) {
+func (r Repo) IsStg(branch string) bool {
_, err := r.stgCmd("series", "-b", branch)
return err == nil
}
return r.MakeBranch(branch, ref)
}
-
-
func (r Repo) Checkout(branch string) (out []byte, err error) {
out, err = r.gitCmd("checkout", branch)
if err == nil {
func outputToList(out []byte) (list []string) {
if len(out) > 0 {
list = strings.Split(string(out), "\n")
-
+
l := len(list)
if l > 0 && list[l-1] == "" {
list = list[:l-1]
}
tags = outputToList(out)
-
+
return
}
return
}
-
// Do a 'git am', and if it fails, clean up the tree
func (r Repo) AmClean(amglob string) (out []byte, err error) {
files, err := globToFullPath(amglob)
// Lazy version: Add it to the end then sort
m.SupportedVersions = append(m.SupportedVersions, v)
sort.Sort(m.SupportedVersions)
-
+
r.xsa = m.XSA
r.XenVersion = v
r.Recipes = make(map[Tree]*TreeRecipe)
type TreeRecipe struct {
StableRef string
- Prereqs []int
- Patches []string
+ Prereqs []int
+ Patches []string
}
func (tr *TreeRecipe) HasPatches() bool {
// Return 'true' if any tree recipe has patches
// FIXME: Should this be *all* specified tree recipes instead?
func (r *Recipe) HasPatches() (has bool) {
- r.ForEachTree(func (t Tree) error {
+ r.ForEachTree(func(t Tree) error {
tr := r.Recipes[t]
if tr.HasPatches() {
has = true
return fmt.Errorf("Making tempbranch %s for xenversion %v: %v\n",
branch, r.XenVersion)
}
-
+
for _, glob := range tr.Patches {
// git am
_, err = xr.AmClean(G.config.Tool.GetPath(TreeXSA) + "/" + glob)
fmt.Printf(" No patches for prereq xsa %d\n", xsanum)
continue
}
-
+
// git am the appropriate patches
for _, glob := range subtr.Patches {
_, err = xr.AmClean(G.config.Tool.GetPath(TreeXSA) + "/" + glob)
}
}
}
-
+
return
}
err = r.ForEachTree(apply)
-
+
return
}
_, fromBase, fromBranch := BranchName(prefix, r.xsa, r.XenVersion)
_, toBase, toBranch := BranchName(prefix, r.xsa, to)
-
+
backport := func(tree Tree) (err error) {
xr := G.repos.XenRepos[tree]
-
// git checkout -b xsa/NNN/$to xsa/NNN/$from
if err = xr.MakeBranch(toBranch, fromBranch); err != nil {
return fmt.Errorf("Making branch %v based on branch %v\n",
if _, err = xr.Rebase(toBranch, fromBase, toBase); err != nil {
return fmt.Errorf("Rebase failed. Finish rebase for %v and continue.", to)
}
-
+
return
}
return
}
-
-
func (r *Recipe) Build(prefix string) (err error) {
_, _, branch := r.branchName(prefix)
branches, err := xr.Branches("stable-*")
branches = append([]string{"master"}, branches...)
-
+
for _, branch := range branches {
- if _, err = xr.MergeDefault(branch) ; err != nil {
+ if _, err = xr.MergeDefault(branch); err != nil {
err = fmt.Errorf("Merging branch %s on tree %v: %v\n",
branch, tree, err)
}
return
}
-
+
if err := ForEachXenRepo(pull); err != nil {
fmt.Printf("Trying to update trees: %v\n", err)
return 1
}
-
+
return 0
}
// xsa : bff3883
var its = InitialTreeState{
- "xen": &map[string]string{
- "master":"ac9ff74",
+ "xen": &map[string]string{
+ "master": "ac9ff74",
"stable-4.8": "e0354e6",
"stable-4.7": "b5c7dea",
"stable-4.6": "bb92bb7",
"stable-4.5": "cde86fc",
"stable-4.4": "89bd1cf",
},
- "qemuu": &map[string]string{
- "master":"acde9f3",
+ "qemuu": &map[string]string{
+ "master": "acde9f3",
},
- "qemut": &map[string]string{
- "master":"8b4834e",
+ "qemut": &map[string]string{
+ "master": "8b4834e",
},
- "xsa": &map[string]string{
- "master":"bff3883",
+ "xsa": &map[string]string{
+ "master": "bff3883",
},
}
-
// Set up the repo in a known state.
func InitRepo(st *SystemTest) bool {
callRepoInit := true
if fullRef, err = r.ParseRef(shortRef); err != nil {
return err
}
-
- originRef := "refs/remotes/origin/"+branch
+
+ originRef := "refs/remotes/origin/" + branch
if _, err = r.SetRef(originRef, fullRef); err != nil {
return
}
expectedRef, stableRef)
pass = false
}
-
+
} else {
if prs {
st.Errorf("Unexpected tree: %v\n", tree)
if false && !Story206TestMaster(st) {
return false
}
-
+
// 206 Backport (should fail at 4.8. 4.7, and 4.6; NOT 4.5)
if !Story206Backport(st) {
return false
// Fail unless we make it through the gauntlet
ret = 1
-
+
// Store the toplevel directory
topdir, err := os.Getwd()
if err != nil {
} else {
fmt.Print("System test: PASSED\n")
}
-
+
return
}
func (xr *XenRepo) MakeStableBranch(v XenVersion) (err error) {
stableBranch := XenStableBranch(v)
-
+
branches, err := xr.Branches(stableBranch)
if err != nil {
return
v, stableBranch)
return
}
-
+
// This should automatically set things up correctly from origin
_, err = xr.Checkout(stableBranch)
return
}
-// Check out stable-$version (or 'master')
+// Check out stable-$version (or 'master')
func (xr *XenRepo) tagsToVersions(tags []string) (versions []XenVersionFull, err error) {
re := regexp.MustCompile("^" + xr.releaseTagPrefix() + "([0-9]+.[0-9]+.[0-9]+)$")
}
xsa.Trees = append(xsa.Trees, tree)
}
-
+
xsa.Recipes = make(map[XenVersion]*Recipe)
for v := range sm.Versions {
for _, t := range xsa.Trees {
var err error
-
+
xr := G.repos.XenRepos[t]
-
+
if err = xr.MakeStableBranch(v); err != nil {
fmt.Printf("Checking out stable branch for version %v: %v\n",
v, err)
// For if we ever add an "automatic build test option" instead
// from = to
}
-
+
fmt.Printf("Not implemented\n")
return 1
}