f2: remove unused build arguments
they're no longer used since non-diverted stores are the default now. Change-Id: I277b819340c2b69e1fd06607e562221469b77926
This commit is contained in:
@@ -21,8 +21,8 @@ def impure_vars(env: ManagedEnv):
|
||||
|
||||
@with_files(get_global_asset_pack("fixed"))
|
||||
def test_bad(nix: Nix):
|
||||
res = nix.nix_instantiate(["fixed.nix", "-A", "good.0"], build=True).run().ok()
|
||||
store_path = nix.nix_store(["-q", res.stdout_plain], build=True).run().ok().stdout_plain
|
||||
res = nix.nix_instantiate(["fixed.nix", "-A", "good.0"]).run().ok()
|
||||
store_path = nix.nix_store(["-q", res.stdout_plain]).run().ok().stdout_plain
|
||||
path = Path(store_path)
|
||||
assert not path.exists()
|
||||
|
||||
@@ -33,7 +33,7 @@ def test_bad(nix: Nix):
|
||||
assert path.exists()
|
||||
|
||||
nix.settings.add_xp_feature("nix-command")
|
||||
res = nix.nix(["path-info", "--json", store_path], build=True).run().ok()
|
||||
res = nix.nix(["path-info", "--json", store_path]).run().ok()
|
||||
assert res.json()[0]["ca"] == "fixed:md5:2qk15sxzzjlnpjk9brn7j8ppcd"
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ def build(nix: Nix, *args) -> CommandResult:
|
||||
outputHash = "sha256-AbpHGcgLb+kRsJGnwFEktk7uzpZOCcBY74+YBdrKVGs=";
|
||||
}
|
||||
"""
|
||||
return nix.nix_build(["-E", expr, "--no-link", "--no-require-sigs", *args], build=True).run()
|
||||
return nix.nix_build(["-E", expr, "--no-link", "--no-require-sigs", *args]).run()
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
|
||||
@@ -85,7 +85,6 @@ def test_build_inaccessible_build_dir(nix: Nix):
|
||||
"--no-link",
|
||||
],
|
||||
flake=True,
|
||||
build=True,
|
||||
).run().ok()
|
||||
finally:
|
||||
# clean up perms
|
||||
|
||||
@@ -142,7 +142,7 @@ def test_build_unsafe_discard(nix: Nix):
|
||||
def drv(nix: Nix) -> str:
|
||||
nix.settings.add_xp_feature("nix-command")
|
||||
return (
|
||||
nix.nix(["eval", "-f", "multiple-outputs.nix", "--raw", "a.drvPath"], build=True)
|
||||
nix.nix(["eval", "-f", "multiple-outputs.nix", "--raw", "a.drvPath"])
|
||||
.run()
|
||||
.ok()
|
||||
.stdout_plain
|
||||
|
||||
@@ -20,7 +20,7 @@ def test_references_detected(nix: Nix):
|
||||
)
|
||||
|
||||
refs_test1, refs_test2 = (
|
||||
nix.nix_store(["-q", "--references", path], build=True).run().ok().stdout_plain.splitlines()
|
||||
nix.nix_store(["-q", "--references", path]).run().ok().stdout_plain.splitlines()
|
||||
for path in [test1, test2]
|
||||
)
|
||||
|
||||
@@ -92,12 +92,7 @@ def test_disallowed_references(nix: Nix):
|
||||
def test_structured_attrs_discard(nix: Nix):
|
||||
result = nix.nix_build(["check-refs.nix", "-A", "test11"]).run().ok().stdout_plain.splitlines()
|
||||
|
||||
assert not (
|
||||
nix.nix_store(["-q", "--references", *result], build=True)
|
||||
.run()
|
||||
.ok()
|
||||
.stdout_plain.splitlines()
|
||||
)
|
||||
assert not (nix.nix_store(["-q", "--references", *result]).run().ok().stdout_plain.splitlines())
|
||||
|
||||
|
||||
@with_files(_files)
|
||||
@@ -127,6 +122,6 @@ def test_regression_partial_build(nix: Nix):
|
||||
.stdout_plain.splitlines()
|
||||
)
|
||||
|
||||
nix.nix_store(["--delete", out], build=True).run().ok()
|
||||
nix.nix_store(["--delete", out]).run().ok()
|
||||
|
||||
nix.nix_build(["regression-reference-checks.nix", "-A", "out"]).run().ok()
|
||||
|
||||
@@ -59,7 +59,7 @@ def tarball(request: FixtureRequest, nix: Nix, files: Path) -> Path:
|
||||
)
|
||||
tarball_path.write_bytes(tarball_content)
|
||||
|
||||
res = nix.nix_env(["-f", f"file://{tarball_path}", "-qa", "--out-path"], build=True).run().ok()
|
||||
res = nix.nix_env(["-f", f"file://{tarball_path}", "-qa", "--out-path"]).run().ok()
|
||||
assert "dependencies" in res.stdout_plain
|
||||
|
||||
return tarball_path
|
||||
@@ -154,7 +154,6 @@ def test_last_modified(nix: Nix, tarball: Path):
|
||||
nix.nix(
|
||||
["eval", "--impure", "--expr", f'(fetchTree "file://{tarball}").lastModified'],
|
||||
flake=True,
|
||||
build=True,
|
||||
)
|
||||
.run()
|
||||
.ok()
|
||||
@@ -189,7 +188,6 @@ def test_no_submodules(nix: Nix, tarball: Path, tar_hash: str):
|
||||
f'!((fetchTree {{ type = "tarball"; url = "file://{tarball}"; narHash = "{tar_hash}"; }})) ? submodules',
|
||||
],
|
||||
flake=True,
|
||||
build=True,
|
||||
)
|
||||
.run()
|
||||
.ok()
|
||||
|
||||
@@ -9,12 +9,9 @@ def test_command_doesnt_crash(nix: Nix):
|
||||
nix.nix(
|
||||
["why-depends", "--derivation", "--file", "./dependencies.nix", "input2_drv", "input1_drv"],
|
||||
flake=True,
|
||||
build=True,
|
||||
).run().ok()
|
||||
nix.nix(
|
||||
["why-depends", "--file", "./dependencies.nix", "input2_drv", "input1_drv"],
|
||||
flake=True,
|
||||
build=True,
|
||||
["why-depends", "--file", "./dependencies.nix", "input2_drv", "input1_drv"], flake=True
|
||||
).run().ok()
|
||||
|
||||
|
||||
@@ -27,7 +24,7 @@ def built_files(nix: Nix):
|
||||
@with_files(get_global_asset_pack("dependencies"))
|
||||
def test_fast_depends(nix: Nix):
|
||||
built_files(nix)
|
||||
res = nix.nix(["why-depends", "./toplevel", "./dep"], flake=True, build=True).run().ok()
|
||||
res = nix.nix(["why-depends", "./toplevel", "./dep"], flake=True).run().ok()
|
||||
assert "input-2" in res.stdout_plain
|
||||
assert "reference-to-input-2" not in res.stdout_plain
|
||||
|
||||
@@ -35,11 +32,7 @@ def test_fast_depends(nix: Nix):
|
||||
@with_files(get_global_asset_pack("dependencies"))
|
||||
def test_precise_depends(nix: Nix):
|
||||
built_files(nix)
|
||||
res = (
|
||||
nix.nix(["why-depends", "./toplevel", "./dep", "--precise"], flake=True, build=True)
|
||||
.run()
|
||||
.ok()
|
||||
)
|
||||
res = nix.nix(["why-depends", "./toplevel", "./dep", "--precise"], flake=True).run().ok()
|
||||
out = res.stdout_plain
|
||||
assert "input-2" in out
|
||||
assert "reference-to-input-2" in out
|
||||
@@ -53,7 +46,7 @@ def test_precise_depends(nix: Nix):
|
||||
@with_files(get_global_asset_pack("dependencies"))
|
||||
def test_self_ref(nix: Nix):
|
||||
built_files(nix)
|
||||
res = nix.nix(["why-depends", "./toplevel", "./toplevel"], flake=True, build=True).run().ok()
|
||||
res = nix.nix(["why-depends", "./toplevel", "./toplevel"], flake=True).run().ok()
|
||||
lines = res.stdout_plain.splitlines()
|
||||
assert "dependencies-top" in lines[0]
|
||||
assert "dependencies-top" in lines[1]
|
||||
@@ -62,9 +55,7 @@ def test_self_ref(nix: Nix):
|
||||
@with_files(get_global_asset_pack("dependencies"))
|
||||
def test_all(nix: Nix):
|
||||
built_files(nix)
|
||||
res = (
|
||||
nix.nix(["why-depends", "./toplevel", "./dep3", "--all"], flake=True, build=True).run().ok()
|
||||
)
|
||||
res = nix.nix(["why-depends", "./toplevel", "./dep3", "--all"], flake=True).run().ok()
|
||||
lines = res.stdout_plain.splitlines()
|
||||
assert "dependencies-top" in lines[0]
|
||||
assert "input-2" in lines[1]
|
||||
|
||||
@@ -23,8 +23,7 @@ def test_compression_levels(nix: Nix):
|
||||
"--to",
|
||||
f"file://{c_dir}?compression=xz&compression-level={level}",
|
||||
out_path,
|
||||
],
|
||||
build=True,
|
||||
]
|
||||
)
|
||||
.run()
|
||||
.ok()
|
||||
|
||||
@@ -25,7 +25,7 @@ def test_substitute_truncated_nar(nix: Nix):
|
||||
|
||||
assert nar.exists()
|
||||
|
||||
res = nix.nix([], "nix-collect-garbage", build=True).run().ok()
|
||||
res = nix.nix([], "nix-collect-garbage").run().ok()
|
||||
# .drv file + built path
|
||||
assert "2 store paths deleted" in res.stderr_plain
|
||||
|
||||
|
||||
@@ -9,22 +9,22 @@ from testlib.utils import get_global_asset_pack
|
||||
def test_dump_db(nix: Nix):
|
||||
nix.nix_build(["dependencies.nix", "-o", "result"]).run().ok()
|
||||
|
||||
res = nix.nix_store(["-qR", "result"], build=True).run().ok()
|
||||
res = nix.nix_store(["-qR", "result"]).run().ok()
|
||||
deps = res.stdout_plain
|
||||
|
||||
res = nix.nix_store(["--dump-db"], build=True).run().ok()
|
||||
res = nix.nix_store(["--dump-db"]).run().ok()
|
||||
dump = res.stdout
|
||||
|
||||
shutil.rmtree(nix.env.dirs.nix_state_dir / "db")
|
||||
|
||||
nix.nix_store(["--load-db"], build=True).with_stdin(dump).run().ok()
|
||||
nix.nix_store(["--load-db"]).with_stdin(dump).run().ok()
|
||||
|
||||
res = nix.nix_store(["-qR", "result"], build=True).run().ok()
|
||||
res = nix.nix_store(["-qR", "result"]).run().ok()
|
||||
deps2 = res.stdout_plain
|
||||
|
||||
assert deps == deps2
|
||||
|
||||
res = nix.nix_store(["--dump-db"], build=True).run().ok()
|
||||
res = nix.nix_store(["--dump-db"]).run().ok()
|
||||
dump2 = res.stdout
|
||||
|
||||
assert dump == dump2
|
||||
|
||||
@@ -4,7 +4,7 @@ import dataclasses
|
||||
import sys
|
||||
from functools import partialmethod
|
||||
from pathlib import Path
|
||||
from typing import Any, Literal
|
||||
from typing import Any
|
||||
from collections.abc import Callable, Generator
|
||||
import shutil
|
||||
import subprocess
|
||||
@@ -155,12 +155,7 @@ class Nix:
|
||||
|
||||
return self._settings
|
||||
|
||||
def nix_cmd(
|
||||
self,
|
||||
argv: list[str],
|
||||
flake: bool = False,
|
||||
build: bool | Literal["auto"] = "auto", # noqa: ARG002
|
||||
) -> Command:
|
||||
def nix_cmd(self, argv: list[str], flake: bool = False) -> Command:
|
||||
"""
|
||||
Constructs a NixCommand with the appropriate settings.
|
||||
:param build: if the executed command wants to build stuff. This is required due to darwin shenanigans. "auto" will try to autodetect, override using `True` or `False`. Has no effect on linux.
|
||||
@@ -173,14 +168,8 @@ class Nix:
|
||||
settings.to_env_overlay(self.env)
|
||||
return Command(argv=argv, exe=self._nix_executable, _env=self.env)
|
||||
|
||||
def nix(
|
||||
self,
|
||||
cmd: list[str],
|
||||
nix_exe: str = "nix",
|
||||
flake: bool = False,
|
||||
build: bool | Literal["auto"] = "auto",
|
||||
) -> Command:
|
||||
return self.nix_cmd([nix_exe, *cmd], flake=flake, build=build)
|
||||
def nix(self, cmd: list[str], nix_exe: str = "nix", flake: bool = False) -> Command:
|
||||
return self.nix_cmd([nix_exe, *cmd], flake=flake)
|
||||
|
||||
@contextlib.contextmanager
|
||||
def daemon(
|
||||
|
||||
Reference in New Issue
Block a user