Flox Package Database 1
CRUD Operations on Nix Package Metadata
Loading...
Searching...
No Matches
Namespaces | Functions
descriptor.cc File Reference

A set of user inputs used to set input preferences and query parameters during resolution. More...

#include <algorithm>
#include <map>
#include <nlohmann/json.hpp>
#include <optional>
#include <regex>
#include <stddef.h>
#include <string>
#include <string_view>
#include <utility>
#include <variant>
#include <vector>
#include <nix/attrs.hh>
#include <nix/flake/flakeref.hh>
#include "flox/core/types.hh"
#include "flox/core/util.hh"
#include "flox/pkgdb/pkg-query.hh"
#include "flox/resolver/descriptor.hh"
#include "versions.hh"

Namespaces

namespace  flox
 Interfaces for use by flox.
 

Functions

static AttrPathGlob flox::resolver::maybeSplitAttrPathGlob (const ManifestDescriptorRaw::AbsPath &absPath)
 Get a flox::resolver::AttrPathGlob from a string if necessary.
 
static void flox::resolver::initManifestDescriptorVersion (ManifestDescriptor &desc, const std::string &version)
 Sets either version or semver on a flox::resolver::ManifestDescriptor.
 
static void flox::resolver::initManifestDescriptorAbsPath (ManifestDescriptor &desc, const ManifestDescriptorRaw &raw)
 Sets various fields on a flox::resolver::ManifestDescriptor based on the absPath field.
 
void flox::resolver::from_json (const nlohmann::json &jfrom, ManifestDescriptorRaw &descriptor)
 Convert a JSON object to an flox::ManifestDescriptorRaw.
 
void flox::resolver::to_json (nlohmann::json &jto, const ManifestDescriptorRaw &descriptor)
 Convert an flox::resolver::ManifestDescriptorRaw to a JSON object.
 
std::optional< std::string > flox::resolver::validatedSingleAttr (const AttrPathGlob &attrs)
 
bool flox::resolver::globInAttrName (const AttrPathGlob &attrs)
 Validates a single attribute name, pname, etc from a globbed flox::AttrPathGlob, returning the attribute name if it is suitable for appearing as a single attribute in a descriptor.
 
std::vector< std::string > flox::resolver::validatedRelativePath (const AttrPathGlob &attrs, const std::vector< std::string > &strings)
 Validates a relative attribute path from a globbed flox::AttrPathGlob, returning the string form of the relative path for use in the flox::resolver::ManifestDescriptorRaw.
 
AttrPathGlob flox::resolver::validatedAbsolutePath (const AttrPathGlob &attrs)
 Validates an absolute path from a globbed flox::AttrPathGlob, returning the attribute path if it is suitable for an absolute path appearing in a descriptor.
 
bool flox::resolver::isAbsolutePath (const AttrPathGlob &attrs)
 Returns true if the attribute path has enough path components and begins with one of the allowed prefixes (legacyPackages or packages).
 
void flox::resolver::to_json (nlohmann::json &jto, const ManifestDescriptor &descriptor)
 Convert an flox::resolver::ManifestDescriptor to a JSON object.
 

Detailed Description

A set of user inputs used to set input preferences and query parameters during resolution.

Function Documentation

◆ globInAttrName()

std bool flox::resolver::globInAttrName ( const AttrPathGlob attrs)

Validates a single attribute name, pname, etc from a globbed flox::AttrPathGlob, returning the attribute name if it is suitable for appearing as a single attribute in a descriptor.

Returns true if any component in the attribute path contains a glob but is not itself entirely a glob. For example, this would return true for foo.b*ar.baz, but not for foo.*.baz since b*ar contains a glob, but is not itself entirely a glob.

◆ initManifestDescriptorAbsPath()

static void flox::resolver::initManifestDescriptorAbsPath ( ManifestDescriptor desc,
const ManifestDescriptorRaw raw 
)
static

Sets various fields on a flox::resolver::ManifestDescriptor based on the absPath field.

Parameters
descThe descriptor to initialize.
rawThe raw description to parse.

◆ initManifestDescriptorVersion()

static void flox::resolver::initManifestDescriptorVersion ( ManifestDescriptor desc,
const std::string &  version 
)
static

Sets either version or semver on a flox::resolver::ManifestDescriptor.

Distinguishes between semver ranges and exact version matchers.

Parameters
descThe descriptor to initialize.
versionThe version description to parse.