Revert "nixos-rebuild-ng: silence reexec messages" (#417338)
This commit is contained in:
@@ -286,7 +286,6 @@ def reexec(
|
||||
NIXOS_REBUILD_ATTR,
|
||||
flake,
|
||||
flake_build_flags | {"no_link": True},
|
||||
quiet=True,
|
||||
)
|
||||
else:
|
||||
build_attr = BuildAttr.from_arg(args.attr, args.file)
|
||||
@@ -294,7 +293,6 @@ def reexec(
|
||||
NIXOS_REBUILD_ATTR,
|
||||
build_attr,
|
||||
build_flags | {"no_out_link": True},
|
||||
quiet=True,
|
||||
)
|
||||
except CalledProcessError:
|
||||
logger.warning(
|
||||
@@ -306,7 +304,7 @@ def reexec(
|
||||
new = drv / f"bin/{EXECUTABLE}"
|
||||
current = Path(argv[0])
|
||||
if new != current:
|
||||
logging.debug(
|
||||
logger.debug(
|
||||
"detected newer version of script, re-exec'ing, current=%s, new=%s",
|
||||
current,
|
||||
new,
|
||||
|
||||
@@ -51,7 +51,6 @@ def build(
|
||||
attr: str,
|
||||
build_attr: BuildAttr,
|
||||
build_flags: Args | None = None,
|
||||
quiet: bool = False,
|
||||
) -> Path:
|
||||
"""Build NixOS attribute using classic Nix.
|
||||
|
||||
@@ -64,7 +63,7 @@ def build(
|
||||
build_attr.to_attr(attr),
|
||||
*dict_to_flags(build_flags),
|
||||
]
|
||||
r = run_wrapper(run_args, stdout=PIPE, stderr=PIPE if quiet else None)
|
||||
r = run_wrapper(run_args, stdout=PIPE)
|
||||
return Path(r.stdout.strip())
|
||||
|
||||
|
||||
@@ -72,7 +71,6 @@ def build_flake(
|
||||
attr: str,
|
||||
flake: Flake,
|
||||
flake_build_flags: Args | None = None,
|
||||
quiet: bool = False,
|
||||
) -> Path:
|
||||
"""Build NixOS attribute using Flakes.
|
||||
|
||||
@@ -86,7 +84,7 @@ def build_flake(
|
||||
flake.to_attr(attr),
|
||||
*dict_to_flags(flake_build_flags),
|
||||
]
|
||||
r = run_wrapper(run_args, stdout=PIPE, stderr=PIPE if quiet else None)
|
||||
r = run_wrapper(run_args, stdout=PIPE)
|
||||
return Path(r.stdout.strip())
|
||||
|
||||
|
||||
|
||||
@@ -143,7 +143,6 @@ def test_reexec(mock_build: Mock, mock_execve: Mock, monkeypatch: MonkeyPatch) -
|
||||
nr.NIXOS_REBUILD_ATTR,
|
||||
nr.models.BuildAttr(ANY, ANY),
|
||||
{"build": True, "no_out_link": True},
|
||||
quiet=True,
|
||||
)
|
||||
]
|
||||
)
|
||||
@@ -185,10 +184,9 @@ def test_reexec_flake(
|
||||
|
||||
nr.reexec(argv, args, {"build": True}, {"flake": True})
|
||||
mock_build.assert_called_once_with(
|
||||
"config.system.build.nixos-rebuild",
|
||||
nr.NIXOS_REBUILD_ATTR,
|
||||
nr.models.Flake(ANY, ANY),
|
||||
{"flake": True, "no_link": True},
|
||||
quiet=True,
|
||||
)
|
||||
# do not exec if there is no new version
|
||||
mock_execve.assert_not_called()
|
||||
@@ -268,7 +266,6 @@ def test_execute_nix_boot(mock_run: Mock, tmp_path: Path) -> None:
|
||||
],
|
||||
check=True,
|
||||
stdout=PIPE,
|
||||
stderr=None,
|
||||
**DEFAULT_RUN_KWARGS,
|
||||
),
|
||||
call(
|
||||
@@ -343,7 +340,6 @@ def test_execute_nix_build_vm(mock_run: Mock, tmp_path: Path) -> None:
|
||||
],
|
||||
check=True,
|
||||
stdout=PIPE,
|
||||
stderr=None,
|
||||
**DEFAULT_RUN_KWARGS,
|
||||
)
|
||||
]
|
||||
@@ -408,7 +404,6 @@ def test_execute_nix_build_image_flake(mock_run: Mock, tmp_path: Path) -> None:
|
||||
],
|
||||
check=True,
|
||||
stdout=PIPE,
|
||||
stderr=None,
|
||||
**DEFAULT_RUN_KWARGS,
|
||||
),
|
||||
call(
|
||||
@@ -476,7 +471,6 @@ def test_execute_nix_switch_flake(mock_run: Mock, tmp_path: Path) -> None:
|
||||
],
|
||||
check=True,
|
||||
stdout=PIPE,
|
||||
stderr=None,
|
||||
**DEFAULT_RUN_KWARGS,
|
||||
),
|
||||
call(
|
||||
@@ -767,7 +761,6 @@ def test_execute_nix_switch_flake_target_host(
|
||||
],
|
||||
check=True,
|
||||
stdout=PIPE,
|
||||
stderr=None,
|
||||
**DEFAULT_RUN_KWARGS,
|
||||
),
|
||||
call(
|
||||
@@ -1035,7 +1028,6 @@ def test_execute_build(mock_run: Mock, tmp_path: Path) -> None:
|
||||
],
|
||||
check=True,
|
||||
stdout=PIPE,
|
||||
stderr=None,
|
||||
**DEFAULT_RUN_KWARGS,
|
||||
)
|
||||
]
|
||||
@@ -1075,7 +1067,6 @@ def test_execute_test_flake(mock_run: Mock, tmp_path: Path) -> None:
|
||||
],
|
||||
check=True,
|
||||
stdout=PIPE,
|
||||
stderr=None,
|
||||
**DEFAULT_RUN_KWARGS,
|
||||
),
|
||||
call(
|
||||
|
||||
@@ -36,18 +36,14 @@ def test_build(mock_run: Mock) -> None:
|
||||
"foo",
|
||||
],
|
||||
stdout=PIPE,
|
||||
stderr=None,
|
||||
)
|
||||
|
||||
assert n.build(
|
||||
"config.system.build.attr",
|
||||
m.BuildAttr(Path("file"), "preAttr"),
|
||||
quiet=True,
|
||||
"config.system.build.attr", m.BuildAttr(Path("file"), "preAttr")
|
||||
) == Path("/path/to/file")
|
||||
mock_run.assert_called_with(
|
||||
["nix-build", Path("file"), "--attr", "preAttr.config.system.build.attr"],
|
||||
stdout=PIPE,
|
||||
stderr=PIPE,
|
||||
)
|
||||
|
||||
|
||||
@@ -78,26 +74,6 @@ def test_build_flake(mock_run: Mock, monkeypatch: MonkeyPatch, tmpdir: Path) ->
|
||||
"foo",
|
||||
],
|
||||
stdout=PIPE,
|
||||
stderr=None,
|
||||
)
|
||||
|
||||
assert n.build_flake(
|
||||
"config.system.build.toplevel",
|
||||
flake,
|
||||
None,
|
||||
quiet=True,
|
||||
) == Path("/path/to/file")
|
||||
mock_run.assert_called_with(
|
||||
[
|
||||
"nix",
|
||||
"--extra-experimental-features",
|
||||
"nix-command flakes",
|
||||
"build",
|
||||
"--print-out-paths",
|
||||
'.#nixosConfigurations."hostname".config.system.build.toplevel',
|
||||
],
|
||||
stdout=PIPE,
|
||||
stderr=PIPE,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user