import common
import metadata
-from common import FDroidPopen
+from common import FDroidPopen, SilentPopen
from metadata import MetaDataException
apkfilename = apkfile[len(repodir) + 1:]
if ' ' in apkfilename:
- logging.error("No spaces in APK filenames!")
+ logging.critical("Spaces in filenames are not allowed.")
sys.exit(1)
if apkfilename in apkcache:
thisinfo = apkcache[apkfilename]
else:
- if options.verbose:
- logging.info("Processing " + apkfilename)
+ logging.debug("Processing " + apkfilename)
thisinfo = {}
thisinfo['apkname'] = apkfilename
srcfilename = apkfilename[:-4] + "_src.tar.gz"
thisinfo['features'] = []
thisinfo['icons_src'] = {}
thisinfo['icons'] = {}
- p = FDroidPopen([os.path.join(config['sdk_path'], 'build-tools',
- config['build_tools'], 'aapt'),
- 'dump', 'badging', apkfile])
+ p = SilentPopen([config['aapt'], 'dump', 'badging', apkfile])
if p.returncode != 0:
if options.delete_unknown:
if os.path.exists(apkfile):
else:
logging.error("Failed to get apk information, skipping " + apkfile)
continue
- for line in p.stdout.splitlines():
+ for line in p.output.splitlines():
if line.startswith("package:"):
try:
thisinfo['id'] = re.match(name_pat, line).group(1)
thisinfo['versioncode'] = int(re.match(vercode_pat, line).group(1))
thisinfo['version'] = re.match(vername_pat, line).group(1)
except Exception, e:
- logging.info("Package matching failed: " + str(e))
+ logging.error("Package matching failed: " + str(e))
logging.info("Line was: " + line)
sys.exit(1)
elif line.startswith("application:"):
sys.exit(1)
p = FDroidPopen(['java', '-cp', os.path.join(os.path.dirname(__file__), 'getsig'),
'getsig', os.path.join(os.getcwd(), apkfile)])
- if p.returncode != 0 or not p.stdout.startswith('Result:'):
+ if p.returncode != 0 or not p.output.startswith('Result:'):
logging.critical("Failed to get apk signature")
sys.exit(1)
- thisinfo['sig'] = p.stdout[7:].strip()
+ thisinfo['sig'] = p.output[7:].strip()
apk = zipfile.ZipFile(apkfile, 'r')
continue
if last_density is None:
continue
- logging.info("Density %s not available, resizing down from %s"
- % (density, last_density))
+ logging.debug("Density %s not available, resizing down from %s"
+ % (density, last_density))
last_iconpath = os.path.join(
get_icon_dir(repodir, last_density), iconfilename)
continue
if last_density is None:
continue
- logging.info("Density %s not available, copying from lower density %s"
- % (density, last_density))
+ logging.debug("Density %s not available, copying from lower density %s"
+ % (density, last_density))
shutil.copyfile(
os.path.join(get_icon_dir(repodir, last_density), iconfilename),
'-alias', config['repo_keyalias'],
'-keystore', config['keystore'],
'-storepass:file', config['keystorepassfile']]
- + config['smartcardoptions'])
+ + config['smartcardoptions'], output=False)
if p.returncode != 0:
msg = "Failed to get repo pubkey!"
if config['keystore'] == 'NONE':
logging.critical(msg)
sys.exit(1)
global repo_pubkey_fingerprint
- repo_pubkey_fingerprint = cert_fingerprint(p.stdout)
- return "".join("%02x" % ord(b) for b in p.stdout)
+ repo_pubkey_fingerprint = cert_fingerprint(p.output)
+ return "".join("%02x" % ord(b) for b in p.output)
repoel.setAttribute("pubkey", extract_pubkey())
p = FDroidPopen(args)
# TODO keypass should be sent via stdin
if p.returncode != 0:
- logging.info("Failed to sign index")
+ logging.critical("Failed to sign index")
sys.exit(1)
# Copy the repo icon into the repo directory...
if 'srcname' in apk:
shutil.move(os.path.join(repodir, apk['srcname']),
os.path.join(archivedir, apk['srcname']))
+ # Move GPG signature too...
+ sigfile = apk['srcname'] + '.asc'
+ sigsrc = os.path.join(repodir, sigfile)
+ if os.path.exists(sigsrc):
+ shutil.move(sigsrc, os.path.join(archivedir, sigfile))
+
archapks.append(apk)
apks.remove(apk)
resize_all_icons(repodirs)
sys.exit(0)
+ # check that icons exist now, rather than fail at the end of `fdroid update`
+ for k in ['repo_icon', 'archive_icon']:
+ if k in config:
+ if not os.path.exists(config[k]):
+ logging.critical(k + ' "' + config[k] + '" does not exist! Correct it in config.py.')
+ sys.exit(1)
+
# Get all apps...
apps = metadata.read_metadata()