1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00

Require drvPath attribute to end with .drv

Fixes #4977
This commit is contained in:
John Ericson 2024-05-22 12:35:44 -04:00
parent bd7a074636
commit f923ed6b6a
11 changed files with 71 additions and 34 deletions

View file

@ -35,30 +35,23 @@ public:
StorePath(const Hash & hash, std::string_view name);
std::string_view to_string() const
std::string_view to_string() const noexcept
{
return baseName;
}
bool operator < (const StorePath & other) const
{
return baseName < other.baseName;
}
bool operator == (const StorePath & other) const
{
return baseName == other.baseName;
}
bool operator != (const StorePath & other) const
{
return baseName != other.baseName;
}
bool operator == (const StorePath & other) const noexcept = default;
auto operator <=> (const StorePath & other) const noexcept = default;
/**
* Check whether a file name ends with the extension for derivations.
*/
bool isDerivation() const;
bool isDerivation() const noexcept;
/**
* Throw an exception if `isDerivation` is false.
*/
void requireDerivation() const;
std::string_view name() const
{
@ -82,7 +75,7 @@ typedef std::vector<StorePath> StorePaths;
* The file extension of \ref Derivation derivations when serialized
* into store objects.
*/
const std::string drvExtension = ".drv";
constexpr std::string_view drvExtension = ".drv";
}