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

@ -367,7 +367,7 @@ def getsig(apkpath):
cert = None
# verify the jar signature is correct
args = ['jarsigner', '-verify', apkpath]
args = [config['jarsigner'], '-verify', apkpath]
p = FDroidPopen(args)
if p.returncode != 0:
logging.critical(apkpath + " has a bad signature!")
@ -711,7 +711,7 @@ def extract_pubkey():
if 'repo_pubkey' in config:
pubkey = unhexlify(config['repo_pubkey'])
else:
p = FDroidPopen(['keytool', '-exportcert',
p = FDroidPopen([config['keytool'], '-exportcert',
'-alias', config['repo_keyalias'],
'-keystore', config['keystore'],
'-storepass:file', config['keystorepassfile']]
@ -970,7 +970,7 @@ def make_index(apps, sortedids, apks, repodir, archive, categories):
if os.path.exists(signed):
os.remove(signed)
else:
args = ['jarsigner', '-keystore', config['keystore'],
args = [config['jarsigner'], '-keystore', config['keystore'],
'-storepass:file', config['keystorepassfile'],
'-digestalg', 'SHA1', '-sigalg', 'SHA1withRSA',
signed, config['repo_keyalias']]
@ -1118,6 +1118,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)
repodirs = ['repo']
if config['archive_older'] != 0:
repodirs.append('archive')