baseline, r.XenVersion, err)
}
- // FIXME Apply previous patches
+ // Apply previous patches
for _, xsanum := range tr.Prereqs {
- err = fmt.Errorf("%d: Don't know how to apply XSA prerequisites yet!", xsanum)
- return
+ var xsa XSAMeta
+
+ // Load xsa file
+ // FIXME Might be nice not to have to re-load this for every tree
+ if err = xsa.Load(xsanum); err != nil {
+ err = fmt.Errorf("Loading prerequisite xsa %v metadata: %v\n",
+ xsanum, err)
+ return
+ }
+
+ // Check to see if there are any patches to apply
+ subr := xsa.GetRecipe(r.XenVersion)
+
+ subtr, prs := subr.Recipes[tree]
+
+ if !prs || !subtr.HasPatches() {
+ 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)
+ if err != nil {
+ return fmt.Errorf("Appling prerequiste xsa %d am %s: %v\n",
+ xsanum, glob, err)
+ }
+ }
}
return