summaryrefslogtreecommitdiff
path: root/nightly-stats.patch
blob: ae80fee1173d39b63d53117d2fe0ab0231f609f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
diff --git a/fdroidserver/nightly.py b/fdroidserver/nightly.py
index 7a90294d..9ad806b3 100644
--- a/fdroidserver/nightly.py
+++ b/fdroidserver/nightly.py
@@ -102,7 +102,7 @@ def main():
                         help=_('The file to be included in the repo (path or glob)'))
     parser.add_argument("--no-checksum", action="store_true", default=False,
                         help=_("Don't use rsync checksums"))
-    parser.add_argument("--archive-older", default=20,
+    parser.add_argument("--archive-older", type=int, default=20,
                         help=_("Set maximum releases in repo before older ones are archived"))
     # TODO add --with-btlog
     options = parser.parse_args()
@@ -170,6 +170,7 @@ def main():
         git_mirror_path = os.path.join(repo_basedir, 'git-mirror')
         git_mirror_repodir = os.path.join(git_mirror_path, 'fdroid', 'repo')
         git_mirror_metadatadir = os.path.join(git_mirror_path, 'fdroid', 'metadata')
+        git_mirror_statsdir = os.path.join(git_mirror_path, 'fdroid', 'stats')
         if not os.path.isdir(git_mirror_repodir):
             logging.debug(_('cloning {url}').format(url=clone_url))
             try:
@@ -217,6 +218,8 @@ Last updated: {date}'''.format(repo_git_base=repo_git_base,
             common.local_rsync(options, git_mirror_repodir + '/', 'repo/')
         if os.path.isdir(git_mirror_metadatadir):
             common.local_rsync(options, git_mirror_metadatadir + '/', 'metadata/')
+        if os.path.isdir(git_mirror_statsdir):
+            common.local_rsync(options, git_mirror_statsdir + '/', 'stats/')
 
         ssh_private_key_file = _ssh_key_from_debug_keystore()
         # this is needed for GitPython to find the SSH key
@@ -244,7 +248,7 @@ Last updated: {date}'''.format(repo_git_base=repo_git_base,
         config += "keydname = '%s'\n" % DISTINGUISHED_NAME
         config += "make_current_version_link = False\n"
         config += "accepted_formats = ('txt', 'yml')\n"
-        # TODO add update_stats = True
+        config += "update_stats = True\n"
         with open('config.py', 'w') as fp:
             fp.write(config)
         os.chmod('config.py', 0o600)
@@ -291,6 +295,7 @@ Last updated: {date}'''.format(repo_git_base=repo_git_base,
         subprocess.check_call(['fdroid', 'update', '--rename-apks', '--create-metadata', '--verbose'],
                               cwd=repo_basedir)
         common.local_rsync(options, repo_basedir + '/metadata/', git_mirror_metadatadir + '/')
+        common.local_rsync(options, repo_basedir + '/stats/', git_mirror_statsdir + '/')
         mirror_git_repo.git.add(all=True)
         mirror_git_repo.index.commit("update app metadata")