unify current_version

Signed-off-by: Dinar Valeev <dvaleev@suse.com>
This commit is contained in:
Dinar Valeev 2015-05-03 16:08:22 +02:00
parent c6d32d8f50
commit 22f0983940

View File

@ -54,6 +54,9 @@ class ToTestBase(object):
def jobs_num(self): def jobs_num(self):
return 90 return 90
def current_version(self):
return self.release_version
def binaries_of_product(self, project, product): def binaries_of_product(self, project, product):
url = self.api.makeurl(['build', project, 'images', 'local', product]) url = self.api.makeurl(['build', project, 'images', 'local', product])
try: try:
@ -80,6 +83,28 @@ class ToTestBase(object):
return None return None
def ftp_build_version(self, tree):
for binary in self.binaries_of_product('openSUSE:%s' % self.project, tree):
result = re.match(r'openSUSE.*Build(.*)-Media1.report', binary)
if result:
return result.group(1)
raise Exception("can't find %s version" % self.project)
def release_version(self):
url = self.api.makeurl(['build', 'openSUSE:%s' % project, 'standard', arch,
'_product:openSUSE-release'])
f = self.api.retried_GET(url)
root = ET.parse(f).getroot()
for binary in root.findall('binary'):
binary = binary.get('filename', '')
result = re.match(r'.*-([^-]*)-[^-]*.src.rpm', binary)
if result:
return result.group(1)
raise Exception("can't find %s version" % project)
def find_openqa_results(self, snapshot): def find_openqa_results(self, snapshot):
"""Return the openqa jobs of a given snapshot and filter out the """Return the openqa jobs of a given snapshot and filter out the
cloned jobs cloned jobs
@ -392,18 +417,6 @@ class ToTestFactory(ToTestBase):
def arch(self): def arch(self):
return 'x86_64' return 'x86_64'
# for Factory we check the version of the release package
def current_version(self):
url = self.api.makeurl(['build', 'openSUSE:%s' % self.project, 'standard', self.arch(),
'_product:openSUSE-release'])
f = self.api.retried_GET(url)
root = ET.parse(f).getroot()
for binary in root.findall('binary'):
binary = binary.get('filename', '')
result = re.match(r'.*-([^-]*)-[^-]*.src.rpm', binary)
if result:
return result.group(1)
raise Exception("can't find factory version")
class ToTestFactoryPowerPC(ToTestBase): class ToTestFactoryPowerPC(ToTestBase):
main_products = ['_product:openSUSE-dvd5-BE-ppc64', main_products = ['_product:openSUSE-dvd5-BE-ppc64',
@ -430,19 +443,6 @@ class ToTestFactoryPowerPC(ToTestBase):
def jobs_num(self): def jobs_num(self):
return 4 return 4
# for Factory we check the version of the release package
def current_version(self):
url = self.api.makeurl(['build', 'openSUSE:%s' % self.project, 'standard', self.arch(),
'_product:openSUSE-release'])
f = self.api.retried_GET(url)
root = ET.parse(f).getroot()
for binary in root.findall('binary'):
binary = binary.get('filename', '')
result = re.match(r'.*-([^-]*)-[^-]*.src.rpm', binary)
if result:
return result.group(1)
raise Exception("can't find factory powerpc version")
class ToTestFactoryARM(ToTestFactory): class ToTestFactoryARM(ToTestFactory):
main_products = [ '_product:openSUSE-cd-mini-aarch64'] main_products = [ '_product:openSUSE-cd-mini-aarch64']
@ -473,14 +473,8 @@ class ToTest132(ToTestBase):
'_product:openSUSE-dvd9-dvd-biarch-i586_x86_64' '_product:openSUSE-dvd9-dvd-biarch-i586_x86_64'
] ]
# for 13.2 we take the build number of the FTP tree
def current_version(self): def current_version(self):
for binary in self.binaries_of_product('openSUSE:%s' % self.project, '_product:openSUSE-ftp-ftp-i586_x86_64'): return self.ftp_tree_version('_product:openSUSE-ftp-ftp-i586_x86_64')
result = re.match(r'openSUSE.*Build(.*)-Media1.report', binary)
if result:
return result.group(1)
raise Exception("can't find 13.2 version")
class CommandlineInterface(cmdln.Cmdln): class CommandlineInterface(cmdln.Cmdln):