snapshot of https://github.com/zulip/zulip.git @ 48c69911c7dd4e03b20552eb3bd77ad8151c1357 (2026-09-15)
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
This commit is contained in:
72
scripts/setup/compare-settings-to-template
Executable file
72
scripts/setup/compare-settings-to-template
Executable file
@@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import difflib
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
sys.path.append(BASE_DIR)
|
||||
from scripts.lib.setup_path import setup_path
|
||||
|
||||
setup_path()
|
||||
|
||||
|
||||
current_path = "/etc/zulip/settings.py"
|
||||
if len(sys.argv) >= 2:
|
||||
current_path = sys.argv[1]
|
||||
|
||||
print(f"Reading current configuration from {current_path}...")
|
||||
with open(current_path) as f:
|
||||
current_contents = f.read()
|
||||
|
||||
import requests
|
||||
|
||||
print("Fetching old versions of setting templates from Github...")
|
||||
templ = {}
|
||||
url: str | None = "https://api.github.com/repos/zulip/zulip/tags?per_page=100"
|
||||
|
||||
while url is not None:
|
||||
resp = requests.get(url)
|
||||
if resp.status_code != 200:
|
||||
print(resp.content)
|
||||
sys.exit(1)
|
||||
|
||||
url = resp.links.get("next", {}).get("url")
|
||||
for tag in [t["name"] for t in resp.json()]:
|
||||
if not re.match(r"^\d+\.\d+(\.\d+)?$", tag):
|
||||
continue
|
||||
|
||||
filename = "zproject/prod_settings_template.py"
|
||||
if [int(x) for x in tag.split(".")] < [1, 4]:
|
||||
filename = "zproject/local_settings_template.py"
|
||||
|
||||
print(f" - {tag}")
|
||||
resp = requests.get(
|
||||
f"https://raw.githubusercontent.com/zulip/zulip/{tag}/{filename}",
|
||||
)
|
||||
if resp.status_code == 200:
|
||||
templ[tag] = resp.content.decode()
|
||||
else:
|
||||
print("Failure: ")
|
||||
print(resp)
|
||||
|
||||
print("Computing minimal difference...")
|
||||
sequence_matchers = {}
|
||||
for version, contents in templ.items():
|
||||
sm = difflib.SequenceMatcher(None, current_contents, contents)
|
||||
sequence_matchers[version] = sm
|
||||
|
||||
likely = sorted(sequence_matchers.keys(), key=lambda v: sequence_matchers[v].ratio(), reverse=True)
|
||||
print(f"Most likely version: {likely[0]}")
|
||||
|
||||
|
||||
diff = difflib.unified_diff(
|
||||
templ[likely[0]].splitlines(keepends=True),
|
||||
current_contents.splitlines(keepends=True),
|
||||
fromfile=f"zulip-server-{version}/zproject/prod_settings_template.py",
|
||||
tofile=current_path,
|
||||
)
|
||||
|
||||
print()
|
||||
print("".join(diff), end="")
|
||||
Reference in New Issue
Block a user