staging-nixos merge for 2026-02-16 (round two) (#491107)
This commit is contained in:
@@ -201,7 +201,7 @@ def get_parser() -> tuple[argparse.ArgumentParser, dict[str, argparse.ArgumentPa
|
||||
"--diff",
|
||||
action="store_true",
|
||||
help="prints out the diff between the current system "
|
||||
"and the newly built one using nix store diff-closures"
|
||||
"and the newly built one using nix store diff-closures",
|
||||
)
|
||||
main_parser.add_argument("action", choices=Action.values(), nargs="?")
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import textwrap
|
||||
import uuid
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
@@ -314,6 +314,7 @@ def get_build_image_name_flake(
|
||||
r = run_wrapper(
|
||||
[
|
||||
"nix",
|
||||
*FLAKE_FLAGS,
|
||||
"eval",
|
||||
"--json",
|
||||
flake.to_attr(
|
||||
@@ -365,6 +366,7 @@ def get_build_image_variants_flake(
|
||||
r = run_wrapper(
|
||||
[
|
||||
"nix",
|
||||
*FLAKE_FLAGS,
|
||||
"eval",
|
||||
"--json",
|
||||
flake.to_attr("config.system.build.images"),
|
||||
@@ -538,12 +540,13 @@ def list_generations(profile: Profile) -> list[GenerationJson]:
|
||||
reverse=True,
|
||||
)
|
||||
|
||||
def diff_closures(current_config: Path, new_config: Path, target_host: Remote | None = None):
|
||||
print(
|
||||
f"<<< {current_config}\n"
|
||||
f">>> {new_config}",
|
||||
file=sys.stderr
|
||||
)
|
||||
|
||||
def diff_closures(
|
||||
current_config: Path,
|
||||
new_config: Path,
|
||||
target_host: Remote | None = None,
|
||||
) -> None:
|
||||
print(f"<<< {current_config}\n>>> {new_config}", file=sys.stderr)
|
||||
run_wrapper(
|
||||
[
|
||||
"nix",
|
||||
@@ -554,7 +557,7 @@ def diff_closures(current_config: Path, new_config: Path, target_host: Remote |
|
||||
new_config,
|
||||
],
|
||||
remote=target_host,
|
||||
stdout=sys.stderr
|
||||
stdout=sys.stderr,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import subprocess
|
||||
from collections.abc import Sequence
|
||||
from dataclasses import dataclass
|
||||
from ipaddress import AddressValueError, IPv6Address
|
||||
from typing import Final, Self, TypedDict, Unpack
|
||||
from typing import Final, Self, TextIO, TypedDict, Unpack
|
||||
|
||||
from . import tmpdir
|
||||
|
||||
@@ -85,8 +85,8 @@ class Remote:
|
||||
# Not exhaustive, but we can always extend it later.
|
||||
class RunKwargs(TypedDict, total=False):
|
||||
capture_output: bool
|
||||
stderr: int | None
|
||||
stdout: int | None
|
||||
stderr: int | TextIO | None
|
||||
stdout: int | TextIO | None
|
||||
|
||||
|
||||
def cleanup_ssh() -> None:
|
||||
|
||||
@@ -324,9 +324,15 @@ def build_and_activate_system(
|
||||
current_config = Path("/run/current-system")
|
||||
if args.diff:
|
||||
if current_config.exists():
|
||||
nix.diff_closures(current_config=current_config.readlink(), new_config=path_to_config, target_host=target_host)
|
||||
nix.diff_closures(
|
||||
current_config=current_config.readlink(),
|
||||
new_config=path_to_config,
|
||||
target_host=target_host,
|
||||
)
|
||||
else:
|
||||
logger.warning(f"missing '{str(current_config)}', skipping configuration diff...")
|
||||
logger.warning(
|
||||
f"missing '{current_config!s}', skipping configuration diff..."
|
||||
)
|
||||
|
||||
_activate_system(
|
||||
path_to_config=path_to_config,
|
||||
|
||||
@@ -386,6 +386,8 @@ def test_execute_nix_build_image_flake(mock_run: Mock, tmp_path: Path) -> None:
|
||||
call(
|
||||
[
|
||||
"nix",
|
||||
"--extra-experimental-features",
|
||||
"nix-command flakes",
|
||||
"eval",
|
||||
"--json",
|
||||
'/path/to/config#nixosConfigurations."hostname".config.system.build.images',
|
||||
@@ -412,6 +414,8 @@ def test_execute_nix_build_image_flake(mock_run: Mock, tmp_path: Path) -> None:
|
||||
call(
|
||||
[
|
||||
"nix",
|
||||
"--extra-experimental-features",
|
||||
"nix-command flakes",
|
||||
"eval",
|
||||
"--json",
|
||||
'/path/to/config#nixosConfigurations."hostname".config.system.build.images.azure.passthru.filePath',
|
||||
|
||||
@@ -394,6 +394,8 @@ def test_get_build_image_variants_flake(mock_run: Mock) -> None:
|
||||
mock_run.assert_called_with(
|
||||
[
|
||||
"nix",
|
||||
"--extra-experimental-features",
|
||||
"nix-command flakes",
|
||||
"eval",
|
||||
"--json",
|
||||
"/flake.nix#myAttr.config.system.build.images",
|
||||
@@ -554,11 +556,9 @@ def test_list_generations(mock_get_generations: Mock, tmp_path: Path) -> None:
|
||||
@patch(get_qualified_name(n.run_wrapper, n), autospec=True)
|
||||
def test_diff_closures(mock_run: Mock) -> None:
|
||||
|
||||
assert n.diff_closures(
|
||||
Path("/run/current-system"),
|
||||
Path("/nix/var/nix/profiles/system"),
|
||||
None
|
||||
) == None
|
||||
n.diff_closures(
|
||||
Path("/run/current-system"), Path("/nix/var/nix/profiles/system"), None
|
||||
)
|
||||
mock_run.assert_called_with(
|
||||
[
|
||||
"nix",
|
||||
@@ -570,7 +570,7 @@ def test_diff_closures(mock_run: Mock) -> None:
|
||||
Path("/nix/var/nix/profiles/system"),
|
||||
],
|
||||
remote=None,
|
||||
stdout=sys.stderr
|
||||
stdout=sys.stderr,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -20,10 +20,7 @@ assert stdenv.hostPlatform.libc == "musl" -> useMusl;
|
||||
let
|
||||
configParser = ''
|
||||
function parseconfig {
|
||||
while read LINE; do
|
||||
NAME=`echo "$LINE" | cut -d \ -f 1`
|
||||
OPTION=`echo "$LINE" | cut -d \ -f 2`
|
||||
|
||||
while IFS=" " read NAME OPTION; do
|
||||
if ! [[ "$NAME" =~ ^CONFIG_ ]]; then continue; fi
|
||||
|
||||
echo "parseconfig: removing $NAME"
|
||||
|
||||
@@ -20,23 +20,23 @@
|
||||
"lts": true
|
||||
},
|
||||
"6.6": {
|
||||
"version": "6.6.125",
|
||||
"hash": "sha256:0g88r1v5q0m1n1ii2f16awc8w9m471m6hqx7r5whad4a8dpkpqwf",
|
||||
"version": "6.6.126",
|
||||
"hash": "sha256:0bzfa31h4d3808a6kz1vqccyiiv3kpvkryq5jb6cizmbg172yx0n",
|
||||
"lts": true
|
||||
},
|
||||
"6.12": {
|
||||
"version": "6.12.72",
|
||||
"hash": "sha256:0ybijkw2zadhlg49r0wvnvy3s2czj5jnb149cz8ybvzvp90qgxdi",
|
||||
"version": "6.12.73",
|
||||
"hash": "sha256:1fj1ggpp19vjk80wbv0l9sn0ji0cm2wf0dvdyf6m9sgqrfad6na0",
|
||||
"lts": true
|
||||
},
|
||||
"6.18": {
|
||||
"version": "6.18.11",
|
||||
"hash": "sha256:1xrsc7s3kh7mipfs0v33n97gfi55ll83x4hxvwi969qh8293ibrq",
|
||||
"version": "6.18.12",
|
||||
"hash": "sha256:1spihc64pp1jd18i4ckvk0fzad0ia5cq5fvznxdsrhn2si52j0z0",
|
||||
"lts": false
|
||||
},
|
||||
"6.19": {
|
||||
"version": "6.19.1",
|
||||
"hash": "sha256:1vlki73j7m2khjl39hq4fy42qql9als18nmnjg00a8yklhqzb0qb",
|
||||
"version": "6.19.2",
|
||||
"hash": "sha256:0npfhawx99iwla9j29bnf6bz8g07h7cdk26nsk6vgkicb20ijqc8",
|
||||
"lts": false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user