mirror of
https://github.com/NixOS/nix
synced 2025-06-28 22:01:15 +02:00
* Export the nix-env derivation name parsing and version comparison
logic through the `parseDrvName' and `compareVersions' primops. This will allow expressions to easily check whether some dependency is a specific needed version or falls in some version range. See tests/lang/eval-okay-versions.nix for examples.
This commit is contained in:
parent
b3b0b2a29e
commit
d567baabbd
9 changed files with 103 additions and 37 deletions
33
src/libexpr/names.hh
Normal file
33
src/libexpr/names.hh
Normal file
|
@ -0,0 +1,33 @@
|
|||
#ifndef __NAMES_H
|
||||
#define __NAMES_H
|
||||
|
||||
#include "types.hh"
|
||||
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
||||
struct DrvName
|
||||
{
|
||||
string fullName;
|
||||
string name;
|
||||
string version;
|
||||
unsigned int hits;
|
||||
|
||||
DrvName();
|
||||
DrvName(const string & s);
|
||||
bool matches(DrvName & n);
|
||||
};
|
||||
|
||||
|
||||
typedef list<DrvName> DrvNames;
|
||||
|
||||
|
||||
int compareVersions(const string & v1, const string & v2);
|
||||
DrvNames drvNamesFromArgs(const Strings & opArgs);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif /* !__NAMES_H */
|
Loading…
Add table
Add a link
Reference in a new issue