Make version extraction logic more generic 29/62229/1
authorDaniel Farrell <dfarrell@redhat.com>
Wed, 23 Aug 2017 21:41:52 +0000 (17:41 -0400)
committerDaniel Farrell <dfarrell@redhat.com>
Wed, 23 Aug 2017 21:41:52 +0000 (17:41 -0400)
Turns out just making the match less strict fixes both issues with
multipatch-test Nexus repos and Karaf 3/4 distro naming.

Change-Id: Icc5272cb0c9411db51cf343681d24093363d39c4
Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
packages/test_build.py
packages/vars.py

index b1c927e4250a23fba44ff78b8b205d5732943b09..0836dab5862430ad7737bcc1a1b7f58b17688cac 100644 (file)
@@ -182,8 +182,6 @@ class TestExtractVersion(unittest.TestCase):
         self.assertEqual(version["version_patch"], "0")
         self.assertEqual(version["pkg_version"], "0.1.20170821snap442")
 
-    # Karaf 4 karaf- vs distribution-karaf naming not supported
-    @unittest.expectedFailure
     def test_nitrogen_snapshot_url(self):
         """Test URL of an ODL Nitrogen snapshot build."""
         # noqa ShellCheckBear
@@ -194,8 +192,6 @@ class TestExtractVersion(unittest.TestCase):
         self.assertEqual(version["version_patch"], "0")
         self.assertEqual(version["pkg_version"], "0.1.20170815snap1727")
 
-    # Karaf 4 karaf- vs distribution-karaf naming not supported
-    @unittest.expectedFailure
     def test_nitrogen_snapshot_zip_url(self):
         """Test URL of an ODL Nitrogen snapshot build zip archive."""
         # noqa ShellCheckBear
@@ -206,8 +202,6 @@ class TestExtractVersion(unittest.TestCase):
         self.assertEqual(version["version_patch"], "0")
         self.assertEqual(version["pkg_version"], "0.1.20170815snap1727")
 
-    # Karaf 4 karaf- vs distribution-karaf naming not supported
-    @unittest.expectedFailure
     def test_oxygen_snapshot_url(self):
         """Test URL of an ODL Oxygen snapshot build."""
         # noqa ShellCheckBear
@@ -218,8 +212,6 @@ class TestExtractVersion(unittest.TestCase):
         self.assertEqual(version["version_patch"], "0")
         self.assertEqual(version["pkg_version"], "0.1.20170815snap2")
 
-    # Karaf 4 karaf- vs distribution-karaf naming not supported
-    @unittest.expectedFailure
     def test_oxygen_snapshot_zip_url(self):
         """Test URL of an ODL Oxygen snapshot build zip archive."""
         # noqa ShellCheckBear
@@ -230,8 +222,6 @@ class TestExtractVersion(unittest.TestCase):
         self.assertEqual(version["version_patch"], "0")
         self.assertEqual(version["pkg_version"], "0.1.20170815snap2")
 
-    # Multipatch Nexus repos are not currently supported
-    @unittest.expectedFailure
     def test_carbon_multipatch_zip_url(self):
         """Test URL of an ODL Carbon multipatch-test build zip archive."""
         # noqa ShellCheckBear
@@ -242,8 +232,6 @@ class TestExtractVersion(unittest.TestCase):
         self.assertEqual(version["version_patch"], "0")
         self.assertEqual(version["pkg_version"], "0.1.20170822snap45")
 
-    # Multipatch Nexus repos are not currently supported
-    @unittest.expectedFailure
     def test_nitrogen_multipatch_zip_url(self):
         """Test URL of an ODL Nitrogen multipatch-test build zip archive."""
         # noqa ShellCheckBear
@@ -254,8 +242,6 @@ class TestExtractVersion(unittest.TestCase):
         self.assertEqual(version["version_patch"], "0")
         self.assertEqual(version["pkg_version"], "0.1.20170822snap274")
 
-    # Multipatch Nexus repos are not currently supported
-    @unittest.expectedFailure
     def test_oxygen_multipatch_zip_url(self):
         """Test URL of an ODL Oxygen multipatch-test build zip archive."""
         # noqa ShellCheckBear
index c23a78e0140c9c2b0f3f4d4c02138c5ad739c3fd..366156546783b37a659547d27c6fbece4aa6db99 100644 (file)
@@ -67,10 +67,8 @@ def extract_version(url):
         # build_id = 2242
         # date = 20161201
         odl_rpm = re.search(
-            r'\/(distribution-karaf)-'
-            r'([0-9]\.[0-9]\.[0-9])-([0-9]+)\.([0-9]+)-([0-9]+)\.(tar\.gz)',
-            url)
-        pkg_version = "0.1." + odl_rpm.group(3) + "snap" + odl_rpm.group(5)
+            r'([0-9]\.[0-9]\.[0-9])-([0-9]+)\.([0-9]+)-([0-9]+)\.', url)
+        pkg_version = "0.1." + odl_rpm.group(2) + "snap" + odl_rpm.group(4)
     elif "public" or "opendaylight.release" in url:
         pkg_version = "1"
     else: