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

Merge branch 'rsync' into 'master'

build: rsync instead of sftp dirs to the buildserver

Closes #227

See merge request fdroid/fdroidserver!379
This commit is contained in:
Hans-Christoph Steiner 2017-11-26 21:50:24 +00:00
commit 9fda492b2f

View File

@ -98,22 +98,19 @@ 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):
startroot = os.path.dirname(path) logging.debug("rsyncing " + path + " to " + ftp.getcwd())
main = os.path.basename(path) subprocess.check_call(['rsync', '-rple',
ftp.mkdir(main) 'ssh -o StrictHostKeyChecking=no' +
for root, dirs, files in os.walk(path): ' -o UserKnownHostsFile=/dev/null' +
rr = os.path.relpath(root, startroot) ' -o LogLevel=FATAL' +
ftp.chdir(rr) ' -o IdentitiesOnly=yes' +
for d in dirs: ' -o PasswordAuthentication=no' +
ftp.mkdir(d) ' -p ' + str(sshinfo['port']) +
for f in files: ' -i ' + sshinfo['idfile'],
lfile = os.path.join(startroot, rr, f) path,
if not os.path.islink(lfile): sshinfo['user'] +
ftp.put(lfile, f) "@" + sshinfo['hostname'] +
ftp.chmod(f, os.stat(lfile).st_mode) ":" + ftp.getcwd()])
for i in range(len(rr.split('/'))):
ftp.chdir('..')
ftp.chdir('..')
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__))