1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-16 11:50:10 +01:00

Merge remote-tracking branch 'eighthave/rename-server-to-deploy'

This commit is contained in:
Michael Pöhn 2020-10-21 15:02:17 +02:00
commit c63c4b3deb
12 changed files with 106 additions and 142 deletions

View File

@ -537,6 +537,7 @@ include tests/check-fdroid-apk
include tests/common.TestCase include tests/common.TestCase
include tests/complete-ci-tests include tests/complete-ci-tests
include tests/config.py include tests/config.py
include tests/deploy.TestCase
include tests/description-parsing.py include tests/description-parsing.py
include tests/dummy-keystore.jks include tests/dummy-keystore.jks
include tests/dump_internal_metadata_format.py include tests/dump_internal_metadata_format.py
@ -667,7 +668,6 @@ include tests/repo/urzip-*.apk
include tests/repo/v1.v2.sig_1020.apk include tests/repo/v1.v2.sig_1020.apk
include tests/run-tests include tests/run-tests
include tests/scanner.TestCase include tests/scanner.TestCase
include tests/server.TestCase
include tests/signatures.TestCase include tests/signatures.TestCase
include tests/signindex/guardianproject.jar include tests/signindex/guardianproject.jar
include tests/signindex/guardianproject-v1.jar include tests/signindex/guardianproject-v1.jar

View File

@ -222,9 +222,9 @@ The repository of older versions of applications from the main demo repository.
# If you are running the repo signing process on a completely offline machine, # If you are running the repo signing process on a completely offline machine,
# which provides the best security, then you can specify a folder to sync the # which provides the best security, then you can specify a folder to sync the
# repo to when running `fdroid server update`. This is most likely going to # repo to when running `fdroid deploy`. This is most likely going to
# be a USB thumb drive, SD Card, or some other kind of removable media. Make # be a USB thumb drive, SD Card, or some other kind of removable media. Make
# sure it is mounted before running `fdroid server update`. Using the # sure it is mounted before running `fdroid deploy`. Using the
# standard folder called 'fdroid' as the specified folder is recommended, like # standard folder called 'fdroid' as the specified folder is recommended, like
# with serverwebroot. # with serverwebroot.
# #

View File

@ -48,7 +48,7 @@ process_apk # NOQA: B101
process_apks # NOQA: B101 process_apks # NOQA: B101
scan_apk # NOQA: B101 scan_apk # NOQA: B101
scan_repo_files # NOQA: B101 scan_repo_files # NOQA: B101
from fdroidserver.server import (update_awsbucket, from fdroidserver.deploy import (update_awsbucket,
update_servergitmirrors, update_servergitmirrors,
update_serverwebroot) # NOQA: E402 update_serverwebroot) # NOQA: E402
update_awsbucket # NOQA: B101 update_awsbucket # NOQA: B101

View File

@ -48,7 +48,6 @@ COMMANDS = OrderedDict([
("lint", _("Warn about possible metadata errors")), ("lint", _("Warn about possible metadata errors")),
("scanner", _("Scan the source code of a package")), ("scanner", _("Scan the source code of a package")),
("stats", _("Update the stats of the repo")), ("stats", _("Update the stats of the repo")),
("server", _("Old, deprecated name for fdroid deploy")),
("signindex", _("Sign indexes created using update --nosign")), ("signindex", _("Sign indexes created using update --nosign")),
("btlog", _("Update the binary transparency log for a URL")), ("btlog", _("Update the binary transparency log for a URL")),
("signatures", _("Extract signatures from APKs")), ("signatures", _("Extract signatures from APKs")),
@ -137,6 +136,9 @@ def main():
if command in ('-h', '--help'): if command in ('-h', '--help'):
print_help(available_plugins=available_plugins) print_help(available_plugins=available_plugins)
sys.exit(0) sys.exit(0)
elif command == 'server':
print(_("""ERROR: The "server" subcommand has been removed, use "deploy"!"""))
sys.exit(1)
elif command == '--version': elif command == '--version':
output = _('no version info found!') output = _('no version info found!')
cmddir = os.path.realpath(os.path.dirname(os.path.dirname(__file__))) cmddir = os.path.realpath(os.path.dirname(os.path.dirname(__file__)))
@ -187,11 +189,6 @@ def main():
"can not be specified at the same time.")) "can not be specified at the same time."))
sys.exit(1) sys.exit(1)
# temporary workaround until server.py becomes deploy.py
if command == 'deploy':
command = 'server'
sys.argv.insert(2, 'update')
# Trick optparse into displaying the right usage when --help is used. # Trick optparse into displaying the right usage when --help is used.
sys.argv[0] += ' ' + command sys.argv[0] += ' ' + command

View File

