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'] diff --git a/fdroidserver/update.py b/fdroidserver/update.py index f18cf49a..48509e65 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 @@ -960,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 @@ -1296,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' @@ -1611,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 @@ -1620,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']: 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__":