chiark / gitweb /
Check javac existence when looking for JDK
authorrelan <email@hidden>
Wed, 3 Aug 2016 05:24:45 +0000 (08:24 +0300)
committerrelan <email@hidden>
Mon, 8 Aug 2016 04:25:26 +0000 (07:25 +0300)
Empty JDK directories can remain from previous JDK installations. For
example in RHEL/Fedora when RPM upgrades a package it can leave modified
files (usually configs) and, consequently, their directories. So we could
end up selecting a bad JDK path.

fdroidserver/common.py

index 229c6e4d69cfbd462aba80f90df38d05b11d9a85..a9a4b48773497ce25deb45e8ec841f654ed92365 100644 (file)
@@ -158,11 +158,9 @@ def fill_config_defaults(thisconfig):
                 m = re.match(regex, j)
                 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 p in [d, os.path.join(d, 'Contents', 'Home')]:
+                    if os.path.exists(os.path.join(p, 'bin', 'javac')):
+                        thisconfig['java_paths'][m.group(1)] = p
 
     for java_version in ('7', '8', '9'):
         if java_version not in thisconfig['java_paths']: