common: make jdk detection more strict

We weren't using ^ and $, so stuff like java-8-openjdk-i386 would match
both the Arch and the Debian regexes. A list with one regex per line in
the same format is also easier to read and maintain.

This might be why java8 isn't being detected properly on our Debian
stable buildserver.
This commit is contained in:
Daniel Martí 2016-02-23 12:42:47 +00:00
parent 3fbe4cc8f2
commit e3f60e2b78

View file

@ -139,22 +139,25 @@ def fill_config_defaults(thisconfig):
continue continue
j = os.path.basename(d) j = os.path.basename(d)
# the last one found will be the canonical one, so order appropriately # the last one found will be the canonical one, so order appropriately
for regex in (r'1\.([6-9])\.0\.jdk', # OSX for regex in [
r'jdk1\.([6-9])\.0_[0-9]+.jdk', # OSX and Oracle tarball r'^1\.([6-9])\.0\.jdk$', # OSX
r'jdk([6-9])-openjdk', # Arch r'^jdk1\.([6-9])\.0_[0-9]+.jdk$', # OSX and Oracle tarball
r'java-([6-9])-openjdk', # Arch r'^jdk([6-9])-openjdk$', # Arch
r'java-([6-9])-jdk', # Arch (oracle) r'^java-([6-9])-openjdk$', # Arch
r'java-1\.([6-9])\.0-.*', # RedHat r'^java-([6-9])-jdk$', # Arch (oracle)
r'java-([6-9])-oracle', # Debian WebUpd8 r'^java-1\.([6-9])\.0-.*$', # RedHat
r'jdk-([6-9])-oracle-.*', # Debian make-jpkg r'^java-([6-9])-oracle$', # Debian WebUpd8
r'java-([6-9])-openjdk-[^c][^o][^m].*'): # Debian r'^jdk-([6-9])-oracle-.*$', # Debian make-jpkg
r'^java-([6-9])-openjdk-[^c][^o][^m].*$', # Debian
]:
m = re.match(regex, j) m = re.match(regex, j)
if m: if not m:
osxhome = os.path.join(d, 'Contents', 'Home') continue
if os.path.exists(osxhome): osxhome = os.path.join(d, 'Contents', 'Home')
thisconfig['java_paths'][m.group(1)] = osxhome if os.path.exists(osxhome):
else: thisconfig['java_paths'][m.group(1)] = osxhome
thisconfig['java_paths'][m.group(1)] = d else:
thisconfig['java_paths'][m.group(1)] = d
for java_version in ('7', '8', '9'): for java_version in ('7', '8', '9'):
if java_version not in thisconfig['java_paths']: if java_version not in thisconfig['java_paths']: