This could also be useful, for example, if prerequisites are manually
added or removed.
+## Pulling in new versions of upstream repos
+
+`xsatool repo update`
+
+For each tree, this will do a fetch, then go through `master` and any
+branch named `stable-*` and to a 'merge'.
+
+## Updating the 'base' of an outstanding XSA when the stable branches have changed
+
+`xsatool NNN reset-base [versions]`
+
+For each version, this will update StableRef to point to the current
+value of the 'stable' branch (either `master` or `stable-VV`). It
+will then re-apply the patch and any prerequisites as-is (i.e., *not*
+doing a rebase), failing out in case of an error.
+
# Potential future functionality
## Automatically de-duplicating patches
return ForEachCodeTree(f2)
}
+// Convert argument list into a set of versions:
+// - If no versions exist, use SupportedVersions from metadata
+// - If hasPatches is true, include only versions which have patches; otherwise
+// include all of them.
+// - Otherwise add the list of versions in order
func VersionsFromArgs(xsa *XSAMeta, args []string, hasPatches bool) (vers []XenVersion) {
if len(args) == 0 || (len(args) == 1 && args[0] == "all") {
for _, v := range xsa.SupportedVersions {
// Check to see if the branch exists
if hasPatches && !xsa.RepoHasPatches(v) {
+ // FIXME: Should this be "break" instead?
continue
}
vers = append(vers, v)
main = MainTest
loadConfig = true
loadXSA = true
+ case "reset-base":
+ main = MainResetBase
+ loadConfig = true
+ loadXSA = true
default:
fmt.Printf("Unknown command: %s\n", cmd)
return 1
return
}
+// NB this leaves the tree in a non-deterministic state
func (xr *XenRepo) MakeStableBranch(v XenVersion) (err error) {
stableBranch := XenStableBranch(v)
}
// xsatool NNN backport-fixup [version]
+
+// xsatool NNN reset-base [versions]
+func MainResetBase(xsa *XSAMeta, args []string) (ret int) {
+ // Starting with master:
+ // -- Re-set stableref to upstream
+ // -- Re-apply recipe
+
+
+ vers := VersionsFromArgs(xsa, args, false)
+
+ for _, v := range vers {
+ r := xsa.GetRecipe(v)
+ if r == nil {
+ fmt.Printf("Couldn't find recipe for XenVersion %s\n", v)
+ return 1
+ }
+
+ fmt.Printf("Resetting base for version %v\n", v)
+
+ 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 tree %v version %v: %v\n",
+ t, v, err)
+ return 1
+ }
+
+ tr, prs := r.Recipes[t]
+
+ if !prs {
+ err = fmt.Errorf("Internal data error: no recipe for tree %s\n", t)
+ return
+ }
+
+ tr.StableRef, err = xr.GetRefVersion(v)
+ if err != nil {
+ fmt.Printf("Getting ref for stable version %v: %v\n",
+ v, err)
+ }
+ }
+
+ if err := r.ApplyAll("xsa"); err != nil {
+ fmt.Printf("Making recipe baseline for version %v: %v\n", v, err)
+ return 1
+ }
+ }
+
+ if err := xsa.Save(); err != nil {
+ fmt.Printf("Saving xsa: %v\n", err)
+ return 1
+ }
+
+ return
+}