Use ^
not !
in indexed store derivations installable syntax
Match the other syntax that was recently added
This commit is contained in:
parent
b18720ee17
commit
49ad315c03
|
@ -799,11 +799,12 @@ std::vector<std::shared_ptr<Installable>> SourceExprCommand::parseInstallables(
|
|||
for (auto & s : ss) {
|
||||
std::exception_ptr ex;
|
||||
|
||||
if (s.rfind('!') != std::string::npos) {
|
||||
auto found = s.rfind('^');
|
||||
if (found != std::string::npos) {
|
||||
try {
|
||||
result.push_back(std::make_shared<InstallableIndexedStorePath>(
|
||||
store,
|
||||
DerivedPath::Built::parse(*store, s)));
|
||||
DerivedPath::Built::parse(*store, s.substr(0, found), s.substr(found + 1))));
|
||||
settings.requireExperimentalFeature(Xp::ComputedDerivations);
|
||||
continue;
|
||||
} catch (BadStorePath &) {
|
||||
|
@ -813,7 +814,8 @@ std::vector<std::shared_ptr<Installable>> SourceExprCommand::parseInstallables(
|
|||
}
|
||||
}
|
||||
|
||||
if (s.find('/') != std::string::npos) {
|
||||
found = s.find('/');
|
||||
if (found != std::string::npos) {
|
||||
try {
|
||||
result.push_back(std::make_shared<InstallableStorePath>(store, store->followLinksToStorePath(s)));
|
||||
continue;
|
||||
|
|
|
@ -93,12 +93,9 @@ DerivedPath::Opaque DerivedPath::Opaque::parse(const Store & store, std::string_
|
|||
return {store.parseStorePath(s)};
|
||||
}
|
||||
|
||||
DerivedPath::Built DerivedPath::Built::parse(const Store & store, std::string_view s)
|
||||
DerivedPath::Built DerivedPath::Built::parse(const Store & store, std::string_view drvS, std::string_view outputsS)
|
||||
{
|
||||
size_t n = s.find("!");
|
||||
assert(n != s.npos);
|
||||
auto drvPath = store.parseStorePath(s.substr(0, n));
|
||||
auto outputsS = s.substr(n + 1);
|
||||
auto drvPath = store.parseStorePath(drvS);
|
||||
std::set<std::string> outputs;
|
||||
if (outputsS != "*")
|
||||
outputs = tokenizeString<std::set<std::string>>(outputsS, ",");
|
||||
|
@ -107,10 +104,10 @@ DerivedPath::Built DerivedPath::Built::parse(const Store & store, std::string_vi
|
|||
|
||||
DerivedPath DerivedPath::parse(const Store & store, std::string_view s)
|
||||
{
|
||||
size_t n = s.find("!");
|
||||
size_t n = s.rfind("!");
|
||||
return n == s.npos
|
||||
? (DerivedPath) DerivedPath::Opaque::parse(store, s)
|
||||
: (DerivedPath) DerivedPath::Built::parse(store, s);
|
||||
: (DerivedPath) DerivedPath::Built::parse(store, s.substr(0, n), s.substr(n + 1));
|
||||
}
|
||||
|
||||
RealisedPath::Set BuiltPath::toRealisedPaths(Store & store) const
|
||||
|
|
|
@ -47,7 +47,7 @@ struct DerivedPathBuilt {
|
|||
std::set<std::string> outputs;
|
||||
|
||||
std::string to_string(const Store & store) const;
|
||||
static DerivedPathBuilt parse(const Store & store, std::string_view);
|
||||
static DerivedPathBuilt parse(const Store & store, std::string_view, std::string_view);
|
||||
nlohmann::json toJSON(ref<Store> store) const;
|
||||
|
||||
bool operator < (const DerivedPathBuilt & b) const
|
||||
|
|
|
@ -130,7 +130,7 @@ the Nix store. Here are the recognised types of installables:
|
|||
If you want to operate on the store derivation itself, pass the
|
||||
`--derivation` flag.
|
||||
|
||||
* **Indexed store derivations**: `/nix/store/p7gp6lxdg32h4ka1q398wd9r2zkbbz2v-hello-2.10.drv!out`
|
||||
* **Indexed store derivations**: `/nix/store/p7gp6lxdg32h4ka1q398wd9r2zkbbz2v-hello-2.10.drv^out`
|
||||
|
||||
*(Experimental, part of by the `computed-derivations` experimental feature.)*
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@ enableFeatures "computed-derivations"
|
|||
restartDaemon
|
||||
|
||||
drv=$(nix eval -f multiple-outputs.nix --raw a.drvPath)
|
||||
if nix build "$drv!not-an-output" --json; then
|
||||
if nix build "$drv^not-an-output" --json; then
|
||||
fail "'not-an-output' should fail to build"
|
||||
fi
|
||||
|
||||
nix build "$drv!first" --json | jq --exit-status '
|
||||
nix build "$drv^first" --json | jq --exit-status '
|
||||
(.[0] |
|
||||
(.drvPath | match(".*multiple-outputs-a.drv")) and
|
||||
(.outputs |
|
||||
|
|
Loading…
Reference in a new issue