Merge pull request 'use nix flake archive in clan machines update for git+file flake inputs' (#2771) from machine-update into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/2771
This commit is contained in:
@@ -2,6 +2,7 @@ import argparse
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import shlex
|
import shlex
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@@ -29,11 +30,15 @@ from .inventory import get_all_machines, get_selected_machines
|
|||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def is_path_input(node: dict[str, dict[str, str]]) -> bool:
|
def is_local_input(node: dict[str, dict[str, str]]) -> bool:
|
||||||
locked = node.get("locked")
|
locked = node.get("locked")
|
||||||
if not locked:
|
if not locked:
|
||||||
return False
|
return False
|
||||||
return locked["type"] == "path" or locked.get("url", "").startswith("file://")
|
# matches path and git+file://
|
||||||
|
return (
|
||||||
|
locked["type"] == "path"
|
||||||
|
or re.match(r"^\w+\+file://", locked.get("url", "")) is not None
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def upload_sources(machine: Machine) -> str:
|
def upload_sources(machine: Machine) -> str:
|
||||||
@@ -45,7 +50,7 @@ def upload_sources(machine: Machine) -> str:
|
|||||||
)
|
)
|
||||||
flake_data = nix_metadata(flake_url)
|
flake_data = nix_metadata(flake_url)
|
||||||
has_path_inputs = any(
|
has_path_inputs = any(
|
||||||
is_path_input(node) for node in flake_data["locks"]["nodes"].values()
|
is_local_input(node) for node in flake_data["locks"]["nodes"].values()
|
||||||
)
|
)
|
||||||
|
|
||||||
if not has_path_inputs:
|
if not has_path_inputs:
|
||||||
|
|||||||
Reference in New Issue
Block a user