|
@@ -21,6 +21,10 @@ NAM_RELEASE_ASSET = re.compile(
|
|
|
r"^https://github\.com/mikeoliphant/neural-amp-modeler-lv2/releases/download/"
|
|
r"^https://github\.com/mikeoliphant/neural-amp-modeler-lv2/releases/download/"
|
|
|
r"(?P<tag>[A-Za-z0-9._-]+)/neural_amp_modeler_lv2_rpi5\.tgz$"
|
|
r"(?P<tag>[A-Za-z0-9._-]+)/neural_amp_modeler_lv2_rpi5\.tgz$"
|
|
|
)
|
|
)
|
|
|
|
|
+PLUGIN_ARCHIVES = {
|
|
|
|
|
+ "lsp": "7z",
|
|
|
|
|
+ "dragonfly_reverb": "tar.xz",
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
|
|
|
def load_deployment():
|
|
def load_deployment():
|
|
@@ -34,6 +38,14 @@ def load_deployment():
|
|
|
pipewire = deployment.get("pipewire")
|
|
pipewire = deployment.get("pipewire")
|
|
|
if not isinstance(namlv2, dict) or not isinstance(pipewire, dict):
|
|
if not isinstance(namlv2, dict) or not isinstance(pipewire, dict):
|
|
|
raise ValueError("deployment.namlv2 and deployment.pipewire must be mappings")
|
|
raise ValueError("deployment.namlv2 and deployment.pipewire must be mappings")
|
|
|
|
|
+ for component, archive_format in PLUGIN_ARCHIVES.items():
|
|
|
|
|
+ plugin = deployment.get(component)
|
|
|
|
|
+ if not isinstance(plugin, dict):
|
|
|
|
|
+ raise ValueError(f"deployment.{component} must be a mapping")
|
|
|
|
|
+ if plugin.get("archive_format") != archive_format:
|
|
|
|
|
+ errors.append(f"{component} archive format is invalid")
|
|
|
|
|
+ if not isinstance(plugin.get("bundle_paths"), dict) or not plugin["bundle_paths"]:
|
|
|
|
|
+ errors.append(f"{component} bundle paths are invalid")
|
|
|
tag = namlv2.get("tag")
|
|
tag = namlv2.get("tag")
|
|
|
match = NAM_RELEASE_ASSET.fullmatch(namlv2.get("archive_url", ""))
|
|
match = NAM_RELEASE_ASSET.fullmatch(namlv2.get("archive_url", ""))
|
|
|
if not isinstance(tag, str) or not re.fullmatch(r"[A-Za-z0-9._-]+", tag):
|
|
if not isinstance(tag, str) or not re.fullmatch(r"[A-Za-z0-9._-]+", tag):
|
|
@@ -321,6 +333,325 @@ def download_archive(url, destination):
|
|
|
run(["curl", "--fail", "--location", "--silent", "--show-error", "--output", str(destination), url])
|
|
run(["curl", "--fail", "--location", "--silent", "--show-error", "--output", str(destination), url])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+def inspect_tar_archive(archive_path, bundle_paths):
|
|
|
|
|
+ expected_roots = {PurePosixPath(path) for path in bundle_paths.values()}
|
|
|
|
|
+ with tarfile.open(archive_path, "r:xz") as archive:
|
|
|
|
|
+ members = archive.getmembers()
|
|
|
|
|
+ for member in members:
|
|
|
|
|
+ member_path = PurePosixPath(member.name)
|
|
|
|
|
+ if member_path.is_absolute() or ".." in member_path.parts:
|
|
|
|
|
+ raise RuntimeError(f"unsafe archive path: {member.name}")
|
|
|
|
|
+ if not member.isfile() and not member.isdir():
|
|
|
|
|
+ raise RuntimeError(f"unsupported archive member type: {member.name}")
|
|
|
|
|
+ for bundle_root in expected_roots:
|
|
|
|
|
+ if not any(member.name.rstrip("/") == str(bundle_root) and member.isdir() for member in members):
|
|
|
|
|
+ raise RuntimeError(f"archive does not contain expected bundle directory {bundle_root}")
|
|
|
|
|
+ if not any(member.name == f"{bundle_root}/manifest.ttl" and member.isfile() for member in members):
|
|
|
|
|
+ raise RuntimeError(f"archive bundle is missing manifest.ttl: {bundle_root}")
|
|
|
|
|
+ return expected_roots
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+def extract_tar_bundles(archive_path, bundle_paths, extraction_root):
|
|
|
|
|
+ expected_roots = inspect_tar_archive(archive_path, bundle_paths)
|
|
|
|
|
+ extracted = {bundle_name: extraction_root / bundle_name for bundle_name in bundle_paths}
|
|
|
|
|
+ with tarfile.open(archive_path, "r:xz") as archive:
|
|
|
|
|
+ for member in archive.getmembers():
|
|
|
|
|
+ member_path = PurePosixPath(member.name)
|
|
|
|
|
+ bundle_root = next(
|
|
|
|
|
+ (root for root in expected_roots if member_path == root or member_path.is_relative_to(root)),
|
|
|
|
|
+ None,
|
|
|
|
|
+ )
|
|
|
|
|
+ if bundle_root is None:
|
|
|
|
|
+ continue
|
|
|
|
|
+ bundle_name = next(name for name, path in bundle_paths.items() if PurePosixPath(path) == bundle_root)
|
|
|
|
|
+ output_path = extracted[bundle_name].joinpath(*member_path.parts[len(bundle_root.parts):])
|
|
|
|
|
+ if member.isdir():
|
|
|
|
|
+ output_path.mkdir(parents=True, exist_ok=True)
|
|
|
|
|
+ output_path.chmod(0o755)
|
|
|
|
|
+ continue
|
|
|
|
|
+ output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
|
|
|
+ source = archive.extractfile(member)
|
|
|
|
|
+ if source is None:
|
|
|
|
|
+ raise RuntimeError(f"unable to read archive member: {member.name}")
|
|
|
|
|
+ with source, output_path.open("wb") as destination:
|
|
|
|
|
+ shutil.copyfileobj(source, destination)
|
|
|
|
|
+ output_path.chmod(0o755 if member.mode & 0o111 else 0o644)
|
|
|
|
|
+ return extracted
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+def inspect_7z_archive(bundle_paths, listing):
|
|
|
|
|
+ paths = []
|
|
|
|
|
+ current = {}
|
|
|
|
|
+ for line in listing.splitlines() + [""]:
|
|
|
|
|
+ if not line and current:
|
|
|
|
|
+ path = current.get("Path")
|
|
|
|
|
+ attributes = current.get("Attributes", "")
|
|
|
|
|
+ if path and attributes:
|
|
|
|
|
+ member_path = PurePosixPath(path)
|
|
|
|
|
+ if member_path.is_absolute() or ".." in member_path.parts:
|
|
|
|
|
+ raise RuntimeError(f"unsafe archive path: {path}")
|
|
|
|
|
+ if "L" in attributes or "H" in attributes:
|
|
|
|
|
+ raise RuntimeError(f"unsupported archive member type: {path}")
|
|
|
|
|
+ paths.append((member_path, "D" in attributes))
|
|
|
|
|
+ current = {}
|
|
|
|
|
+ elif " = " in line:
|
|
|
|
|
+ key, value = line.split(" = ", 1)
|
|
|
|
|
+ current[key] = value
|
|
|
|
|
+ expected_roots = {PurePosixPath(path) for path in bundle_paths.values()}
|
|
|
|
|
+ present_roots = {path for path, is_directory in paths if is_directory and path in expected_roots}
|
|
|
|
|
+ if present_roots != expected_roots:
|
|
|
|
|
+ raise RuntimeError(f"7z archive is missing expected LV2 bundles: {sorted(map(str, expected_roots - present_roots))}")
|
|
|
|
|
+ for root in expected_roots:
|
|
|
|
|
+ if not any(path == root / "manifest.ttl" and not is_directory for path, is_directory in paths):
|
|
|
|
|
+ raise RuntimeError(f"7z archive bundle is missing manifest.ttl: {root}")
|
|
|
|
|
+ return expected_roots, paths
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+def extract_7z_bundles(archive_path, bundle_paths, extraction_root):
|
|
|
|
|
+ executable = shutil.which("7z") or shutil.which("7zz") or shutil.which("7za")
|
|
|
|
|
+ if executable is None:
|
|
|
|
|
+ raise RuntimeError("installing LSP plugins requires 7z, 7zz, or 7za on PATH")
|
|
|
|
|
+ listing = subprocess.run(
|
|
|
|
|
+ [executable, "l", "-slt", str(archive_path)],
|
|
|
|
|
+ check=True,
|
|
|
|
|
+ capture_output=True,
|
|
|
|
|
+ text=True,
|
|
|
|
|
+ ).stdout
|
|
|
|
|
+ expected_roots, paths = inspect_7z_archive(bundle_paths, listing)
|
|
|
|
|
+ temporary_output = extraction_root / "7z-output"
|
|
|
|
|
+ temporary_output.mkdir()
|
|
|
|
|
+ result = subprocess.run(
|
|
|
|
|
+ [executable, "x", "-y", f"-o{temporary_output}", str(archive_path)],
|
|
|
|
|
+ check=False,
|
|
|
|
|
+ capture_output=True,
|
|
|
|
|
+ text=True,
|
|
|
|
|
+ )
|
|
|
|
|
+ if result.returncode != 0:
|
|
|
|
|
+ missing_files = [
|
|
|
|
|
+ path
|
|
|
|
|
+ for path, is_directory in paths
|
|
|
|
|
+ if not is_directory
|
|
|
|
|
+ and any(path.is_relative_to(root) for root in expected_roots)
|
|
|
|
|
+ and not temporary_output.joinpath(*path.parts).is_file()
|
|
|
|
|
+ ]
|
|
|
|
|
+ if missing_files:
|
|
|
|
|
+ raise subprocess.CalledProcessError(
|
|
|
|
|
+ result.returncode,
|
|
|
|
|
+ result.args,
|
|
|
|
|
+ output=result.stdout,
|
|
|
|
|
+ stderr=result.stderr,
|
|
|
|
|
+ )
|
|
|
|
|
+ extracted = {}
|
|
|
|
|
+ for bundle_name, path in bundle_paths.items():
|
|
|
|
|
+ bundle_root = PurePosixPath(path)
|
|
|
|
|
+ source = temporary_output.joinpath(*bundle_root.parts)
|
|
|
|
|
+ if not source.is_dir():
|
|
|
|
|
+ raise RuntimeError(f"expected LV2 bundle missing after extraction: {source}")
|
|
|
|
|
+ target = extraction_root / bundle_name
|
|
|
|
|
+ shutil.copytree(source, target, symlinks=False)
|
|
|
|
|
+ extracted[bundle_name] = target
|
|
|
|
|
+ return extracted
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+def deploy_lv2_archives(action, component, config, registry):
|
|
|
|
|
+ bundle_paths = config["bundle_paths"]
|
|
|
|
|
+ bundle_names = list(bundle_paths)
|
|
|
|
|
+ destinations = {name: Path.home() / ".lv2" / name for name in bundle_names}
|
|
|
|
|
+ for destination in destinations.values():
|
|
|
|
|
+ validate_user_destination(destination)
|
|
|
|
|
+ managed = registry.get(component)
|
|
|
|
|
+
|
|
|
|
|
+ if action == "reload":
|
|
|
|
|
+ print(f"Nothing to reload for {component}; restart its LV2 host after installation.")
|
|
|
|
|
+ return
|
|
|
|
|
+
|
|
|
|
|
+ if action == "uninstall":
|
|
|
|
|
+ if managed is None:
|
|
|
|
|
+ print(f"No managed {component} bundles to uninstall.")
|
|
|
|
|
+ return
|
|
|
|
|
+ recorded = managed.get("bundles")
|
|
|
|
|
+ if not isinstance(recorded, dict) or set(recorded) != set(bundle_names):
|
|
|
|
|
+ raise RuntimeError(f"managed {component} bundle declaration changed")
|
|
|
|
|
+ if managed.get("pending_uninstall"):
|
|
|
|
|
+ for name, destination in destinations.items():
|
|
|
|
|
+ record = recorded[name]
|
|
|
|
|
+ backup = validate_backup_path(record.get("backup"), destination, is_directory=True)
|
|
|
|
|
+ backup_exists = backup is not None and backup.is_dir()
|
|
|
|
|
+ if backup is not None and backup.exists() and not backup_exists:
|
|
|
|
|
+ raise RuntimeError(f"recorded backup has the wrong type: {backup}")
|
|
|
|
|
+ if backup_exists and tree_sha256(backup) != record.get("backup_sha256"):
|
|
|
|
|
+ raise RuntimeError(f"recorded backup bundle changed locally: {backup}")
|
|
|
|
|
+ if destination.exists():
|
|
|
|
|
+ current = tree_sha256(destination)
|
|
|
|
|
+ if backup_exists and current == record.get("backup_sha256"):
|
|
|
|
|
+ continue
|
|
|
|
|
+ if backup is None and record.get("backup_sha256") is None:
|
|
|
|
|
+ if current == record.get("installed_sha256"):
|
|
|
|
|
+ continue
|
|
|
|
|
+ raise RuntimeError(f"unexpected bundle blocks pending uninstall: {destination}")
|
|
|
|
|
+ if not backup_exists and current == record.get("backup_sha256"):
|
|
|
|
|
+ continue
|
|
|
|
|
+ if current != record.get("installed_sha256"):
|
|
|
|
|
+ raise RuntimeError(f"unexpected bundle blocks pending uninstall: {destination}")
|
|
|
|
|
+ elif backup is not None and not backup_exists:
|
|
|
|
|
+ raise RuntimeError(f"recorded backup bundle is missing: {backup}")
|
|
|
|
|
+ for name, destination in destinations.items():
|
|
|
|
|
+ record = recorded[name]
|
|
|
|
|
+ backup = validate_backup_path(record.get("backup"), destination, is_directory=True)
|
|
|
|
|
+ backup_exists = backup is not None and backup.is_dir()
|
|
|
|
|
+ if destination.exists() and tree_sha256(destination) == record.get("installed_sha256"):
|
|
|
|
|
+ shutil.rmtree(destination)
|
|
|
|
|
+ if backup_exists:
|
|
|
|
|
+ os.replace(backup, destination)
|
|
|
|
|
+ registry.pop(component)
|
|
|
|
|
+ write_registry(registry)
|
|
|
|
|
+ print(f"Completed interrupted {component} uninstall at {Path.home() / '.lv2'}.")
|
|
|
|
|
+ return
|
|
|
|
|
+ for name, destination in destinations.items():
|
|
|
|
|
+ record = recorded[name]
|
|
|
|
|
+ backup = validate_backup_path(record.get("backup"), destination, is_directory=True)
|
|
|
|
|
+ if not destination.is_dir():
|
|
|
|
|
+ raise RuntimeError(f"managed {component} bundle is missing: {destination}")
|
|
|
|
|
+ if record.get("installed_path") != str(destination):
|
|
|
|
|
+ raise RuntimeError(f"managed {component} path changed: {destination}")
|
|
|
|
|
+ if tree_sha256(destination) != record.get("installed_sha256"):
|
|
|
|
|
+ raise RuntimeError(f"managed {component} bundle changed locally; refusing to remove: {destination}")
|
|
|
|
|
+ if backup is not None:
|
|
|
|
|
+ if not backup.is_dir():
|
|
|
|
|
+ raise RuntimeError(f"recorded backup bundle is missing: {backup}")
|
|
|
|
|
+ if tree_sha256(backup) != record.get("backup_sha256"):
|
|
|
|
|
+ raise RuntimeError(f"recorded backup bundle changed locally: {backup}")
|
|
|
|
|
+ managed["pending_uninstall"] = True
|
|
|
|
|
+ registry[component] = managed
|
|
|
|
|
+ write_registry(registry)
|
|
|
|
|
+ for name, destination in destinations.items():
|
|
|
|
|
+ record = recorded[name]
|
|
|
|
|
+ shutil.rmtree(destination)
|
|
|
|
|
+ backup = validate_backup_path(record.get("backup"), destination, is_directory=True)
|
|
|
|
|
+ if backup is not None:
|
|
|
|
|
+ os.replace(backup, destination)
|
|
|
|
|
+ registry.pop(component)
|
|
|
|
|
+ write_registry(registry)
|
|
|
|
|
+ print(f"Removed managed {component} bundles from {Path.home() / '.lv2'}.")
|
|
|
|
|
+ return
|
|
|
|
|
+
|
|
|
|
|
+ if managed is not None:
|
|
|
|
|
+ if managed.get("pending_uninstall"):
|
|
|
|
|
+ raise RuntimeError(f"{component} uninstall is incomplete; retry uninstall {component} first")
|
|
|
|
|
+ recorded = managed.get("bundles")
|
|
|
|
|
+ if not isinstance(recorded, dict) or set(recorded) != set(bundle_names):
|
|
|
|
|
+ raise RuntimeError(f"managed {component} bundle declaration changed")
|
|
|
|
|
+ for name, destination in destinations.items():
|
|
|
|
|
+ record = recorded[name]
|
|
|
|
|
+ backup = validate_backup_path(record.get("backup"), destination, is_directory=True)
|
|
|
|
|
+ if backup is not None:
|
|
|
|
|
+ if not backup.is_dir() or tree_sha256(backup) != record.get("backup_sha256"):
|
|
|
|
|
+ raise RuntimeError(f"recorded backup bundle changed locally: {backup}")
|
|
|
|
|
+ if not destination.is_dir():
|
|
|
|
|
+ raise RuntimeError(f"managed {component} bundle is missing: {destination}")
|
|
|
|
|
+ if tree_sha256(destination) != record.get("installed_sha256"):
|
|
|
|
|
+ raise RuntimeError(f"managed {component} bundle changed locally; refusing overwrite: {destination}")
|
|
|
|
|
+ if managed.get("tag") == config["tag"]:
|
|
|
|
|
+ print(f"{component} tag {config['tag']} is already installed and unchanged.")
|
|
|
|
|
+ return
|
|
|
|
|
+
|
|
|
|
|
+ for name, destination in destinations.items():
|
|
|
|
|
+ previous = managed.get("bundles", {}).get(name) if managed else None
|
|
|
|
|
+ if previous is not None:
|
|
|
|
|
+ backup = validate_backup_path(previous.get("backup"), destination, is_directory=True)
|
|
|
|
|
+ if backup is not None:
|
|
|
|
|
+ if not backup.is_dir():
|
|
|
|
|
+ raise RuntimeError(f"recorded backup bundle is missing: {backup}")
|
|
|
|
|
+ if tree_sha256(backup) != previous.get("backup_sha256"):
|
|
|
|
|
+ raise RuntimeError(f"recorded backup bundle changed locally: {backup}")
|
|
|
|
|
+ if previous is None and destination.exists():
|
|
|
|
|
+ backup = destination.with_name(destination.name + ".rigforge-backup")
|
|
|
|
|
+ if backup.exists():
|
|
|
|
|
+ raise RuntimeError(f"backup path already exists: {backup}")
|
|
|
|
|
+ staged = destination.with_name(destination.name + ".rigforge-new")
|
|
|
|
|
+ previous_path = destination.with_name(destination.name + ".rigforge-old")
|
|
|
|
|
+ if staged.exists() or previous_path.exists():
|
|
|
|
|
+ raise RuntimeError(f"{component} staging or recovery path already exists: {destination}")
|
|
|
|
|
+
|
|
|
|
|
+ with tempfile.TemporaryDirectory(prefix=f"rigforge-{component}-") as temporary_dir:
|
|
|
|
|
+ temporary = Path(temporary_dir)
|
|
|
|
|
+ archive_path = temporary / (
|
|
|
|
|
+ "plugin.tar.xz" if config["archive_format"] == "tar.xz" else "plugin.7z"
|
|
|
|
|
+ )
|
|
|
|
|
+ download_archive(config["archive_url"], archive_path)
|
|
|
|
|
+ archive_digest = hashlib.sha256(archive_path.read_bytes()).hexdigest()
|
|
|
|
|
+ extraction_root = temporary / "extract"
|
|
|
|
|
+ extraction_root.mkdir()
|
|
|
|
|
+ if config["archive_format"] == "tar.xz":
|
|
|
|
|
+ extracted = extract_tar_bundles(archive_path, config["bundle_paths"], extraction_root)
|
|
|
|
|
+ else:
|
|
|
|
|
+ extracted = extract_7z_bundles(archive_path, config["bundle_paths"], extraction_root)
|
|
|
|
|
+ records = {}
|
|
|
|
|
+ created_backups = []
|
|
|
|
|
+ installed_destinations = []
|
|
|
|
|
+ try:
|
|
|
|
|
+ for name, destination in destinations.items():
|
|
|
|
|
+ previous = managed.get("bundles", {}).get(name) if managed else None
|
|
|
|
|
+ backup = (
|
|
|
|
|
+ validate_backup_path(previous.get("backup"), destination, is_directory=True)
|
|
|
|
|
+ if previous is not None
|
|
|
|
|
+ else destination.with_name(destination.name + ".rigforge-backup")
|
|
|
|
|
+ if destination.exists()
|
|
|
|
|
+ else None
|
|
|
|
|
+ )
|
|
|
|
|
+ backup_digest = previous.get("backup_sha256") if previous is not None else None
|
|
|
|
|
+ if backup is not None and previous is None:
|
|
|
|
|
+ shutil.copytree(destination, backup, symlinks=True)
|
|
|
|
|
+ created_backups.append(backup)
|
|
|
|
|
+ backup_digest = tree_sha256(backup)
|
|
|
|
|
+ destination.parent.mkdir(parents=True, exist_ok=True)
|
|
|
|
|
+ staged = destination.with_name(destination.name + ".rigforge-new")
|
|
|
|
|
+ previous_path = destination.with_name(destination.name + ".rigforge-old")
|
|
|
|
|
+ shutil.copytree(extracted[name], staged, symlinks=False)
|
|
|
|
|
+ try:
|
|
|
|
|
+ if destination.exists():
|
|
|
|
|
+ os.replace(destination, previous_path)
|
|
|
|
|
+ os.replace(staged, destination)
|
|
|
|
|
+ installed_destinations.append((destination, previous_path))
|
|
|
|
|
+ except OSError:
|
|
|
|
|
+ if previous_path.exists() and not destination.exists():
|
|
|
|
|
+ os.replace(previous_path, destination)
|
|
|
|
|
+ if staged.exists():
|
|
|
|
|
+ shutil.rmtree(staged)
|
|
|
|
|
+ raise
|
|
|
|
|
+ records[name] = {
|
|
|
|
|
+ "installed_path": str(destination),
|
|
|
|
|
+ "backup": str(backup) if backup is not None else None,
|
|
|
|
|
+ "backup_sha256": backup_digest,
|
|
|
|
|
+ "installed_sha256": tree_sha256(destination),
|
|
|
|
|
+ }
|
|
|
|
|
+ for _, previous_path in installed_destinations:
|
|
|
|
|
+ if previous_path.exists():
|
|
|
|
|
+ shutil.rmtree(previous_path)
|
|
|
|
|
+ except (OSError, shutil.Error):
|
|
|
|
|
+ for destination, previous_path in reversed(installed_destinations):
|
|
|
|
|
+ if destination.exists():
|
|
|
|
|
+ shutil.rmtree(destination)
|
|
|
|
|
+ if previous_path.exists():
|
|
|
|
|
+ os.replace(previous_path, destination)
|
|
|
|
|
+ for destination in destinations.values():
|
|
|
|
|
+ staged = destination.with_name(destination.name + ".rigforge-new")
|
|
|
|
|
+ if staged.exists():
|
|
|
|
|
+ shutil.rmtree(staged)
|
|
|
|
|
+ for backup in created_backups:
|
|
|
|
|
+ if backup.exists():
|
|
|
|
|
+ shutil.rmtree(backup)
|
|
|
|
|
+ raise
|
|
|
|
|
+ registry[component] = {
|
|
|
|
|
+ "tag": config["tag"],
|
|
|
|
|
+ "archive_sha256": archive_digest,
|
|
|
|
|
+ "bundles": records,
|
|
|
|
|
+ }
|
|
|
|
|
+ write_registry(registry)
|
|
|
|
|
+ print(f"Installed {component} tag {config['tag']} under {Path.home() / '.lv2'}.")
|
|
|
|
|
+ print(f"Downloaded archive SHA-256 (identity only, no publisher checksum): {archive_digest}")
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
def deploy_namlv2(action, config, registry):
|
|
def deploy_namlv2(action, config, registry):
|
|
|
bundle_name = config["bundle_directory"]
|
|
bundle_name = config["bundle_directory"]
|
|
|
destination = Path.home() / ".lv2" / bundle_name
|
|
destination = Path.home() / ".lv2" / bundle_name
|
|
@@ -461,7 +792,7 @@ def deploy_namlv2(action, config, registry):
|
|
|
def main(argv=None):
|
|
def main(argv=None):
|
|
|
parser = argparse.ArgumentParser()
|
|
parser = argparse.ArgumentParser()
|
|
|
parser.add_argument("action", choices=("install", "uninstall", "reload"))
|
|
parser.add_argument("action", choices=("install", "uninstall", "reload"))
|
|
|
- parser.add_argument("target", choices=("namlv2", "pipewire"))
|
|
|
|
|
|
|
+ parser.add_argument("target", choices=("namlv2", "lsp", "dragonfly-reverb", "pipewire"))
|
|
|
args = parser.parse_args(argv)
|
|
args = parser.parse_args(argv)
|
|
|
try:
|
|
try:
|
|
|
state = yaml.safe_load((ROOT / "config" / "desired-state.yaml").read_text(encoding="utf-8"))
|
|
state = yaml.safe_load((ROOT / "config" / "desired-state.yaml").read_text(encoding="utf-8"))
|
|
@@ -472,8 +803,11 @@ def main(argv=None):
|
|
|
registry = read_registry()
|
|
registry = read_registry()
|
|
|
if args.target == "namlv2":
|
|
if args.target == "namlv2":
|
|
|
deploy_namlv2(args.action, deployment["namlv2"], registry)
|
|
deploy_namlv2(args.action, deployment["namlv2"], registry)
|
|
|
- else:
|
|
|
|
|
|
|
+ elif args.target == "pipewire":
|
|
|
deploy_pipewire(args.action, deployment["pipewire"], registry, quantum_frames)
|
|
deploy_pipewire(args.action, deployment["pipewire"], registry, quantum_frames)
|
|
|
|
|
+ else:
|
|
|
|
|
+ component = "dragonfly_reverb" if args.target == "dragonfly-reverb" else args.target
|
|
|
|
|
+ deploy_lv2_archives(args.action, component, deployment[component], registry)
|
|
|
except (OSError, ValueError, RuntimeError, KeyError, TypeError, subprocess.CalledProcessError, tarfile.TarError, yaml.YAMLError) as error:
|
|
except (OSError, ValueError, RuntimeError, KeyError, TypeError, subprocess.CalledProcessError, tarfile.TarError, yaml.YAMLError) as error:
|
|
|
print(f"ERROR: {error}", file=sys.stderr)
|
|
print(f"ERROR: {error}", file=sys.stderr)
|
|
|
return 1
|
|
return 1
|