The `--mirrordir` or `--git-proxy` arguments can be used to specify a
cache used for git clones *during build*.
+- Finally, it will set up some useful "build sequences" (series of
+pre-set commands used to do the builds), and set the default.
+
## Creating the initial global metadata
`xsatool global update`
Individual versions can be specified as well: `xsatool 213 test-apply 4.6 4.5`
-`xsatool 213 test-build [<versionlist>]`
+`xsatool 213 test-build [-buildsequence <buildsequence> | <versionlist>]`
For each version in `<versionlist>`, it will attempt to check out a
tree based on `test/213/$v` and do a build. If the branch does not
exist it will throw an error. (If no `<versionlist>` is supplied, it
defaults to `all`.) Output will be redirected to `build.log`.
-`xsatool 213 test [<versionlist>]`
+`xsatool 213 test [-buildsequence <buildsequence> | <versionlist>]`
Do both `test-apply` and `test-build` (i.e., a full test) for each
version.
+## Build sequences
+
+When `xsatool` tests a build, it executes a sequence of commands. The
+default sequence is: `./configure`, then `make -j 8`.
+
+Other sequences can be defined in the `.xsatool` file. Alternate build sequences
+can be specified by name; for example:
+
+ xsatool 213 test master -buildsequence xen
+
+Will attempt to apply the XSA-213 recipe to master, and then run the
+`xen` build sequence as defined in the `.xsatool` config file.
+
+You might do this in order to speed up testing (if all the changes are
+in Xen and you want to do a quick sanity-check rather than full
+builds), or to avoid having to install extraneous dependencies (for
+instance, if your build fails due to missing newlib dependencies which
+have nothing to do with the patch you're trying to test).
+
+`xen repo init` will pre-define several recipes:
+
+* `simple`: "Plain vanilla" upstream build, with nothing disabled.
+
+* `xen`: Build only the hypervisor. Does not execute `./configure`.
+
+* `xentools`: Attempt to build only the hypervisor and in-tree tools.
+Disable all out-of-tree builds, as well as stubdoms, but *don't*
+disable the pvshim.
+
+The default is set to `simple`.
+
## Viewing patches that another developer has created
Suppose instead you want to review another developer's series; or
TreeQemuT = "qemut"
TreeXSA = "xsa"
// FIXME: This isn't really a tree...
- TreeWork = "worktree"
+ TreeWork = "worktree"
)
var TreeListAll = []Tree{TreeXen, TreeQemuU, TreeQemuT, TreeXSA}
MirrorDir string
ProxyURL string
}
+ BuildSequences map[string]BuildSequence
+ DefaultBuildSequence string
// Not saved
rootDir string
- loaded bool
+ loaded bool
}
const ConfigFileName = ".xsatool"
if err == nil {
tc.loaded = true
}
-
+
return
}
// Return 'true' if there's a recipe (even empty)
func (m *XSAMeta) HasRecipe(v XenVersion) bool {
- return m.GetRecipe(v) != nil
+ return m.GetRecipe(v) != nil
}
// Return 'true' if:
"path"
"path/filepath"
"strconv"
+ "strings"
)
type TreeRecipe struct {
Recipes map[Tree]*TreeRecipe
// Data not exported to JSON. Must be re-constructed on load.
XenVersion `json:"-"`
- xsa int
+ xsa int
}
const FPPath = "/tmp/xsatool-formatpatch"
}
// Return 'true' if all repo branches are valid, and contain patches
-func (r *Recipe) RepoHasPatches(prefix string) (bool) {
+func (r *Recipe) RepoHasPatches(prefix string) bool {
_, baseline, branch := r.branchName(prefix)
err := r.ForEachTree(func(tree Tree) error {
return nil
})
-
+
return err == nil
}
return fmt.Errorf("Appling am %s: %v\n", glob, err)
}
}
-
+
return
}
return
}
-func (r *Recipe) Build(prefix string) (err error) {
+type BuildSequence []string
+
+var defaultBuildSequence = BuildSequence{
+ "./configure",
+ "make -j 8",
+}
+
+func (r *Recipe) Build(prefix string, bsName string) (err error) {
+ bs := defaultBuildSequence
+
+ if bsName != "" {
+ var prs bool
+ if bs, prs = G.config.Tool.BuildSequences[bsName]; !prs {
+ return fmt.Errorf("No such buildsequence: %s", bsName)
+ }
+ }
+
_, _, branch := r.branchName(prefix)
repo := G.repos.GetRepoNC(TreeXen).Repo
}
var wt *Worktree
-
+
/* Always check out a temporary branch for xen */
tmpBranch := "xsa/tmp"
if wtPath != "" {
// build-NNN-VV
name := fmt.Sprintf("build-%d-%v", r.xsa, r.XenVersion)
-
+
wt, err = repo.WorktreeAdd(wtPath, name, wtbranch)
if err != nil {
return
}
defer logfile.Close()
- cmd := exec.Command("./configure")
- cmd.Stdout = logfile
- cmd.Stderr = logfile
- err = cmd.Run()
- if err != nil {
- return fmt.Errorf("Configuring xen: %v\n", err)
- }
-
- // Build
- cmd = exec.Command("make", "-j", "8")
- cmd.Stdout = logfile
- cmd.Stderr = logfile
- err = cmd.Run()
- if err != nil {
- return fmt.Errorf("Building: %v\n", err)
+ for i := range bs {
+ fmt.Println("[" + bs[i] + "]")
+ s := strings.Split(bs[i], " ")
+ cmd := exec.Command(s[0], s[1:]...)
+ cmd.Stdout = logfile
+ cmd.Stderr = logfile
+ err = cmd.Run()
+ if err != nil {
+ return fmt.Errorf("BuildSequence[%d] %s: %v\n",
+ i, bs[i], err)
+ }
}
if wt != nil {
proxyURL := flags.String("gitproxy", EmptyString,
"Git proxy prefix, used for building")
-
if err := flags.Parse(args); err != nil {
if err != flag.ErrHelp {
fmt.Printf("Error parsing args: %v\n", err)
return 1
}
+ G.config.Tool.BuildSequences = map[string]BuildSequence{
+ "simple": {"./configure", "make -j 8"},
+ "xen": {"make -j 8 xen"},
+ "xentools": {"./configure --disable-stubdom --disable-qemu-traditional" +
+ "--with-system-qemu=/bin/false --with-system-seabios=/bin/false" +
+ "--disable-ovmf",
+ "make -j 8"},
+ }
+ G.config.Tool.DefaultBuildSequence = "simple"
+
err = G.config.Tool.Save()
if err != nil {
fmt.Printf("Trying to save config: %v\n", err)
func MainRepoX(unused *XSAMeta, args []string) (ret int) {
var versions []XenVersionFull
-
+
xr, err := G.repos.GetRepo(TreeXen)
if err == nil {
func test(xsa *XSAMeta, args []string, apply bool, build bool) (ret int) {
vers := xsa.SupportedVersions
- if len(args) > 0 {
+
+ var bs string
+
+ for i := 0; i < len(args); i++ {
+ // Does it look like an extra argument?
+ switch args[i] {
+ case "-buildsequence":
+ case "-bs":
+ if len(args) == i {
+ fmt.Printf("Not enough arguments to buildsequence")
+ return 1
+ }
+ i++
+ bs = args[i]
+ continue
+ }
+
var err error
- vers, err = VersionsFromString(args[0], xsa.SupportedVersions, nil)
+ vers, err = VersionsFromString(args[i], xsa.SupportedVersions, nil)
if err != nil {
fmt.Printf("Error parsing versions: %v", err)
- return
+ return 1
}
}
+ if bs == "" {
+ bs = G.config.Tool.DefaultBuildSequence
+ }
+
for _, v := range vers {
prefix := "xsa/test"
r := xsa.GetRecipe(v)
}
if build {
- err := r.Build(prefix)
+ err := r.Build(prefix, bs)
if err != nil {
fmt.Printf("Building recipe: %v\n", err)
fmt.Printf("FAILED: %v\n", r.XenVersion)