import zipfile
import hashlib
import pickle
+import urlparse
from datetime import datetime, timedelta
from xml.dom.minidom import Document
from argparse import ArgumentParser
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!")
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']]
repoel = doc.createElement("repo")
+ mirrorcheckfailed = False
+ for mirror in config.get('mirrors', []):
+ base = os.path.basename(urlparse.urlparse(mirror).path.rstrip('/'))
+ if config.get('nonstandardwebroot') is not True and base != 'fdroid':
+ logging.error("mirror '" + mirror + "' does not end with 'fdroid'!")
+ mirrorcheckfailed = True
+ if mirrorcheckfailed:
+ sys.exit(1)
+
if archive:
repoel.setAttribute("name", config['archive_name'])
if config['repo_maxage'] != 0:
repoel.setAttribute("icon", os.path.basename(config['archive_icon']))
repoel.setAttribute("url", config['archive_url'])
addElement('description', config['archive_description'], doc, repoel)
+ urlbasepath = os.path.basename(urlparse.urlparse(config['archive_url']).path)
+ for mirror in config.get('mirrors', []):
+ addElement('mirror', urlparse.urljoin(mirror, urlbasepath), doc, repoel)
else:
repoel.setAttribute("name", config['repo_name'])
repoel.setAttribute("icon", os.path.basename(config['repo_icon']))
repoel.setAttribute("url", config['repo_url'])
addElement('description', config['repo_description'], doc, repoel)
+ urlbasepath = os.path.basename(urlparse.urlparse(config['repo_url']).path)
+ for mirror in config.get('mirrors', []):
+ addElement('mirror', urlparse.urljoin(mirror, urlbasepath), doc, repoel)
- repoel.setAttribute("version", "14")
+ repoel.setAttribute("version", "15")
repoel.setAttribute("timestamp", str(int(time.time())))
nosigningkey = False
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']]
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')