From: Daniel Martí Date: Tue, 23 Feb 2016 12:42:47 +0000 (+0000) Subject: common: make jdk detection more strict X-Git-Tag: 0.7.0~100 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=e3f60e2b7820ff7f4773bb97bf5cc5e1f858c5ec;p=fdroidserver.git 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. --- diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 5a6c64ab..36c588d0 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -139,22 +139,25 @@ def fill_config_defaults(thisconfig): continue j = os.path.basename(d) # the last one found will be the canonical one, so order appropriately - for regex in (r'1\.([6-9])\.0\.jdk', # OSX - r'jdk1\.([6-9])\.0_[0-9]+.jdk', # OSX and Oracle tarball - r'jdk([6-9])-openjdk', # Arch - r'java-([6-9])-openjdk', # Arch - r'java-([6-9])-jdk', # Arch (oracle) - r'java-1\.([6-9])\.0-.*', # RedHat - r'java-([6-9])-oracle', # Debian WebUpd8 - r'jdk-([6-9])-oracle-.*', # Debian make-jpkg - r'java-([6-9])-openjdk-[^c][^o][^m].*'): # Debian + for regex in [ + r'^1\.([6-9])\.0\.jdk$', # OSX + r'^jdk1\.([6-9])\.0_[0-9]+.jdk$', # OSX and Oracle tarball + r'^jdk([6-9])-openjdk$', # Arch + r'^java-([6-9])-openjdk$', # Arch + r'^java-([6-9])-jdk$', # Arch (oracle) + r'^java-1\.([6-9])\.0-.*$', # RedHat + r'^java-([6-9])-oracle$', # Debian WebUpd8 + r'^jdk-([6-9])-oracle-.*$', # Debian make-jpkg + r'^java-([6-9])-openjdk-[^c][^o][^m].*$', # Debian + ]: m = re.match(regex, j) - if m: - osxhome = os.path.join(d, 'Contents', 'Home') - if os.path.exists(osxhome): - thisconfig['java_paths'][m.group(1)] = osxhome - else: - thisconfig['java_paths'][m.group(1)] = d + if not m: + continue + osxhome = os.path.join(d, 'Contents', 'Home') + if os.path.exists(osxhome): + thisconfig['java_paths'][m.group(1)] = osxhome + else: + thisconfig['java_paths'][m.group(1)] = d for java_version in ('7', '8', '9'): if java_version not in thisconfig['java_paths']: