From d54ad41938a0db5fd4ce287a2e7803cdfb823db3 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 28 Nov 2016 21:18:17 +0100 Subject: [PATCH 1/4] fix bad caching of non-APK files in the repo Silly mistake in 07ce9488097c1361c1cc1a515773fb73199550bf --- fdroidserver/update.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fdroidserver/update.py b/fdroidserver/update.py index f18cf49a..2c189e9f 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -565,7 +565,8 @@ def scan_repo_files(apkcache, repodir, knownapks, use_date_from_file=False): usecache = True else: logging.debug("Ignoring stale cache data for " + name) - elif not usecache: + + if not usecache: logging.debug("Processing " + name) repo_file = {} # TODO rename apkname globally to something more generic From 78a3e35ef797e2ce00f7ffe37c05f0fc99ea2de5 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 28 Nov 2016 15:23:59 +0100 Subject: [PATCH 2/4] break out categories.txt generation to standalone method This is to clean up the code for the introduction of a new index format. This also makes it so that only repo/categories.txt is generated, and not archive/categories.txt. Currently, the only thing that I can find that reads categories.txt is the wordpress plugin, e.g. wp-fdroid. And it only reads repo/categories.txt not archive/categories.txt. --- fdroidserver/update.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/fdroidserver/update.py b/fdroidserver/update.py index 2c189e9f..48509e65 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -961,8 +961,8 @@ def extract_pubkey(): return hexlify(pubkey) -def make_index(apps, sortedids, apks, repodir, archive, categories): - """Make a repo index. +def make_index(apps, sortedids, apks, repodir, archive): + """Generate the repo index files. :param apps: fully populated apps list :param apks: full populated apks list @@ -1297,7 +1297,9 @@ def make_index(apps, sortedids, apks, repodir, archive, categories): iconfilename = os.path.join(icon_dir, os.path.basename(config['repo_icon'])) shutil.copyfile(config['repo_icon'], iconfilename) - # Write a category list in the repo to allow quick access... + +def make_categories_txt(repodir, categories): + '''Write a category list in the repo to allow quick access''' catdata = '' for cat in categories: catdata += cat + '\n' @@ -1612,7 +1614,7 @@ def main(): appdict = dict() appdict[appid] = app if os.path.isdir(repodir): - make_index(appdict, [appid], apks, repodir, False, categories) + make_index(appdict, [appid], apks, repodir, False) else: logging.info('Skipping index generation for ' + appid) return @@ -1621,12 +1623,13 @@ def main(): archive_old_apks(apps, apks, archapks, repodirs[0], repodirs[1], config['archive_older']) # Make the index for the main repo... - make_index(apps, sortedids, apks, repodirs[0], False, categories) + make_index(apps, sortedids, apks, repodirs[0], False) + make_categories_txt(repodirs[0], categories) # If there's an archive repo, make the index for it. We already scanned it # earlier on. if len(repodirs) > 1: - make_index(apps, sortedids, archapks, repodirs[1], True, categories) + make_index(apps, sortedids, archapks, repodirs[1], True) if config['update_stats']: From d08bd32a357498cbd60b2dc925c388edf3bd8c77 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 9 Jan 2017 15:12:27 +0100 Subject: [PATCH 3/4] update URL for git repo of test app --- tests/import.TestCase | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/import.TestCase b/tests/import.TestCase index 3cfdb92e..cd71c56f 100755 --- a/tests/import.TestCase +++ b/tests/import.TestCase @@ -31,7 +31,7 @@ class ImportTest(unittest.TestCase): fdroidserver.common.fill_config_defaults(config) fdroidserver.common.config = config - url = 'https://gitlab.com/eighthave/ci-test-app' + url = 'https://gitlab.com/fdroid/ci-test-app' r = requests.head(url) if r.status_code != 200: print("ERROR", url, 'unreachable (', r.status_code, ')') @@ -42,8 +42,8 @@ class ImportTest(unittest.TestCase): app.UpdateCheckMode = "Tags" root_dir, src_dir = import_proxy.get_metadata_from_url(app, url) self.assertEqual(app.RepoType, 'git') - self.assertEqual(app.WebSite, 'https://gitlab.com/eighthave/ci-test-app') - self.assertEqual(app.Repo, 'https://gitlab.com/eighthave/ci-test-app.git') + self.assertEqual(app.WebSite, 'https://gitlab.com/fdroid/ci-test-app') + self.assertEqual(app.Repo, 'https://gitlab.com/fdroid/ci-test-app.git') if __name__ == "__main__": From 69d39bb30101e8fdca1d4369cd2fd3b0d8a6fbc1 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 20 Jan 2017 12:10:35 +0100 Subject: [PATCH 4/4] build: include fdroidserverid in build log post on wiki --- fdroidserver/build.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fdroidserver/build.py b/fdroidserver/build.py index e34fe15e..a100548a 100644 --- a/fdroidserver/build.py +++ b/fdroidserver/build.py @@ -1200,15 +1200,18 @@ def main(): failed_apps[appid] = e wikilog = str(e) - if wikilog: - wikilog = tools_version_log + '\n\n' + wikilog - if options.wiki and wikilog: try: # Write a page with the last build log for this version code lastbuildpage = appid + '/lastbuild_' + build.vercode newpage = site.Pages[lastbuildpage] - txt = "Build completed at " + time.strftime("%Y-%m-%d %H:%M:%SZ", time.gmtime()) + "\n\n" + wikilog + with open(os.path.join('tmp', 'fdroidserverid')) as fp: + fdroidserverid = fp.read() + txt = "* build completed at " + time.strftime("%Y-%m-%d %H:%M:%SZ", time.gmtime()) + '\n' \ + + '* fdroidserverid: [https://gitlab.com/fdroid/fdroidserver/commit/' \ + + fdroidserverid + ' ' + fdroidserverid + ']\n\n' \ + + tools_version_log + '\n\n' \ + + '== Build Log ==\n\n' + wikilog newpage.save(txt, summary='Build log') # Redirect from /lastbuild to the most recent build log newpage = site.Pages[appid + '/lastbuild']