From d567baabbd99fdb92e67295a77aef76ef970e65c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 1 Jul 2008 10:10:32 +0000 Subject: * 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. --- src/libexpr/names.hh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/libexpr/names.hh (limited to 'src/libexpr/names.hh') diff --git a/src/libexpr/names.hh b/src/libexpr/names.hh new file mode 100644 index 000000000000..e189302d6d94 --- /dev/null +++ b/src/libexpr/names.hh @@ -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 DrvNames; + + +int compareVersions(const string & v1, const string & v2); +DrvNames drvNamesFromArgs(const Strings & opArgs); + + +} + + +#endif /* !__NAMES_H */ -- cgit 1.4.1