From 07660fdb13722ae8377432e2bac14b9cee862c2d Mon Sep 17 00:00:00 2001 From: relan Date: Wed, 3 Aug 2016 08:21:46 +0300 Subject: [PATCH 1/2] Fix JAVA_HOME environment variable handling Append JAVA_HOME to pathlist as a string, not as a list of characters. --- fdroidserver/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index d8defcb8..229c6e4d 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -135,7 +135,7 @@ def fill_config_defaults(thisconfig): pathlist += glob.glob('/System/Library/Java/JavaVirtualMachines/1.[6-9].0.jdk') pathlist += glob.glob('/Library/Java/JavaVirtualMachines/*jdk*[6-9]*') if os.getenv('JAVA_HOME') is not None: - pathlist += os.getenv('JAVA_HOME') + pathlist.append(os.getenv('JAVA_HOME')) if os.getenv('PROGRAMFILES') is not None: pathlist += glob.glob(os.path.join(os.getenv('PROGRAMFILES'), 'Java', 'jdk1.[6-9].*')) for d in sorted(pathlist): From 162808a4ccd7eb4e2c0f502c12beb1e20ef07ad8 Mon Sep 17 00:00:00 2001 From: relan Date: Wed, 3 Aug 2016 08:24:45 +0300 Subject: [PATCH 2/2] Check javac existence when looking for JDK 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 | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 229c6e4d..a9a4b487 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -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']: