From 69730524970e44e9543138ee519ed1df573ccf3c Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 14 May 2020 17:58:24 +0000 Subject: [PATCH] Support other branches than master? --- list_builder.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/list_builder.py b/list_builder.py index 669ea20e..12a26518 100755 --- a/list_builder.py +++ b/list_builder.py @@ -80,7 +80,12 @@ def init_cache(app, infos): else: depth = 40 - git("clone --quiet --depth {depth} --single-branch --branch master {url} {folder}".format(depth=depth, url=infos["url"], folder=app_cache_folder(app))) + git("clone --quiet --depth {depth} --single-branch --branch {branch} {url} {folder}".format( + depth=depth, + url=infos["url"], + branch=infos.get("branch", "master"), + folder=app_cache_folder(app)) + ) def refresh_cache(app, infos): @@ -90,10 +95,12 @@ def refresh_cache(app, infos): if os.path.exists(fetch_head) and now - os.path.getmtime(fetch_head) < 3600: return + branch=infos.get("branch", "master") + try: git("remote set-url origin " + infos["url"], in_folder=app_cache_folder(app)) - git("fetch --quiet origin master --force", in_folder=app_cache_folder(app)) - git("reset origin/master --hard", in_folder=app_cache_folder(app)) + git("fetch --quiet origin %s --force" % branch, in_folder=app_cache_folder(app)) + git("reset origin/%s --hard" % branch, in_folder=app_cache_folder(app)) except: # Sometimes there are tmp issue such that the refresh cache .. # we don't trigger an error unless the cache hasnt been updated since more than 24 hours @@ -160,8 +167,6 @@ def build_catalog(): def build_app_dict(app, infos): - assert infos["branch"] == "master" - # Make sure we have some cache this_app_cache = app_cache_folder(app) assert os.path.exists(this_app_cache), "No cache yet for %s" % app