From: George Dunlap Date: Thu, 8 Jun 2017 16:23:56 +0000 (+0100) Subject: recipe: Use StableBranch to create VVV-baseline branch X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=6651e4baa26a7efa8cd31ba7cd37d1667a9e0d1e;p=people%2Fgdunlap%2Fxsatool recipe: Use StableBranch to create VVV-baseline branch Get rid of XenVersionFull from the recipe and replace it with XenVersion for convenience. Signed-off-by: George Dunlap --- diff --git a/meta.go b/meta.go index 25cb8f7..66b98b0 100644 --- a/meta.go +++ b/meta.go @@ -225,14 +225,14 @@ func (m *XSAMeta) GetRecipe(v XenVersion) *Recipe { return m.Recipes[v] } -func (m *XSAMeta) NewRecipe(fv XenVersionFull) *Recipe { +func (m *XSAMeta) NewRecipe(v XenVersion) *Recipe { var r Recipe r.xsa = m.XSA - r.XenVersionFull = fv + r.XenVersion = v r.Recipes = make(map[Tree]*TreeRecipe) - m.Recipes[fv.XenVersion()] = &r + m.Recipes[v] = &r return &r } diff --git a/recipe.go b/recipe.go index c5d278c..56fc3e6 100644 --- a/recipe.go +++ b/recipe.go @@ -22,7 +22,7 @@ func (tr *TreeRecipe) HasPatches() bool { } type Recipe struct { - XenVersionFull + XenVersion Recipes map[Tree]*TreeRecipe xsa int } @@ -195,10 +195,10 @@ func (r *Recipe) MakePatches(prefix string, sync bool) (count int, err error) { xsabase += "-" + tree.String() } - if r.XenVersionFull == "master" { + if r.XenVersion == "master" { xsabase += "-unstable" } else { - xsabase += "-" + r.XenVersionFull.XenVersion().String() + xsabase += "-" + r.XenVersion.String() } xsatgt := G.config.Tool.GetPath(TreeXSA) + "/" + xsabase @@ -312,7 +312,7 @@ func BranchName(prefix string, xsa int, v XenVersion) (branch, baseline string) } func (r *Recipe) branchName(prefix string) (branch, baseline string) { - branch, baseline = BranchName(prefix, r.xsa, r.XenVersionFull.XenVersion()) + branch, baseline = BranchName(prefix, r.xsa, r.XenVersion) fmt.Printf("Branchnames: %s %s\n", branch, baseline) @@ -332,11 +332,12 @@ func (r *Recipe) branchName(prefix string) (branch, baseline string) { func (r *Recipe) apply(xr *XenRepo, tr *TreeRecipe, prefix string) (err error) { branch, baseline := r.branchName(prefix) - // Make "baseline" branch, based on XenVersionFull, with Prereq patches - err = xr.CheckoutVersion(r.XenVersionFull, baseline) + // FIXME change this to tr.StableRef + // Make "baseline" branch, based on XenVersion, with Prereq patches + err = xr.MakeBranch(baseline, tr.StableRef) if err != nil { return fmt.Errorf("Making baseline %s for xenversion %v: %v\n", - baseline, r.XenVersionFull) + baseline, r.XenVersion) } for _, xsanum := range tr.Prereqs { @@ -348,7 +349,7 @@ func (r *Recipe) apply(xr *XenRepo, tr *TreeRecipe, prefix string) (err error) { err = xr.MakeBranch(branch, baseline) if err != nil { return fmt.Errorf("Making tempbranch %s for xenversion %v: %v\n", - branch, r.XenVersionFull) + branch, r.XenVersion) } for _, glob := range tr.Patches { @@ -406,10 +407,10 @@ func (r *Recipe) Build(prefix string) (err error) { branch, err) } } else { - err = xenrepo.CheckoutVersion(r.XenVersionFull, tmpBranch) + err = xenrepo.MakeBranch(tmpBranch, XenStableBranch(r.XenVersion)) if err != nil { return fmt.Errorf("Making tempbranch %s for xenversion %v: %v\n", - tmpBranch, r.XenVersionFull) + tmpBranch, r.XenVersion) } } diff --git a/systemtest.go b/systemtest.go index 9e23d04..d86841a 100644 --- a/systemtest.go +++ b/systemtest.go @@ -288,10 +288,10 @@ func Story206Init(st *SystemTest) (pass bool) { pass = false } else { versions[v].seen = true - if versions[v].fv != r.XenVersionFull { - st.Errorf("Expected fullversion %v, got %v\n", - versions[v].fv, - r.XenVersionFull) + if v != r.XenVersion { + st.Errorf("Expected version %v, got %v\n", + v, + r.XenVersion) pass = false } ForEachCodeTree(func(tree Tree) error { diff --git a/test.go b/test.go index e394470..99bf0e8 100644 --- a/test.go +++ b/test.go @@ -4,40 +4,6 @@ import ( "fmt" ) -/* Backport: Apply & build if the branch doesn't exist / if override is set */ - -func backport(xsa *XSAMeta) (ret int) { - for i := range xsa.Recipes { - prefix := "xsa" - r := xsa.Recipes[i] - - if err := r.IsApplied(prefix); err != nil { - if _, isMissingBranch := err.(ErrorMissingBranch); !isMissingBranch { - fmt.Printf("Error checking to see if recipe has been applied: %v\n", err) - return 1 - } - - err = r.Apply(prefix) - if err != nil { - fmt.Printf("Applying recipe: %v\n", err) - fmt.Printf("FAILED: %v\n", r.XenVersionFull) - return 1 - } - - err = r.Build(prefix) - if err != nil { - fmt.Printf("Building recipe: %v\n", err) - fmt.Printf("FAILED: %v\n", r.XenVersionFull) - return 1 - } - fmt.Printf("SUCCESS: %v\n", r.XenVersionFull) - } - - } - - return 0 -} - func test(xsa *XSAMeta, args []string, apply bool, build bool) (ret int) { vers := VersionsFromArgs(xsa, args) @@ -59,7 +25,7 @@ func test(xsa *XSAMeta, args []string, apply bool, build bool) (ret int) { err := r.Apply(prefix) if err != nil { fmt.Printf("Applying recipe: %v\n", err) - fmt.Printf("FAILED: %v\n", r.XenVersionFull) + fmt.Printf("FAILED: %v\n", r.XenVersion) return 1 } } else { @@ -80,12 +46,12 @@ func test(xsa *XSAMeta, args []string, apply bool, build bool) (ret int) { err := r.Build(prefix) if err != nil { fmt.Printf("Building recipe: %v\n", err) - fmt.Printf("FAILED: %v\n", r.XenVersionFull) + fmt.Printf("FAILED: %v\n", r.XenVersion) return 1 } } - fmt.Printf("SUCCESS: %v\n", r.XenVersionFull) + fmt.Printf("SUCCESS: %v\n", r.XenVersion) } return 0 diff --git a/xen.go b/xen.go index 05aed1e..91d4e5d 100644 --- a/xen.go +++ b/xen.go @@ -210,14 +210,7 @@ func (xr *XenRepo) MakeStableBranch(v XenVersion) (err error) { return } -func (xr *XenRepo) CheckoutVersion(ver XenVersionFull, branchName string) (err error) { - tag := xr.GetTag(ver) - fmt.Printf("Creating branch %s based on tag %s\n", - branchName, tag) - err = xr.MakeBranch(branchName, tag) - return -} - +// 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]+)$") diff --git a/xsa.go b/xsa.go index a08d038..7b04631 100644 --- a/xsa.go +++ b/xsa.go @@ -60,7 +60,7 @@ func MainSyncBranch(xsa *XSAMeta, args []string) (ret int) { err := r.Apply(prefix) if err != nil { fmt.Printf("Applying recipe: %v\n", err) - fmt.Printf("FAILED: %v\n", r.XenVersionFull) + fmt.Printf("FAILED: %v\n", r.XenVersion) return 1 } } @@ -106,7 +106,7 @@ func MainInit(xsa *XSAMeta, args []string) (ret int) { xsa.SupportedVersions = append(xsa.SupportedVersions, v) - r := xsa.NewRecipe(vm.Latest) + r := xsa.NewRecipe(v) for _, t := range xsa.Trees { var err error