@ -42,7 +42,7 @@ from argparse import ArgumentParser
from . import _ from . import _
from . import common from . import common
from . import server from . import deploy
from .exception import FDroidException from .exception import FDroidException
@ -219,7 +219,7 @@ def main():
os.chdir(tempdirbase) os.chdir(tempdirbase)
make_binary_transparency_log(repodirs, options.git_repo, options.url, 'fdroid btlog') make_binary_transparency_log(repodirs, options.git_repo, options.url, 'fdroid btlog')
if options.git_remote: if options.git_remote:
server.push_binary_transparency(options.git_repo, options.git_remote) deploy.push_binary_transparency(options.git_repo, options.git_remote)
shutil.rmtree(tempdirbase, ignore_errors=True) shutil.rmtree(tempdirbase, ignore_errors=True)

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# #
# server.py - part of the FDroid server tools # deploy.py - part of the FDroid server tools
# Copyright (C) 2010-15, Ciaran Gultnieks, ciaran@ciarang.com # Copyright (C) 2010-15, Ciaran Gultnieks, ciaran@ciarang.com
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
@ -21,8 +21,6 @@ import glob
import hashlib import hashlib
import json import json
import os import os
import paramiko
import pwd
import re import re
import subprocess import subprocess
import time import time
@ -43,7 +41,7 @@ start_timestamp = time.gmtime()
BINARY_TRANSPARENCY_DIR = 'binary_transparency' BINARY_TRANSPARENCY_DIR = 'binary_transparency'
AUTO_S3CFG = '.fdroid-server-update-s3cfg' AUTO_S3CFG = '.fdroid-deploy-s3cfg'
USER_S3CFG = 's3cfg' USER_S3CFG = 's3cfg'
REMOTE_HOSTNAME_REGEX = re.compile(r'\W*\w+\W+(\w+).*') REMOTE_HOSTNAME_REGEX = re.compile(r'\W*\w+\W+(\w+).*')
@ -346,7 +344,7 @@ def update_servergitmirrors(servergitmirrors, repo_section):
from clint.textui import progress from clint.textui import progress
if config.get('local_copy_dir') \ if config.get('local_copy_dir') \
and not config.get('sync_from_local_copy_dir'): and not config.get('sync_from_local_copy_dir'):
logging.debug('Offline machine, skipping git mirror generation until `fdroid server update`') logging.debug(_('Offline machine, skipping git mirror generation until `fdroid deploy`'))
return return
# right now we support only 'repo' git-mirroring # right now we support only 'repo' git-mirroring
@ -699,10 +697,8 @@ def update_wiki():
def main(): def main():
global config, options global config, options
# Parse command line...
parser = ArgumentParser() parser = ArgumentParser()
common.setup_global_opts(parser) common.setup_global_opts(parser)
parser.add_argument("command", help=_("command to execute, either 'init' or 'update'"))
parser.add_argument("-i", "--identity-file", default=None, parser.add_argument("-i", "--identity-file", default=None,
help=_("Specify an identity file to provide to SSH for rsyncing")) help=_("Specify an identity file to provide to SSH for rsyncing"))
parser.add_argument("--local-copy-dir", default=None, parser.add_argument("--local-copy-dir", default=None,
@ -712,13 +708,8 @@ def main():
parser.add_argument("--no-keep-git-mirror-archive", action="store_true", default=False, parser.add_argument("--no-keep-git-mirror-archive", action="store_true", default=False,
help=_("If a git mirror gets to big, allow the archive to be deleted")) help=_("If a git mirror gets to big, allow the archive to be deleted"))
options = parser.parse_args() options = parser.parse_args()
config = common.read_config(options) config = common.read_config(options)
if options.command != 'init' and options.command != 'update':
logging.critical(_("The only commands currently supported are 'init' and 'update'"))
sys.exit(1)
if config.get('nonstandardwebroot') is True: if config.get('nonstandardwebroot') is True:
standardwebroot = False standardwebroot = False
else: else:
@ -792,52 +783,29 @@ def main():
if config['per_app_repos']: if config['per_app_repos']:
repo_sections += common.get_per_app_repos() repo_sections += common.get_per_app_repos()
if options.command == 'init': for repo_section in repo_sections:
ssh = paramiko.SSHClient() if local_copy_dir is not None:
ssh.load_system_host_keys() if config['sync_from_local_copy_dir']:
for serverwebroot in config.get('serverwebroot', []): sync_from_localcopy(repo_section, local_copy_dir)
sshstr, remotepath = serverwebroot.rstrip('/').split(':')
if sshstr.find('@') >= 0:
username, hostname = sshstr.split('@')
else: else:
username = pwd.getpwuid(os.getuid())[0] # get effective uid update_localcopy(repo_section, local_copy_dir)
hostname = sshstr for serverwebroot in config.get('serverwebroot', []):
ssh.connect(hostname, username=username) update_serverwebroot(serverwebroot, repo_section)
sftp = ssh.open_sftp() if config.get('servergitmirrors', []):
if os.path.basename(remotepath) \ # update_servergitmirrors will take care of multiple mirrors so don't need a foreach
not in sftp.listdir(os.path.dirname(remotepath)): servergitmirrors = config.get('servergitmirrors', [])
sftp.mkdir(remotepath, mode=0o755) update_servergitmirrors(servergitmirrors, repo_section)
for repo_section in repo_sections: if config.get('awsbucket'):
repo_path = os.path.join(remotepath, repo_section) update_awsbucket(repo_section)
if os.path.basename(repo_path) \ if config.get('androidobservatory'):
not in sftp.listdir(remotepath): upload_to_android_observatory(repo_section)
sftp.mkdir(repo_path, mode=0o755) if config.get('virustotal_apikey'):
sftp.close() upload_to_virustotal(repo_section, config.get('virustotal_apikey'))
ssh.close()
elif options.command == 'update':
for repo_section in repo_sections:
if local_copy_dir is not None:
if config['sync_from_local_copy_dir']:
sync_from_localcopy(repo_section, local_copy_dir)
else:
update_localcopy(repo_section, local_copy_dir)
for serverwebroot in config.get('serverwebroot', []):
update_serverwebroot(serverwebroot, repo_section)
if config.get('servergitmirrors', []):
# update_servergitmirrors will take care of multiple mirrors so don't need a foreach
servergitmirrors = config.get('servergitmirrors', [])
update_servergitmirrors(servergitmirrors, repo_section)
if config.get('awsbucket'):
update_awsbucket(repo_section)
if config.get('androidobservatory'):
upload_to_android_observatory(repo_section)
if config.get('virustotal_apikey'):
upload_to_virustotal(repo_section, config.get('virustotal_apikey'))
binary_transparency_remote = config.get('binary_transparency_remote') binary_transparency_remote = config.get('binary_transparency_remote')
if binary_transparency_remote: if binary_transparency_remote:
push_binary_transparency(BINARY_TRANSPARENCY_DIR, push_binary_transparency(BINARY_TRANSPARENCY_DIR,
binary_transparency_remote) binary_transparency_remote)
if config.get('wiki_server') and config.get('wiki_path'): if config.get('wiki_server') and config.get('wiki_path'):
update_wiki() update_wiki()

View File

@ -301,7 +301,7 @@ Last updated: {date}'''.format(repo_git_base=repo_git_base,
if not options.no_deploy: if not options.no_deploy:
try: try:
cmd = ['fdroid', 'server', 'update', '--verbose', '--no-keep-git-mirror-archive'] cmd = ['fdroid', 'deploy', '--verbose', '--no-keep-git-mirror-archive']
subprocess.check_call(cmd, cwd=repo_basedir) subprocess.check_call(cmd, cwd=repo_basedir)
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
logging.error(_('cannot publish update, did you set the deploy key?') logging.error(_('cannot publish update, did you set the deploy key?')

View File

@ -3,6 +3,7 @@ fdroidserver/btlog.py
fdroidserver/build.py fdroidserver/build.py
fdroidserver/checkupdates.py fdroidserver/checkupdates.py
fdroidserver/common.py fdroidserver/common.py
fdroidserver/deploy.py
fdroidserver/import.py fdroidserver/import.py
fdroidserver/init.py fdroidserver/init.py
fdroidserver/install.py fdroidserver/install.py
@ -11,7 +12,6 @@ fdroidserver/metadata.py
fdroidserver/publish.py fdroidserver/publish.py
fdroidserver/rewritemeta.py fdroidserver/rewritemeta.py
fdroidserver/scanner.py fdroidserver/scanner.py
fdroidserver/server.py
fdroidserver/stats.py fdroidserver/stats.py
fdroidserver/update.py fdroidserver/update.py
fdroidserver/verify.py fdroidserver/verify.py

View File

@ -66,7 +66,7 @@ msgstr ""
msgid "\"{path}\" contains recent {name} ({version})" msgid "\"{path}\" contains recent {name} ({version})"
msgstr "" msgstr ""
#: ../fdroidserver/server.py ../fdroidserver/upload.py #: ../fdroidserver/deploy.py ../fdroidserver/upload.py
#, python-brace-format #, python-brace-format
msgid "\"{path}\" exists but s3cmd is not installed!" msgid "\"{path}\" exists but s3cmd is not installed!"
msgstr "" msgstr ""
@ -505,12 +505,12 @@ msgstr ""
msgid "Create skeleton metadata files that are missing" msgid "Create skeleton metadata files that are missing"
msgstr "" msgstr ""
#: ../fdroidserver/server.py ../fdroidserver/upload.py #: ../fdroidserver/deploy.py ../fdroidserver/upload.py
#, python-brace-format #, python-brace-format
msgid "Created new container \"{name}\"" msgid "Created new container \"{name}\""
msgstr "" msgstr ""
#: ../fdroidserver/server.py ../fdroidserver/upload.py #: ../fdroidserver/deploy.py ../fdroidserver/upload.py
#, python-brace-format #, python-brace-format
msgid "Creating \"{path}\" for configuring s3cmd." msgid "Creating \"{path}\" for configuring s3cmd."
msgstr "" msgstr ""
@ -519,7 +519,7 @@ msgstr ""
msgid "Creating log directory" msgid "Creating log directory"
msgstr "" msgstr ""
#: ../fdroidserver/server.py ../fdroidserver/upload.py #: ../fdroidserver/deploy.py ../fdroidserver/upload.py
#, python-brace-format #, python-brace-format
msgid "Creating new S3 bucket: {url}" msgid "Creating new S3 bucket: {url}"
msgstr "" msgstr ""
@ -554,12 +554,12 @@ msgstr ""
msgid "Delete APKs and/or OBBs without metadata from the repo" msgid "Delete APKs and/or OBBs without metadata from the repo"
msgstr "" msgstr ""
#: ../fdroidserver/server.py #: ../fdroidserver/deploy.py
#, python-brace-format #, python-brace-format
msgid "Deleting archive, repo is too big ({size} max {limit})" msgid "Deleting archive, repo is too big ({size} max {limit})"
msgstr "" msgstr ""
#: ../fdroidserver/server.py #: ../fdroidserver/deploy.py
#, python-brace-format #, python-brace-format
msgid "Deleting git-mirror history, repo is too big ({size} max {limit})" msgid "Deleting git-mirror history, repo is too big ({size} max {limit})"
msgstr "" msgstr ""
@ -621,7 +621,7 @@ msgstr ""
msgid "Don't refresh the repository, useful when testing a build with no internet connection" msgid "Don't refresh the repository, useful when testing a build with no internet connection"
msgstr "" msgstr ""
#: ../fdroidserver/server.py ../fdroidserver/nightly.py #: ../fdroidserver/deploy.py ../fdroidserver/nightly.py
#: ../fdroidserver/upload.py #: ../fdroidserver/upload.py
msgid "Don't use rsync checksums" msgid "Don't use rsync checksums"
msgstr "" msgstr ""
@ -684,7 +684,7 @@ msgid ""
"> " "> "
msgstr "" msgstr ""
#: ../fdroidserver/server.py ../fdroidserver/checkupdates.py #: ../fdroidserver/deploy.py ../fdroidserver/checkupdates.py
#: ../fdroidserver/upload.py #: ../fdroidserver/upload.py
#, python-format #, python-format
msgid "Error while attempting to publish log: %s" msgid "Error while attempting to publish log: %s"
@ -722,7 +722,7 @@ msgstr ""
msgid "Failed to align application" msgid "Failed to align application"
msgstr "" msgstr ""
#: ../fdroidserver/server.py ../fdroidserver/upload.py #: ../fdroidserver/deploy.py ../fdroidserver/upload.py
#, python-brace-format #, python-brace-format
msgid "Failed to create S3 bucket: {url}" msgid "Failed to create S3 bucket: {url}"
msgstr "" msgstr ""
@ -848,7 +848,7 @@ msgstr ""
msgid "Found non-file at %s" msgid "Found non-file at %s"
msgstr "" msgstr ""
#: ../fdroidserver/server.py #: ../fdroidserver/deploy.py
#, python-brace-format #, python-brace-format
msgid "Found {apkfilename} at {url}" msgid "Found {apkfilename} at {url}"
msgstr "" msgstr ""
@ -896,11 +896,11 @@ msgstr ""
msgid "HTTPS must be used with Subversion URLs!" msgid "HTTPS must be used with Subversion URLs!"
msgstr "" msgstr ""
#: ../fdroidserver/server.py #: ../fdroidserver/deploy.py
msgid "If a git mirror gets to big, allow the archive to be deleted" msgid "If a git mirror gets to big, allow the archive to be deleted"
msgstr "" msgstr ""
#: ../fdroidserver/server.py #: ../fdroidserver/deploy.py
#, python-brace-format #, python-brace-format
msgid "If this upload fails, try manually uploading to {url}" msgid "If this upload fails, try manually uploading to {url}"
msgstr "" msgstr ""
@ -1131,7 +1131,7 @@ msgstr ""
msgid "Malformed repository mirrors." msgid "Malformed repository mirrors."
msgstr "" msgstr ""
#: ../fdroidserver/server.py #: ../fdroidserver/deploy.py
msgid "Malformed serverwebroot line:" msgid "Malformed serverwebroot line:"
msgstr "" msgstr ""
@ -1193,7 +1193,7 @@ msgstr ""
msgid "No need to specify that the app is for Android" msgid "No need to specify that the app is for Android"
msgstr "" msgstr ""
#: ../fdroidserver/server.py #: ../fdroidserver/deploy.py
msgid "No option set! Edit your config.py to set at least one of these:" msgid "No option set! Edit your config.py to set at least one of these:"
msgstr "" msgstr ""
@ -1407,12 +1407,12 @@ msgstr ""
msgid "Push the log to this git remote repository" msgid "Push the log to this git remote repository"
msgstr "" msgstr ""
#: ../fdroidserver/server.py ../fdroidserver/upload.py #: ../fdroidserver/deploy.py ../fdroidserver/upload.py
#, python-brace-format #, python-brace-format
msgid "Pushing binary transparency log to {url}" msgid "Pushing binary transparency log to {url}"
msgstr "" msgstr ""
#: ../fdroidserver/server.py ../fdroidserver/upload.py #: ../fdroidserver/deploy.py ../fdroidserver/upload.py
#, python-brace-format #, python-brace-format
msgid "Pushing to {url}" msgid "Pushing to {url}"
msgstr "" msgstr ""
@ -1506,7 +1506,7 @@ msgstr ""
msgid "Run rewritemeta to fix formatting" msgid "Run rewritemeta to fix formatting"
msgstr "" msgstr ""
#: ../fdroidserver/server.py ../fdroidserver/upload.py #: ../fdroidserver/deploy.py ../fdroidserver/upload.py
msgid "Running first pass with MD5 checking disabled" msgid "Running first pass with MD5 checking disabled"
msgstr "" msgstr ""
@ -1613,11 +1613,11 @@ msgstr ""
msgid "Skipping {appid}: no builds specified" msgid "Skipping {appid}: no builds specified"
msgstr "" msgstr ""
#: ../fdroidserver/server.py ../fdroidserver/upload.py #: ../fdroidserver/deploy.py ../fdroidserver/upload.py
msgid "Specify a local folder to sync the repo to" msgid "Specify a local folder to sync the repo to"
msgstr "" msgstr ""
#: ../fdroidserver/server.py ../fdroidserver/upload.py #: ../fdroidserver/deploy.py ../fdroidserver/upload.py
msgid "Specify an identity file to provide to SSH for rsyncing" msgid "Specify an identity file to provide to SSH for rsyncing"
msgstr "" msgstr ""
@ -1680,7 +1680,7 @@ msgstr ""
msgid "The file to be included in the repo (path or glob)" msgid "The file to be included in the repo (path or glob)"
msgstr "" msgstr ""
#: ../fdroidserver/server.py #: ../fdroidserver/deploy.py
msgid "The only commands currently supported are 'init' and 'update'" msgid "The only commands currently supported are 'init' and 'update'"
msgstr "" msgstr ""
@ -1692,7 +1692,7 @@ msgstr ""
msgid "The repository's index could not be verified." msgid "The repository's index could not be verified."
msgstr "" msgstr ""
#: ../fdroidserver/server.py #: ../fdroidserver/deploy.py
#, python-brace-format #, python-brace-format
msgid "The root dir for local_copy_dir \"{path}\" does not exist!" msgid "The root dir for local_copy_dir \"{path}\" does not exist!"
msgstr "" msgstr ""
@ -1710,7 +1710,7 @@ msgstr ""
msgid "This repo already has local metadata: %s" msgid "This repo already has local metadata: %s"
msgstr "" msgstr ""
#: ../fdroidserver/server.py ../fdroidserver/upload.py #: ../fdroidserver/deploy.py ../fdroidserver/upload.py
msgid "To use awsbucket, awssecretkey and awsaccesskeyid must also be set in config.py!" msgid "To use awsbucket, awssecretkey and awsaccesskeyid must also be set in config.py!"
msgstr "" msgstr ""
@ -1901,12 +1901,12 @@ msgstr ""
msgid "UpdateCheckName is set to the known application ID, it can be removed" msgid "UpdateCheckName is set to the known application ID, it can be removed"
msgstr "" msgstr ""
#: ../fdroidserver/server.py #: ../fdroidserver/deploy.py
#, python-brace-format #, python-brace-format
msgid "Uploading {apkfilename} to androidobservatory.org" msgid "Uploading {apkfilename} to androidobservatory.org"
msgstr "" msgstr ""
#: ../fdroidserver/server.py #: ../fdroidserver/deploy.py
#, python-brace-format #, python-brace-format
msgid "Uploading {apkfilename} to virustotal" msgid "Uploading {apkfilename} to virustotal"
msgstr "" msgstr ""
@ -1941,7 +1941,7 @@ msgstr ""
msgid "Use date from apk instead of current time for newly added apks" msgid "Use date from apk instead of current time for newly added apks"
msgstr "" msgstr ""
#: ../fdroidserver/server.py ../fdroidserver/upload.py #: ../fdroidserver/deploy.py ../fdroidserver/upload.py
#, python-brace-format #, python-brace-format
msgid "Using \"{path}\" for configuring s3cmd." msgid "Using \"{path}\" for configuring s3cmd."
msgstr "" msgstr ""
@ -1968,7 +1968,7 @@ msgstr ""
msgid "Using existing keystore \"{path}\"" msgid "Using existing keystore \"{path}\""
msgstr "" msgstr ""
#: ../fdroidserver/server.py ../fdroidserver/upload.py #: ../fdroidserver/deploy.py ../fdroidserver/upload.py
#, python-brace-format #, python-brace-format
msgid "Using s3cmd to sync with: {url}" msgid "Using s3cmd to sync with: {url}"
msgstr "" msgstr ""
@ -1989,7 +1989,7 @@ msgstr ""
msgid "Verifying index signature:" msgid "Verifying index signature:"
msgstr "" msgstr ""
#: ../fdroidserver/server.py #: ../fdroidserver/deploy.py
#, python-brace-format #, python-brace-format
msgid "VirusTotal API key cannot upload files larger than 32MB, use {url} to upload {path}." msgid "VirusTotal API key cannot upload files larger than 32MB, use {url} to upload {path}."
msgstr "" msgstr ""
@ -2122,7 +2122,7 @@ msgstr ""
msgid "cloning {url}" msgid "cloning {url}"
msgstr "" msgstr ""
#: ../fdroidserver/server.py #: ../fdroidserver/deploy.py
msgid "command to execute, either 'init' or 'update'" msgid "command to execute, either 'init' or 'update'"
msgstr "" msgstr ""
@ -2287,16 +2287,16 @@ msgstr ""
msgid "invalid option string %(option)r: must start with a character %(prefix_chars)r" msgid "invalid option string %(option)r: must start with a character %(prefix_chars)r"
msgstr "" msgstr ""
#: ../fdroidserver/server.py #: ../fdroidserver/deploy.py
#, python-brace-format #, python-brace-format
msgid "local_copy_dir does not end with \"fdroid\", perhaps you meant: \"{path}\"" msgid "local_copy_dir does not end with \"fdroid\", perhaps you meant: \"{path}\""
msgstr "" msgstr ""
#: ../fdroidserver/server.py #: ../fdroidserver/deploy.py
msgid "local_copy_dir must be an absolute path!" msgid "local_copy_dir must be an absolute path!"
msgstr "" msgstr ""
#: ../fdroidserver/server.py #: ../fdroidserver/deploy.py
msgid "local_copy_dir must be directory, not a file!" msgid "local_copy_dir must be directory, not a file!"
msgstr "" msgstr ""
@ -2432,7 +2432,7 @@ msgstr ""
msgid "ruamel.yaml not installed, can not write metadata." msgid "ruamel.yaml not installed, can not write metadata."
msgstr "" msgstr ""
#: ../fdroidserver/server.py ../fdroidserver/upload.py #: ../fdroidserver/deploy.py ../fdroidserver/upload.py
#, python-brace-format #, python-brace-format
msgid "s3cmd sync indexes {path} to {url} and delete" msgid "s3cmd sync indexes {path} to {url} and delete"
msgstr "" msgstr ""
@ -2520,12 +2520,12 @@ msgstr ""
msgid "usage: fdroid [-h|--help|--version] <command> [<args>]" msgid "usage: fdroid [-h|--help|--version] <command> [<args>]"
msgstr "" msgstr ""
#: ../fdroidserver/server.py ../fdroidserver/upload.py #: ../fdroidserver/deploy.py ../fdroidserver/upload.py
#, python-brace-format #, python-brace-format
msgid "using Apache libcloud to sync with {url}" msgid "using Apache libcloud to sync with {url}"
msgstr "" msgstr ""
#: ../fdroidserver/server.py #: ../fdroidserver/deploy.py
msgid "virustotal.com is rate limiting, waiting to retry..." msgid "virustotal.com is rate limiting, waiting to retry..."
msgstr "" msgstr ""
@ -2642,7 +2642,7 @@ msgstr ""
msgid "{path} is zero size!" msgid "{path} is zero size!"
msgstr "" msgstr ""
#: ../fdroidserver/server.py #: ../fdroidserver/deploy.py
#, python-brace-format #, python-brace-format
msgid "{path} more than 200MB, manually upload: {url}" msgid "{path} more than 200MB, manually upload: {url}"
msgstr "" msgstr ""

View File

@ -15,29 +15,29 @@ if localmodule not in sys.path:
sys.path.insert(0, localmodule) sys.path.insert(0, localmodule)
import fdroidserver.common import fdroidserver.common
import fdroidserver.server import fdroidserver.deploy
from testcommon import TmpCwd from testcommon import TmpCwd
class ServerTest(unittest.TestCase): class DeployTest(unittest.TestCase):
'''fdroidserver/server.py''' '''fdroidserver/deploy.py'''
def setUp(self): def setUp(self):
logging.basicConfig(level=logging.DEBUG) logging.basicConfig(level=logging.DEBUG)
self.basedir = os.path.join(localmodule, 'tests') self.basedir = os.path.join(localmodule, 'tests')
fdroidserver.server.options = mock.Mock() fdroidserver.deploy.options = mock.Mock()
fdroidserver.server.config = {} fdroidserver.deploy.config = {}
def test_update_serverwebroot_make_cur_version_link(self): def test_update_serverwebroot_make_cur_version_link(self):
# setup parameters for this test run # setup parameters for this test run
fdroidserver.server.options.no_chcksum = True fdroidserver.deploy.options.no_chcksum = True
fdroidserver.server.options.identity_file = None fdroidserver.deploy.options.identity_file = None
fdroidserver.server.options.verbose = False fdroidserver.deploy.options.verbose = False
fdroidserver.server.options.quiet = True fdroidserver.deploy.options.quiet = True
fdroidserver.server.options.identity_file = None fdroidserver.deploy.options.identity_file = None
fdroidserver.server.config['make_current_version_link'] = True fdroidserver.deploy.config['make_current_version_link'] = True
serverwebroot = "example.com:/var/www/fdroid" serverwebroot = "example.com:/var/www/fdroid"
repo_section = 'repo' repo_section = 'repo'
@ -86,19 +86,19 @@ class ServerTest(unittest.TestCase):
os.symlink('repo/com.example.sym.apk.asc', 'Sym.apk.asc') os.symlink('repo/com.example.sym.apk.asc', 'Sym.apk.asc')
os.symlink('repo/com.example.sym.apk.sig', 'Sym.apk.sig') os.symlink('repo/com.example.sym.apk.sig', 'Sym.apk.sig')
with mock.patch('subprocess.call', side_effect=update_server_webroot_call): with mock.patch('subprocess.call', side_effect=update_server_webroot_call):
fdroidserver.server.update_serverwebroot(serverwebroot, fdroidserver.deploy.update_serverwebroot(serverwebroot,
repo_section) repo_section)
self.assertEqual(call_iteration, 3, 'expected 3 invocations of subprocess.call') self.assertEqual(call_iteration, 3, 'expected 3 invocations of subprocess.call')
def test_update_serverwebroot_with_id_file(self): def test_update_serverwebroot_with_id_file(self):
# setup parameters for this test run # setup parameters for this test run
fdroidserver.server.options.no_chcksum = False fdroidserver.deploy.options.no_chcksum = False
fdroidserver.server.options.verbose = True fdroidserver.deploy.options.verbose = True
fdroidserver.server.options.quiet = False fdroidserver.deploy.options.quiet = False
fdroidserver.server.options.identity_file = None fdroidserver.deploy.options.identity_file = None
fdroidserver.server.config['identity_file'] = './id_rsa' fdroidserver.deploy.config['identity_file'] = './id_rsa'
fdroidserver.server.config['make_current_version_link'] = False fdroidserver.deploy.config['make_current_version_link'] = False
serverwebroot = "example.com:/var/www/fdroid" serverwebroot = "example.com:/var/www/fdroid"
repo_section = 'archive' repo_section = 'archive'
@ -115,7 +115,7 @@ class ServerTest(unittest.TestCase):
'--verbose', '--verbose',
'-e', '-e',
'ssh -oBatchMode=yes -oIdentitiesOnly=yes -i ' 'ssh -oBatchMode=yes -oIdentitiesOnly=yes -i '
+ fdroidserver.server.config['identity_file'], + fdroidserver.deploy.config['identity_file'],
'--exclude', 'archive/index.xml', '--exclude', 'archive/index.xml',
'--exclude', 'archive/index.jar', '--exclude', 'archive/index.jar',
'--exclude', 'archive/index-v1.jar', '--exclude', 'archive/index-v1.jar',
@ -129,7 +129,7 @@ class ServerTest(unittest.TestCase):
'--verbose', '--verbose',
'-e', '-e',
'ssh -oBatchMode=yes -oIdentitiesOnly=yes -i ' 'ssh -oBatchMode=yes -oIdentitiesOnly=yes -i '
+ fdroidserver.server.config['identity_file'], + fdroidserver.deploy.config['identity_file'],
'archive', 'archive',
serverwebroot]) serverwebroot])
else: else:
@ -138,15 +138,15 @@ class ServerTest(unittest.TestCase):
return 0 return 0
with mock.patch('subprocess.call', side_effect=update_server_webroot_call): with mock.patch('subprocess.call', side_effect=update_server_webroot_call):
fdroidserver.server.update_serverwebroot(serverwebroot, fdroidserver.deploy.update_serverwebroot(serverwebroot,
repo_section) repo_section)
self.assertEqual(call_iteration, 2, 'expected 2 invocations of subprocess.call') self.assertEqual(call_iteration, 2, 'expected 2 invocations of subprocess.call')
@unittest.skipIf(not os.getenv('VIRUSTOTAL_API_KEY'), 'VIRUSTOTAL_API_KEY is not set') @unittest.skipIf(not os.getenv('VIRUSTOTAL_API_KEY'), 'VIRUSTOTAL_API_KEY is not set')
def test_upload_to_virustotal(self): def test_upload_to_virustotal(self):
fdroidserver.server.options.verbose = True fdroidserver.deploy.options.verbose = True
virustotal_apikey = os.getenv('VIRUSTOTAL_API_KEY') virustotal_apikey = os.getenv('VIRUSTOTAL_API_KEY')
fdroidserver.server.upload_to_virustotal('repo', virustotal_apikey) fdroidserver.deploy.upload_to_virustotal('repo', virustotal_apikey)
def test_remote_hostname_regex(self): def test_remote_hostname_regex(self):
for remote_url, name in ( for remote_url, name in (
@ -158,7 +158,7 @@ class ServerTest(unittest.TestCase):
): ):
self.assertEqual( self.assertEqual(
name, name,
fdroidserver.server.REMOTE_HOSTNAME_REGEX.sub(r'\1', remote_url) fdroidserver.deploy.REMOTE_HOSTNAME_REGEX.sub(r'\1', remote_url)
) )
@ -171,5 +171,5 @@ if __name__ == "__main__":
(fdroidserver.common.options, args) = parser.parse_args(['--verbose']) (fdroidserver.common.options, args) = parser.parse_args(['--verbose'])
newSuite = unittest.TestSuite() newSuite = unittest.TestSuite()
newSuite.addTest(unittest.makeSuite(ServerTest)) newSuite.addTest(unittest.makeSuite(DeployTest))
unittest.main(failfast=False) unittest.main(failfast=False)

View File

@ -42,7 +42,6 @@ class MainTest(unittest.TestCase):
'lint', 'lint',
'scanner', 'scanner',
'stats', 'stats',
'server',
'signindex', 'signindex',
'btlog', 'btlog',
'signatures', 'signatures',
@ -63,7 +62,7 @@ class MainTest(unittest.TestCase):
def test_call_deploy(self): def test_call_deploy(self):
co = mock.Mock() co = mock.Mock()
with mock.patch('sys.argv', ['', 'deploy', '-h']): with mock.patch('sys.argv', ['', 'deploy', '-h']):
with mock.patch('fdroidserver.server.main', co): with mock.patch('fdroidserver.deploy.main', co):
with mock.patch('sys.exit') as exit_mock: with mock.patch('sys.exit') as exit_mock:
fdroidserver.__main__.main() fdroidserver.__main__.main()
# note: this is sloppy, if `deploy` changes # note: this is sloppy, if `deploy` changes

View File

@ -691,7 +691,7 @@ $fdroid lint
$fdroid readmeta $fdroid readmeta
$fdroid rewritemeta fake $fdroid rewritemeta fake
$fdroid deploy $fdroid deploy
$fdroid server update $fdroid deploy
$fdroid scanner $fdroid scanner
# run these to get their output, but the are not setup, so don't fail # run these to get their output, but the are not setup, so don't fail
@ -725,26 +725,26 @@ cd $REPOROOT
$fdroid init $fdroid init
$fdroid update --create-metadata --verbose $fdroid update --create-metadata --verbose
$fdroid readmeta $fdroid readmeta
$fdroid server update --local-copy-dir=/tmp/fdroid $fdroid deploy --local-copy-dir=/tmp/fdroid
$fdroid deploy --local-copy-dir=/tmp/fdroid --verbose $fdroid deploy --local-copy-dir=/tmp/fdroid --verbose
# now test the errors work # now test the errors work
set +e set +e
$fdroid server update --local-copy-dir=thisisnotanabsolutepath $fdroid deploy --local-copy-dir=thisisnotanabsolutepath
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "This should have failed because thisisnotanabsolutepath is not an absolute path!" echo "This should have failed because thisisnotanabsolutepath is not an absolute path!"
exit 1 exit 1
else else
echo "testing absolute path checker passed" echo "testing absolute path checker passed"
fi fi
$fdroid server update --local-copy-dir=/tmp/IReallyDoubtThisPathExistsasdfasdf $fdroid deploy --local-copy-dir=/tmp/IReallyDoubtThisPathExistsasdfasdf
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "This should have failed because the path does not end with 'fdroid'!" echo "This should have failed because the path does not end with 'fdroid'!"
exit 1 exit 1
else else
echo "testing dirname exists checker passed" echo "testing dirname exists checker passed"
fi fi
$fdroid server update --local-copy-dir=/tmp/IReallyDoubtThisPathExistsasdfasdf/fdroid $fdroid deploy --local-copy-dir=/tmp/IReallyDoubtThisPathExistsasdfasdf/fdroid
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "This should have failed because the dirname path does not exist!" echo "This should have failed because the dirname path does not exist!"
exit 1 exit 1
@ -766,12 +766,12 @@ $fdroid readmeta
grep -F '<application id=' repo/index.xml > /dev/null grep -F '<application id=' repo/index.xml > /dev/null
LOCALCOPYDIR=`create_test_dir`/fdroid LOCALCOPYDIR=`create_test_dir`/fdroid
$fdroid server update --local-copy-dir=$LOCALCOPYDIR $fdroid deploy --local-copy-dir=$LOCALCOPYDIR
NEWREPOROOT=`create_test_dir` NEWREPOROOT=`create_test_dir`
cd $NEWREPOROOT cd $NEWREPOROOT
fdroid_init_with_prebuilt_keystore fdroid_init_with_prebuilt_keystore
echo "sync_from_local_copy_dir = True" >> config.py echo "sync_from_local_copy_dir = True" >> config.py
$fdroid server update --local-copy-dir=$LOCALCOPYDIR $fdroid deploy --local-copy-dir=$LOCALCOPYDIR
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
@ -1045,7 +1045,7 @@ cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $RE
echo "binary_transparency_remote = '$GIT_REMOTE'" >> config.py echo "binary_transparency_remote = '$GIT_REMOTE'" >> config.py
$fdroid update --verbose $fdroid update --verbose
if have_git_2_3; then if have_git_2_3; then
$fdroid server update --verbose $fdroid deploy --verbose
test -e repo/index.xml test -e repo/index.xml
test -e repo/index.jar test -e repo/index.jar
test -e repo/index-v1.jar test -e repo/index-v1.jar
@ -1204,7 +1204,7 @@ if have_git_2_3; then
cd binary_transparency cd binary_transparency
[ `git rev-list --count HEAD` == "1" ] [ `git rev-list --count HEAD` == "1" ]
cd .. cd ..
$fdroid server update --verbose $fdroid deploy --verbose
grep -F '<application id=' $LOCAL_COPY_DIR/repo/index.xml > /dev/null grep -F '<application id=' $LOCAL_COPY_DIR/repo/index.xml > /dev/null
cd $ONLINE_ROOT cd $ONLINE_ROOT
echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py
@ -1213,7 +1213,7 @@ if have_git_2_3; then
echo "servergitmirrors = '$SERVER_GIT_MIRROR'" >> config.py echo "servergitmirrors = '$SERVER_GIT_MIRROR'" >> config.py
echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py
echo "binary_transparency_remote = '$BINARY_TRANSPARENCY_REMOTE'" >> config.py echo "binary_transparency_remote = '$BINARY_TRANSPARENCY_REMOTE'" >> config.py
$fdroid server update --verbose $fdroid deploy --verbose
cd $BINARY_TRANSPARENCY_REMOTE cd $BINARY_TRANSPARENCY_REMOTE
[ `git rev-list --count HEAD` == "1" ] [ `git rev-list --count HEAD` == "1" ]
cd $SERVER_GIT_MIRROR cd $SERVER_GIT_MIRROR