Publish curated Unraid-AppOps-Gateway source from 402a0ef2e7d14e98325504f79ab7d7651ffc88b1

This commit is contained in:
Public Source Publisher committed 2026-10-09 10:59:14 +00:00
1 parent e49634bb10
commit 58f5e3c8c2
6 files changed
+70 -24

No files matched your search

@@ -1,18 +1,42 @@
from __future__ import annotations
import io
import re
import shlex
import subprocess
import tarfile
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
def test_windows_archive_preserves_git_bytes_with_autocrlf_enabled(tmp_path):
wrapper = (ROOT / "scripts/upgrade_deployment_controller.ps1").read_text(encoding="utf-8")
command = re.search(r"& (git(?: -c \S+)*) archive --format=tar", wrapper)
assert command is not None
prefix = shlex.split(command.group(1))
subprocess.run(["git", "init", "-q", str(tmp_path)], check=True)
source = b"print('immutable source')\n"
(tmp_path / "scripts").mkdir()
(tmp_path / "scripts/run_repopulse_adoption.py").write_bytes(source)
def git(*arguments):
return subprocess.check_output(["git", "-C", str(tmp_path), *arguments])
git("-c", "core.autocrlf=false", "add", "scripts/run_repopulse_adoption.py")
git("-c", "commit.gpgsign=false", "-c", "user.name=Fixture", "-c",
"user.email=fixture@example.invalid", "commit", "-qm", "fixed source")
git("config", "core.autocrlf", "true")
archive = subprocess.check_output([*prefix, "-C", str(tmp_path), "archive", "--format=tar",
"HEAD", "scripts/run_repopulse_adoption.py"])
with tarfile.open(fileobj=io.BytesIO(archive)) as packaged:
assert packaged.extractfile("scripts/run_repopulse_adoption.py").read() == source
def test_windows_wrapper_archives_every_file_required_by_root_installer():
installer = (ROOT / "scripts/upgrade_deployment_controller.sh").read_text(encoding="utf-8")
wrapper = (ROOT / "scripts/upgrade_deployment_controller.ps1").read_text(encoding="utf-8")
required = re.search(r"source_paths=\(\s*(.*?)\n\)", installer, re.DOTALL)
archived = re.search(r"& git archive --format=tar .*? \$SourceRevision (.*?)\r?\n", wrapper)
archived = re.search(r"& git(?: -c \S+)* archive --format=tar .*? \$SourceRevision (.*?)\r?\n", wrapper)
assert required is not None and archived is not None
archive_paths = set(shlex.split(archived.group(1)))
required_paths = shlex.split(required.group(1))