chiark / gitweb /
build: write out full rsync options
[fdroidserver.git] / fdroidserver / build.py
index 16901e780561eaad4ee9db90f351cf795ab9a7b6..bbb5a2b4d0b2e7492210c1298f5ada9177e85b83 100644 (file)
@@ -100,18 +100,20 @@ def build_server(app, build, vcs, build_dir, output_dir, log_dir, force):
         # Helper to copy the contents of a directory to the server...
         def send_dir(path):
             logging.debug("rsyncing " + path + " to " + ftp.getcwd())
-            subprocess.check_call(['rsync', '-rple',
-                                   'ssh -o StrictHostKeyChecking=no' +
-                                   ' -o UserKnownHostsFile=/dev/null' +
-                                   ' -o LogLevel=FATAL' +
-                                   ' -o IdentitiesOnly=yes' +
-                                   ' -o PasswordAuthentication=no' +
-                                   ' -p ' + str(sshinfo['port']) +
-                                   ' -i ' + sshinfo['idfile'],
-                                   path,
-                                   sshinfo['user'] +
-                                   "@" + sshinfo['hostname'] +
-                                   ":" + ftp.getcwd()])
+            try:
+                subprocess.check_output(['rsync', '--recursive', '--perms', '--links', '--quiet', '--rsh=' +
+                                         'ssh -o StrictHostKeyChecking=no' +
+                                         ' -o UserKnownHostsFile=/dev/null' +
+                                         ' -o LogLevel=FATAL' +
+                                         ' -o IdentitiesOnly=yes' +
+                                         ' -o PasswordAuthentication=no' +
+                                         ' -p ' + str(sshinfo['port']) +
+                                         ' -i ' + sshinfo['idfile'],
+                                         path,
+                                         sshinfo['user'] + "@" + 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...")
         serverpath = os.path.abspath(os.path.dirname(__file__))
@@ -1111,7 +1113,7 @@ def main():
 
     # Read all app and srclib metadata
     pkgs = common.read_pkg_args(options.appid, True)
-    allapps = metadata.read_metadata(not options.onserver, pkgs)
+    allapps = metadata.read_metadata(not options.onserver, pkgs, sort_by_time=True)
     apps = common.read_app_args(options.appid, allapps, True)
 
     for appid, app in list(apps.items()):
@@ -1167,9 +1169,9 @@ def main():
                 # there are any.
                 if first:
                     vcs, build_dir = common.setup_vcs(app)
-                    logging.info("Using %s" % vcs.clientversion())
                     first = False
 
+                logging.info("Using %s" % vcs.clientversion())
                 logging.debug("Checking " + build.versionName)
                 if trybuild(app, build, build_dir, output_dir, log_dir,
                             also_check_dir, srclib_dir, extlib_dir,
@@ -1345,7 +1347,10 @@ def main():
         logging.info(ngettext("{} build failed",
                               "{} builds failed", len(failed_apps)).format(len(failed_apps)))
 
-    sys.exit(0)
+    # hack to ensure this exits, even is some threads are still running
+    sys.stdout.flush()
+    sys.stderr.flush()
+    os._exit(0)
 
 
 if __name__ == "__main__":