From 430f1b4694f9450c774f77af5c597f8ed69460ba Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 28 Apr 2017 11:20:04 +0200 Subject: [PATCH] properly support private builds in the registry when building snapshots, maven will sometimes add some information *after* the -SNAPSHOT like this: 1.4.6-SNAPSHOT (private-0986edd9-egolov) the old registry code would transform this to 1.4.6.preview (private-0986edd9-egolov) which is not a valid version string for pkg_resources. strip everything after the -SNAPSHOT tag and thus produce a clean version string that is comparable properly Change-Id: I765c991ac7632b3c76f548112d2a5323a8ce4489 Signed-off-by: Evgeni Golov --- jenkins_jobs/registry.py | 2 +- tests/moduleregistry/test_moduleregistry.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/jenkins_jobs/registry.py b/jenkins_jobs/registry.py index a81f1a342..739c8f3a0 100644 --- a/jenkins_jobs/registry.py +++ b/jenkins_jobs/registry.py @@ -64,7 +64,7 @@ class ModuleRegistry(object): mapped to its plugin info dictionary. """ version = plugin_info.get('version', '0') - plugin_info['version'] = re.sub(r'(.*)-(?:SNAPSHOT|BETA)', + plugin_info['version'] = re.sub(r'(.*)-(?:SNAPSHOT|BETA).*', r'\g<1>.preview', version) aliases = [] diff --git a/tests/moduleregistry/test_moduleregistry.py b/tests/moduleregistry/test_moduleregistry.py index a0408f898..0b0c54a45 100644 --- a/tests/moduleregistry/test_moduleregistry.py +++ b/tests/moduleregistry/test_moduleregistry.py @@ -24,6 +24,10 @@ class ModuleRegistryPluginInfoTestsWithScenarios( ('s11', dict(v1='1.0.preview', op='__lt__', v2='1.0')), ('s12', dict(v1='1.1-SNAPSHOT', op='__gt__', v2='1.0')), ('s13', dict(v1='1.0a-SNAPSHOT', op='__lt__', v2='1.0a')), + ('s14', dict(v1='1.4.6-SNAPSHOT (private-0986edd9-example)', + op='__lt__', v2='1.4.6')), + ('s15', dict(v1='1.4.6-SNAPSHOT (private-0986edd9-example)', + op='__gt__', v2='1.4.5')), ] def setUp(self):