mirror of
https://github.com/NixOS/nix.git
synced 2025-11-16 07:22:43 +01:00
DerivationInfo -> PackageInfo
This does not yet resolve the coupling between packages and
derivations, but it makes the code more consistent with the
terminology, and it accentuates places where the coupling is
obvious, such as
auto drvPath = packageInfo.queryDrvPath();
if (!drvPath)
throw Error("'%s' is not a derivation", what());
... which isn't wrong, and in my opinion, doesn't even look
wrong, because it just reflects the current logic.
However, I do like that we can now start to see in the code that
this coupling is perhaps a bit arbitrary.
After this rename, we can bring the DerivingPath concept into type
and start to lift this limitation.
This commit is contained in:
parent
86156d05dd
commit
65255edc9b
13 changed files with 111 additions and 111 deletions
|
|
@ -289,7 +289,7 @@ static void main_nix_build(int argc, char * * argv)
|
|||
if (runEnv)
|
||||
setenv("IN_NIX_SHELL", pure ? "pure" : "impure", 1);
|
||||
|
||||
DrvInfos drvs;
|
||||
PackageInfos drvs;
|
||||
|
||||
/* Parse the expressions. */
|
||||
std::vector<Expr *> exprs;
|
||||
|
|
@ -307,7 +307,7 @@ static void main_nix_build(int argc, char * * argv)
|
|||
} catch (Error & e) {};
|
||||
auto [path, outputNames] = parsePathWithOutputs(absolute);
|
||||
if (evalStore->isStorePath(path) && hasSuffix(path, ".drv"))
|
||||
drvs.push_back(DrvInfo(*state, evalStore, absolute));
|
||||
drvs.push_back(PackageInfo(*state, evalStore, absolute));
|
||||
else
|
||||
/* If we're in a #! script, interpret filenames
|
||||
relative to the script. */
|
||||
|
|
@ -383,8 +383,8 @@ static void main_nix_build(int argc, char * * argv)
|
|||
if (drvs.size() != 1)
|
||||
throw UsageError("nix-shell requires a single derivation");
|
||||
|
||||
auto & drvInfo = drvs.front();
|
||||
auto drv = evalStore->derivationFromPath(drvInfo.requireDrvPath());
|
||||
auto & packageInfo = drvs.front();
|
||||
auto drv = evalStore->derivationFromPath(packageInfo.requireDrvPath());
|
||||
|
||||
std::vector<DerivedPath> pathsToBuild;
|
||||
RealisedPath::Set pathsToCopy;
|
||||
|
|
@ -527,7 +527,7 @@ static void main_nix_build(int argc, char * * argv)
|
|||
for (const auto & [inputDrv, inputNode] : drv.inputDrvs.map)
|
||||
accumInputClosure(inputDrv, inputNode);
|
||||
|
||||
ParsedDerivation parsedDrv(drvInfo.requireDrvPath(), drv);
|
||||
ParsedDerivation parsedDrv(packageInfo.requireDrvPath(), drv);
|
||||
|
||||
if (auto structAttrs = parsedDrv.prepareStructuredAttrs(*store, inputs)) {
|
||||
auto json = structAttrs.value();
|
||||
|
|
@ -620,10 +620,10 @@ static void main_nix_build(int argc, char * * argv)
|
|||
|
||||
std::map<StorePath, std::pair<size_t, StringSet>> drvMap;
|
||||
|
||||
for (auto & drvInfo : drvs) {
|
||||
auto drvPath = drvInfo.requireDrvPath();
|
||||
for (auto & packageInfo : drvs) {
|
||||
auto drvPath = packageInfo.requireDrvPath();
|
||||
|
||||
auto outputName = drvInfo.queryOutputName();
|
||||
auto outputName = packageInfo.queryOutputName();
|
||||
if (outputName == "")
|
||||
throw Error("derivation '%s' lacks an 'outputName' attribute", store->printStorePath(drvPath));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue