mirror of
https://github.com/YunoHost/yunodevtools.git
synced 2024-09-03 20:16:19 +02:00
smol improvements
This commit is contained in:
parent
78df7de37f
commit
f0931e5f8c
1 changed files with 14 additions and 3 deletions
|
@ -14,6 +14,8 @@ catalog = toml.load(open(os.path.join(APPS_REPO_ROOT, "apps.toml"), encoding="ut
|
||||||
|
|
||||||
|
|
||||||
def generate_catalog_repo_list():
|
def generate_catalog_repo_list():
|
||||||
|
# list the apps in the catalog
|
||||||
|
|
||||||
apps_repos = []
|
apps_repos = []
|
||||||
for app in catalog:
|
for app in catalog:
|
||||||
url = catalog.get(app)["url"]
|
url = catalog.get(app)["url"]
|
||||||
|
@ -22,7 +24,9 @@ def generate_catalog_repo_list():
|
||||||
return apps_repos
|
return apps_repos
|
||||||
|
|
||||||
|
|
||||||
def generate_actual_repo_list():
|
def generate_mirror_list():
|
||||||
|
# list the existing mirrors on our forgejo
|
||||||
|
|
||||||
data = requests.get("https://git.yunohost.org/api/v1/repos/search?topic=false&includeDesc=false&priority_owner_id=17&mode=mirror").json()["data"]
|
data = requests.get("https://git.yunohost.org/api/v1/repos/search?topic=false&includeDesc=false&priority_owner_id=17&mode=mirror").json()["data"]
|
||||||
existing_clones = []
|
existing_clones = []
|
||||||
for repo in data:
|
for repo in data:
|
||||||
|
@ -31,11 +35,17 @@ def generate_actual_repo_list():
|
||||||
|
|
||||||
|
|
||||||
def generate_mirrors():
|
def generate_mirrors():
|
||||||
for app in generate_catalog_repo_list():
|
|
||||||
|
app_catalog = generate_catalog_repo_list()
|
||||||
|
mirror_list = generate_mirror_list()
|
||||||
|
|
||||||
|
for app in app_catalog:
|
||||||
repo_name = app[0]
|
repo_name = app[0]
|
||||||
repo_url = app[1]
|
repo_url = app[1]
|
||||||
if app[0] not in generate_actual_repo_list():
|
|
||||||
|
if app[0] not in mirror_list:
|
||||||
print(f"A mirror for '{repo_name}' must be created.")
|
print(f"A mirror for '{repo_name}' must be created.")
|
||||||
|
|
||||||
api_header = {'Content-type': 'application/json', 'Authorization': '{FORGEJO_TOKEN}'}
|
api_header = {'Content-type': 'application/json', 'Authorization': '{FORGEJO_TOKEN}'}
|
||||||
create_mirror_data = {
|
create_mirror_data = {
|
||||||
"clone_addr": repo_url,
|
"clone_addr": repo_url,
|
||||||
|
@ -54,6 +64,7 @@ def generate_mirrors():
|
||||||
time.sleep(60)
|
time.sleep(60)
|
||||||
else:
|
else:
|
||||||
raise Exception('Request failed:', create_mirror.status_code, create_mirror.text)
|
raise Exception('Request failed:', create_mirror.status_code, create_mirror.text)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# configuring properly the new repository
|
# configuring properly the new repository
|
||||||
settings_mirror_data = {
|
settings_mirror_data = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue