use jarsigner and keytool from same JDK as is being set in JAVA7_HOME

Using the same JDK throughout should prevent weird bugs where a setup might
use Java8's jarsigner and Java7's keytool.  This also allows the user to
set java_paths and have jarsigner and keytool used from that specified JDK.

This incorporates almost all of the patch that is in the Debian package
that forces fdroidserver to use the default JDK on that Debian release.

closes #93 https://gitlab.com/fdroid/fdroidserver/issues/93
This commit is contained in:
Hans-Christoph Steiner 2016-02-11 20:43:55 +01:00
parent fdf17e809c
commit 69c81c3817
5 changed files with 38 additions and 10 deletions

View file

@ -47,6 +47,10 @@ def main():
config = common.read_config(options)
if not ('jarsigner' in config and 'keytool' in config):
logging.critical('Java JDK not found! Install in standard location or set java_paths!')
sys.exit(1)
log_dir = 'logs'
if not os.path.isdir(log_dir):
logging.info("Creating log directory")
@ -163,12 +167,12 @@ def main():
# See if we already have a key for this application, and
# if not generate one...
p = FDroidPopen(['keytool', '-list',
p = FDroidPopen([config['keytool'], '-list',
'-alias', keyalias, '-keystore', config['keystore'],
'-storepass:file', config['keystorepassfile']])
if p.returncode != 0:
logging.info("Key does not exist - generating...")
p = FDroidPopen(['keytool', '-genkey',
p = FDroidPopen([config['keytool'], '-genkey',
'-keystore', config['keystore'],
'-alias', keyalias,
'-keyalg', 'RSA', '-keysize', '2048',
@ -181,7 +185,7 @@ def main():
raise BuildException("Failed to generate key")
# Sign the application...
p = FDroidPopen(['jarsigner', '-keystore', config['keystore'],
p = FDroidPopen([config['jarsigner'], '-keystore', config['keystore'],
'-storepass:file', config['keystorepassfile'],
'-keypass:file', config['keypassfile'], '-sigalg',
'SHA1withRSA', '-digestalg', 'SHA1',