From 3ccfde3b06cae1fe56a88677a40537789a91669c Mon Sep 17 00:00:00 2001 From: George Dunlap Date: Thu, 26 Jul 2018 16:39:07 +0100 Subject: [PATCH] global: Fix checking for new versions The documentation claims that `xsatool global update` will check for and initialize new versions. But the code only does the check when initializing a new global.meta. Fix this by setting `limit` when global.meta already exists to the most recent non-master version, and adding any version greater than that version. Signed-off-by: George Dunlap --- global.go | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/global.go b/global.go index 7029b87..24c4d84 100644 --- a/global.go +++ b/global.go @@ -42,6 +42,21 @@ func MainGlobalUpdate(unused *XSAMeta, args []string) int { sm.InitVersion(XenVersionMaster) init = true + } else { + // Find newest current non-Master version + for v := range sm.Versions { + if v == XenVersionMaster { + continue + } + if limit.Check() { + if v.IsGreaterThan(limit) { + limit = v + } + } else { + limit = v + } + + } } fmt.Printf("Getting Xen releases from tree...\n") @@ -52,12 +67,8 @@ func MainGlobalUpdate(unused *XSAMeta, args []string) int { } for _, fv := range versions { - _, prs := sm.Versions[fv.XenVersion()] - if prs { - continue - } - - if init && fv.XenVersion().IsGreaterEqualThan(limit) { + if (init && fv.XenVersion().IsGreaterEqualThan(limit)) || + fv.XenVersion().IsGreaterThan(limit) { sm.InitVersion(fv.XenVersion()) } else { fmt.Printf("Skipping version %v\n", fv) -- 2.39.5