From patchwork Mon Aug 10 13:50:54 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 40412 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7ADpB1x025115 for ; Mon, 10 Aug 2009 13:51:11 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754646AbZHJNvH (ORCPT ); Mon, 10 Aug 2009 09:51:07 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754647AbZHJNvH (ORCPT ); Mon, 10 Aug 2009 09:51:07 -0400 Received: from mx2.redhat.com ([66.187.237.31]:52900 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754390AbZHJNvG (ORCPT ); Mon, 10 Aug 2009 09:51:06 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7ADoxtt024149; Mon, 10 Aug 2009 09:50:59 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n7ADowLr019585; Mon, 10 Aug 2009 09:50:58 -0400 Received: from localhost.localdomain (vpn-10-43.bos.redhat.com [10.16.10.43]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n7ADot6Y001388; Mon, 10 Aug 2009 09:50:56 -0400 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, Lucas Meneghel Rodrigues Subject: [PATCH] KVM test: Fix KVM release tag detection Date: Mon, 10 Aug 2009 10:50:54 -0300 Message-Id: <1249912254-16606-1-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 --- 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)