build: better logging output on rsync failures

Save rsync error output and combine that with the command invocation
into an FDroidException which can be logged to the wiki.

This additionally sets -q for rsync to only print errors.
This commit is contained in:
Marcus Hoffmann 2017-12-05 21:31:55 +01:00
parent bb643eddcf
commit e12e1b6a5c

View file

@ -100,18 +100,22 @@ def build_server(app, build, vcs, build_dir, output_dir, log_dir, force):
# Helper to copy the contents of a directory to the server... # Helper to copy the contents of a directory to the server...
def send_dir(path): def send_dir(path):
logging.debug("rsyncing " + path + " to " + ftp.getcwd()) logging.debug("rsyncing " + path + " to " + ftp.getcwd())
subprocess.check_call(['rsync', '-rple', try:
'ssh -o StrictHostKeyChecking=no' + subprocess.check_output(['rsync', '-rplqe',
' -o UserKnownHostsFile=/dev/null' + 'ssh -o StrictHostKeyChecking=no' +
' -o LogLevel=FATAL' + ' -o UserKnownHostsFile=/dev/null' +
' -o IdentitiesOnly=yes' + ' -o LogLevel=FATAL' +
' -o PasswordAuthentication=no' + ' -o IdentitiesOnly=yes' +
' -p ' + str(sshinfo['port']) + ' -o PasswordAuthentication=no' +
' -i ' + sshinfo['idfile'], ' -p ' + str(sshinfo['port']) +
path, ' -i ' + sshinfo['idfile'],
sshinfo['user'] + path,
"@" + sshinfo['hostname'] + sshinfo['user'] +
":" + ftp.getcwd()]) "@" + sshinfo['hostname'] +
":" + ftp.getcwd()],
stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
raise FDroidException(str(e), e.output.decode())
logging.info("Preparing server for build...") logging.info("Preparing server for build...")
serverpath = os.path.abspath(os.path.dirname(__file__)) serverpath = os.path.abspath(os.path.dirname(__file__))