Skip to content

Commit

Permalink
lug: another try of mirrorz adhoc support
Browse files Browse the repository at this point in the history
  • Loading branch information
taoky committed Dec 1, 2023
1 parent 052de77 commit 2ee8f5f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions config.siyuan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ repos:
serve_mode: mirror_intel
interval: 10800
name: homebrew-bottles
z_url: "/homebrew-bottles/bottles"
<<: *oneshot_common
# rust-static
- type: shell_script
Expand Down
12 changes: 10 additions & 2 deletions lug/worker-script/mirrorz.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,18 @@ def mirror_item(worker, param, help_items, sources):
}
return mirror

def link_to(lug, summary, mirrors, help_items, sources):
def z_adhocs(lug, summary, mirrors, help_items, sources):
for item in lug["repos"]:
if "z_link_to" in item:
for worker, param in summary["WorkerStatus"].items():
if worker == item["z_link_to"]:
# use item name instead of worker, still use worker param
mirror = mirror_item(item["name"], param, help_items, sources)
mirrors.append(mirror)
if "z_url" in item:
for mirror in mirrors:
if mirror["cname"] == name(item["name"]):
mirror["url"] = item["z_url"]

def main():
global options
Expand All @@ -92,13 +96,17 @@ def main():
mirrorz["info"] = []
mirrors = []
sources = {item["name"]: item.get("source", "") for item in lug["repos"]}
adhoc = lug.get("mirrorz_adhoc", {})
for worker, param in summary["WorkerStatus"].items():
if worker.startswith(".") or worker == 'sjtug-internal' or worker == 'test':
continue
mirror = mirror_item(worker, param, help_items, sources)
if worker in adhoc:
for key, value in adhoc[worker].items():
mirror[key] = value
mirrors.append(mirror)

link_to(lug, summary, mirrors, help_items, sources)
z_adhocs(lug, summary, mirrors, help_items, sources)

mirrorz["mirrors"] = mirrors
mirrorz["extension"] = "D"
Expand Down

0 comments on commit 2ee8f5f

Please sign in to comment.