Package: fdroidserver / 1.1.1-1

debian-java-detection.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Description:
 Normally fdroid auto-detects Java's keytool and jarsigner, but if the
 user changes the default JDK to something other than Java 1.7, then
 fdroid will break.  So this package first uses the path to the
 default Debian version of the tools.
Forwarded: not-needed
Author: Hans-Christoph Steiner <hans@eds.org>
Date: Thu, 18 Feb 2016 12:27:16 +0100

--- a/fdroidserver/common.py
+++ b/fdroidserver/common.py
@@ -238,15 +238,21 @@
             pathlist += glob.glob(os.path.join(os.getenv('PROGRAMFILES'), 'Java', 'jdk1.[16-9][0-9]?.*'))
         _add_java_paths_to_config(pathlist, thisconfig)
 
-    for java_version in ('14', '13', '12', '11', '10', '9', '8', '7'):
-        if java_version not in thisconfig['java_paths']:
-            continue
-        java_home = thisconfig['java_paths'][java_version]
-        jarsigner = os.path.join(java_home, 'bin', 'jarsigner')
-        if os.path.exists(jarsigner):
-            thisconfig['jarsigner'] = jarsigner
-            thisconfig['keytool'] = os.path.join(java_home, 'bin', 'keytool')
-            break
+    # for Debian/Ubuntu packaging, always prefer the built-in, unless it does not exist
+    default_java = '/usr/lib/jvm/default-java'
+    if os.path.exists(default_java):
+        thisconfig['jarsigner'] = os.path.join(default_java, 'bin', 'jarsigner')
+        thisconfig['keytool'] = os.path.join(default_java, 'bin', 'keytool')
+    else:
+        for java_version in ('14', '13', '12', '11', '10', '9', '8', '7'):
+            if java_version not in thisconfig['java_paths']:
+                continue
+            java_home = thisconfig['java_paths'][java_version]
+            jarsigner = os.path.join(java_home, 'bin', 'jarsigner')
+            if os.path.exists(jarsigner):
+                thisconfig['jarsigner'] = jarsigner
+                thisconfig['keytool'] = os.path.join(java_home, 'bin', 'keytool')
+                break
 
     if 'jarsigner' not in thisconfig and shutil.which('jarsigner'):
         thisconfig['jarsigner'] = shutil.which('jarsigner')