mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-09 00:40:11 +01:00
More logging switching
This commit is contained in:
parent
1b743e8b74
commit
1e3c2eee25
@ -22,6 +22,7 @@ import sys
|
|||||||
import os
|
import os
|
||||||
import glob
|
import glob
|
||||||
from optparse import OptionParser, OptionError
|
from optparse import OptionParser, OptionError
|
||||||
|
import logging
|
||||||
|
|
||||||
import common
|
import common
|
||||||
from common import FDroidPopen
|
from common import FDroidPopen
|
||||||
@ -61,7 +62,7 @@ def main():
|
|||||||
|
|
||||||
output_dir = 'repo'
|
output_dir = 'repo'
|
||||||
if not os.path.isdir(output_dir):
|
if not os.path.isdir(output_dir):
|
||||||
print "No signed output directory - nothing to do"
|
logging.info("No signed output directory - nothing to do")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if args:
|
if args:
|
||||||
@ -93,22 +94,24 @@ def main():
|
|||||||
devs = devices()
|
devs = devices()
|
||||||
if not devs:
|
if not devs:
|
||||||
raise Exception("No attached devices found")
|
raise Exception("No attached devices found")
|
||||||
print "Installing %s..." % apk
|
logging.info("Installing %s..." % apk)
|
||||||
for dev in devs:
|
for dev in devs:
|
||||||
print "Installing %s on %s..." % (apk, dev)
|
logging.info("Installing %s on %s..." % (apk, dev))
|
||||||
p = FDroidPopen(["adb", "-s", dev, "install", apk ])
|
p = FDroidPopen(["adb", "-s", dev, "install", apk ])
|
||||||
fail= ""
|
fail= ""
|
||||||
for line in p.stdout.splitlines():
|
for line in p.stdout.splitlines():
|
||||||
if line.startswith("Failure"):
|
if line.startswith("Failure"):
|
||||||
fail = line[9:-1]
|
fail = line[9:-1]
|
||||||
if fail:
|
if not fail:
|
||||||
if fail == "INSTALL_FAILED_ALREADY_EXISTS":
|
continue
|
||||||
print "%s is already installed on %s." % (apk, dev)
|
|
||||||
else:
|
|
||||||
raise Exception("Failed to install %s on %s: %s" % (
|
|
||||||
apk, dev, fail))
|
|
||||||
|
|
||||||
print "\nFinished"
|
if fail == "INSTALL_FAILED_ALREADY_EXISTS":
|
||||||
|
logging.warn("%s is already installed on %s." % (apk, dev))
|
||||||
|
else:
|
||||||
|
raise Exception("Failed to install %s on %s: %s" % (
|
||||||
|
apk, dev, fail))
|
||||||
|
|
||||||
|
logging.info("\nFinished")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
import re
|
import re
|
||||||
|
import logging
|
||||||
import common, metadata
|
import common, metadata
|
||||||
|
|
||||||
config = None
|
config = None
|
||||||
@ -31,7 +32,7 @@ def warn(message):
|
|||||||
if appid:
|
if appid:
|
||||||
print "%s:" % appid
|
print "%s:" % appid
|
||||||
appid = None
|
appid = None
|
||||||
print(' %s' % message)
|
print ' %s' % message
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
@ -136,7 +137,7 @@ def main():
|
|||||||
if not appid:
|
if not appid:
|
||||||
print
|
print
|
||||||
|
|
||||||
print "Finished."
|
logging.info("Finished.")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
@ -24,6 +24,7 @@ import shutil
|
|||||||
import md5
|
import md5
|
||||||
import glob
|
import glob
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
import logging
|
||||||
|
|
||||||
import common, metadata
|
import common, metadata
|
||||||
from common import FDroidPopen, BuildException
|
from common import FDroidPopen, BuildException
|
||||||
@ -45,22 +46,22 @@ def main():
|
|||||||
|
|
||||||
log_dir = 'logs'
|
log_dir = 'logs'
|
||||||
if not os.path.isdir(log_dir):
|
if not os.path.isdir(log_dir):
|
||||||
print "Creating log directory"
|
logging.info("Creating log directory")
|
||||||
os.makedirs(log_dir)
|
os.makedirs(log_dir)
|
||||||
|
|
||||||
tmp_dir = 'tmp'
|
tmp_dir = 'tmp'
|
||||||
if not os.path.isdir(tmp_dir):
|
if not os.path.isdir(tmp_dir):
|
||||||
print "Creating temporary directory"
|
logging.info("Creating temporary directory")
|
||||||
os.makedirs(tmp_dir)
|
os.makedirs(tmp_dir)
|
||||||
|
|
||||||
output_dir = 'repo'
|
output_dir = 'repo'
|
||||||
if not os.path.isdir(output_dir):
|
if not os.path.isdir(output_dir):
|
||||||
print "Creating output directory"
|
logging.info("Creating output directory")
|
||||||
os.makedirs(output_dir)
|
os.makedirs(output_dir)
|
||||||
|
|
||||||
unsigned_dir = 'unsigned'
|
unsigned_dir = 'unsigned'
|
||||||
if not os.path.isdir(unsigned_dir):
|
if not os.path.isdir(unsigned_dir):
|
||||||
print "No unsigned directory - nothing to do"
|
logging.info("No unsigned directory - nothing to do")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
# It was suggested at https://dev.guardianproject.info/projects/bazaar/wiki/FDroid_Audit
|
# It was suggested at https://dev.guardianproject.info/projects/bazaar/wiki/FDroid_Audit
|
||||||
@ -79,11 +80,10 @@ def main():
|
|||||||
m.update(app['id'])
|
m.update(app['id'])
|
||||||
keyalias = m.hexdigest()[:8]
|
keyalias = m.hexdigest()[:8]
|
||||||
if keyalias in allaliases:
|
if keyalias in allaliases:
|
||||||
print "There is a keyalias collision - publishing halted"
|
logging.info("There is a keyalias collision - publishing halted")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
allaliases.append(keyalias)
|
allaliases.append(keyalias)
|
||||||
if options.verbose:
|
logging.info("{0} apps, {0} key aliases".format(len(allapps), len(allaliases)))
|
||||||
print "{0} apps, {0} key aliases".format(len(allapps), len(allaliases))
|
|
||||||
|
|
||||||
# Process any apks that are waiting to be signed...
|
# Process any apks that are waiting to be signed...
|
||||||
for apkfile in sorted(glob.glob(os.path.join(unsigned_dir, '*.apk'))):
|
for apkfile in sorted(glob.glob(os.path.join(unsigned_dir, '*.apk'))):
|
||||||
@ -95,7 +95,7 @@ def main():
|
|||||||
if appid in vercodes and vercodes[appid]:
|
if appid in vercodes and vercodes[appid]:
|
||||||
if vercode not in vercodes[appid]:
|
if vercode not in vercodes[appid]:
|
||||||
continue
|
continue
|
||||||
print "Processing " + apkfile
|
logging.info("Processing " + apkfile)
|
||||||
|
|
||||||
# Figure out the key alias name we'll use. Only the first 8
|
# Figure out the key alias name we'll use. Only the first 8
|
||||||
# characters are significant, so we'll use the first 8 from
|
# characters are significant, so we'll use the first 8 from
|
||||||
@ -114,7 +114,7 @@ def main():
|
|||||||
m = md5.new()
|
m = md5.new()
|
||||||
m.update(appid)
|
m.update(appid)
|
||||||
keyalias = m.hexdigest()[:8]
|
keyalias = m.hexdigest()[:8]
|
||||||
print "Key alias: " + keyalias
|
logging.info("Key alias: " + keyalias)
|
||||||
|
|
||||||
# See if we already have a key for this application, and
|
# See if we already have a key for this application, and
|
||||||
# if not generate one...
|
# if not generate one...
|
||||||
@ -122,7 +122,7 @@ def main():
|
|||||||
'-alias', keyalias, '-keystore', config['keystore'],
|
'-alias', keyalias, '-keystore', config['keystore'],
|
||||||
'-storepass', config['keystorepass']])
|
'-storepass', config['keystorepass']])
|
||||||
if p.returncode !=0:
|
if p.returncode !=0:
|
||||||
print "Key does not exist - generating..."
|
logging.info("Key does not exist - generating...")
|
||||||
p = FDroidPopen(['keytool', '-genkey',
|
p = FDroidPopen(['keytool', '-genkey',
|
||||||
'-keystore', config['keystore'], '-alias', keyalias,
|
'-keystore', config['keystore'], '-alias', keyalias,
|
||||||
'-keyalg', 'RSA', '-keysize', '2048',
|
'-keyalg', 'RSA', '-keysize', '2048',
|
||||||
@ -155,7 +155,7 @@ def main():
|
|||||||
shutil.move(os.path.join(unsigned_dir, tarfilename),
|
shutil.move(os.path.join(unsigned_dir, tarfilename),
|
||||||
os.path.join(output_dir, tarfilename))
|
os.path.join(output_dir, tarfilename))
|
||||||
|
|
||||||
print 'Published ' + apkfilename
|
logging.info('Published ' + apkfilename)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -21,6 +21,7 @@ import sys
|
|||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
import logging
|
||||||
import common
|
import common
|
||||||
|
|
||||||
config = None
|
config = None
|
||||||
@ -40,11 +41,11 @@ def main():
|
|||||||
config = common.read_config(options)
|
config = common.read_config(options)
|
||||||
|
|
||||||
if len(args) != 1:
|
if len(args) != 1:
|
||||||
print "Specify a single command"
|
logging.critical("Specify a single command")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if args[0] != 'init' and args[0] != 'update':
|
if args[0] != 'init' and args[0] != 'update':
|
||||||
print "The only commands currently supported are 'init' and 'update'"
|
logging.critical("The only commands currently supported are 'init' and 'update'")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
serverwebroot = config['serverwebroot'].rstrip('/').replace('//', '/')
|
serverwebroot = config['serverwebroot'].rstrip('/').replace('//', '/')
|
||||||
|
@ -109,8 +109,8 @@ def main():
|
|||||||
notverified += 1
|
notverified += 1
|
||||||
|
|
||||||
logging.info("Finished")
|
logging.info("Finished")
|
||||||
print "{0} successfully verified".format(verified)
|
logging.info("{0} successfully verified".format(verified))
|
||||||
print "{0} NOT verified".format(notverified)
|
logging.info("{0} NOT verified".format(notverified))
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user