chiark / gitweb /
fix bad syncing from local copy, force trailing slash to make rsync happy
authorHans-Christoph Steiner <hans@eds.org>
Mon, 30 Jun 2014 20:09:57 +0000 (16:09 -0400)
committerHans-Christoph Steiner <hans@eds.org>
Tue, 1 Jul 2014 03:01:47 +0000 (23:01 -0400)
It seems that paths for rsync must have a trailing slash in order to sync
rather than make a subdir, i.e. this makes a duplicate subdir:

  rsync /tmp/fdroid/repo repo

While this syncs the dirs

  rsync /tmp/fdroid/repo/ repo/

fdroidserver/server.py

index 9b46de70a95ad93b226949b304479c502d3cdbb7..4e9023049e62ef366cc44c3a55ed1b68f46f4488 100644 (file)
@@ -157,9 +157,9 @@ def _local_sync(fromdir, todir):
 def sync_from_localcopy(repo_section, local_copy_dir):
     logging.info('Syncing from local_copy_dir to this repo.')
     # trailing slashes have a meaning in rsync which is not needed here, so
-    # remove them all
-    _local_sync(os.path.join(local_copy_dir, repo_section).rstrip('/'),
-                repo_section.rstrip('/'))
+    # make sure both paths have exactly one trailing slash
+    _local_sync(os.path.join(local_copy_dir, repo_section).rstrip('/') + '/',
+                repo_section.rstrip('/') + '/')
 
 
 def update_localcopy(repo_section, local_copy_dir):