[PATCH] KVM test: Fix KVM release tag detection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As sourceforge keeps changing the way it organizes its
download pages, a slightly better way to sort out the
latest KVM release tag was devised: Look in all regexp
matches of what looks like a release tag, and return the
largest integer, which will be therefore the latest
release tag. This way we don't have to rely on how
sourceforge organizes their display of downloads.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@xxxxxxxxxx>
---
 client/tests/kvm/kvm_utils.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py
index 4edf371..5b47e02 100644
--- a/client/tests/kvm/kvm_utils.py
+++ b/client/tests/kvm/kvm_utils.py
@@ -142,8 +142,10 @@ def get_latest_kvm_release_tag(release_dir):
         f.close()
         rx = re.compile("kvm-(\d+).tar.gz", re.IGNORECASE)
         matches = rx.findall(data)
-        package_id = matches[0]
-        return matches[0] # the first match contains the latest release tag
+        # In all regexp matches to something that looks like a release tag,
+        # get the largest integer. That will be our latest release tag.
+        latest_tag = max(int(x) for x in matches)
+        return str(latest_tag)
     except Exception, e:
         message = "Could not fetch latest KVM release tag: %s" % str(e)
         logging.error(message)
-- 
1.6.2.5

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux