This creates an 'empty' xsa228.meta file, and the appropriate
`-stable` and `-baseline` branches.
-Now set the patches for each version individually:
+Then use the `set-patches` command, which looks like this:
-`xsatool 228 set-patches master xsa228.patch`
+`xsatool NNN set-patches <version-list> patchglob [patchglob, ...]`
-`xsatool 228 set-patches 4.9 xsa228.patch`
+Now set the patches for each version range:
+
+`xsatool 228 set-patches master..4.9 xsa228.patch`
`xsatool 228 set-patches 4.8 xsa228-4.8.patch`
-...and so on. Note that this command will only work when an XSA
-applies to only one tree; if the XSA covers more than one tree, you'll
-have to edit the metadata file by hand.
+...and so on. Or, if the same patch applies to all versions:
+
+`xsatool 272 set-patches all xsa272.patch`
+
+Or use a `glob` rather than a specific filename:
+
+`xsatool 268 set-patches 4.9..4.8 "xsa268-4.9-?.patch"`
+
+Note that this command will only work when an XSA applies to only one
+tree; if the XSA covers more than one tree, you'll have to edit the
+metadata file by hand.
-**TODO** Add a way to specify multiple versions in one go; e.g.,
-`master,4.9,4.8` or something. Also, allow omission of the patch name
-if it matches the normal format; i.e., `set patches 4.9,4.8` would
-automatically use `xsa228-4.9.patch` for both 4.9 and 4.8.
+**TODO** Allow omission of the patch name if it matches the normal
+format; i.e., `set patches 4.9,4.8` would automatically use
+`xsa228-4.9.patch` for both 4.9 and 4.8.
## Excluding a particular Xen version from an XSA
return
}
-// xsatool NNN set-patches version patch_glob [patch_glob ...]
-func MainSetPatches(xsa *XSAMeta, args []string) (ret int) {
- if len(args) < 2 {
- fmt.Printf("Not enough arguments")
- return 1
- }
-
- // FIXME: Verify xenversion
- v := XenVersion(args[0])
-
+func setPatchesOne(xsa *XSAMeta, v XenVersion, patches []string) int {
r := xsa.GetRecipe(v)
if r == nil {
fmt.Printf("Couldn't find recipe for xenversion %v\n", v)
if !prs {
err = fmt.Errorf("Internal data error: no recipe for tree %s\n", t)
- return
+ return 1
}
- tr.Patches = append([]string(nil), args[1:]...)
+ tr.Patches = append([]string(nil), patches...)
xsa.dirty = true
}
return 1
}
+ return 0
+
+}
+
+// xsatool NNN set-patches <versionlist> patch_glob [patch_glob ...]
+func MainSetPatches(xsa *XSAMeta, args []string) (ret int) {
+ if len(args) < 2 {
+ fmt.Printf("Not enough arguments")
+ return 1
+ }
+
+ vers, err := VersionsFromString(args[0], xsa.SupportedVersions, nil)
+ if err != nil {
+ fmt.Printf("Error parsing versions: %v", err)
+ return
+ }
+
+ for _, v := range vers {
+ if ret = setPatchesOne(xsa, v, args[1:]); ret != 0 {
+ return
+ }
+ }
+
if xsa.dirty {
xsa.Save()
}
-
- return 0
+
+ return
}
func dedupPatches(xsa *XSAMeta, from XenVersion, to XenVersion) (err error) {