aboutsummaryrefslogtreecommitdiff
#pragma once

#include "types.hh"
#include "hash.hh"

#include <map>


namespace nix {


/* Extension of derivations in the Nix store. */
const string drvExtension = ".drv";


/* Abstract syntax of derivations. */

struct DerivationOutput
{
    Path path;
    string hashAlgo; /* hash used for expected hash computation */
    string hash; /* expected hash, may be null */
    DerivationOutput()
    {
    }
    DerivationOutput(Path path, string hashAlgo, string hash)
    {
        this->path = path;
        this->hashAlgo = hashAlgo;
        this->hash = hash;
    }
    void parseHashInfo(bool & recursive, HashType & hashType, Hash & hash) const;
};

typedef std::map<string, DerivationOutput> DerivationOutputs;

/* For inputs that are sub-derivations, we specify exactly which
   output IDs we are interested in. */
typedef std::map<Path, StringSet> DerivationInputs;

typedef std::map<string, string> StringPairs;

struct Derivation
{
    DerivationOutputs outputs; /* keyed on symbolic IDs */
    DerivationInputs inputDrvs; /* inputs that are sub-derivations */
    PathSet inputSrcs; /* inputs that are sources */
    string platform;
    Path builder;
    Strings args;
    StringPairs env;
};


class StoreAPI;


/* Write a derivation to the Nix store, and return its path. */
Path writeDerivation(StoreAPI & store,
    const Derivation & drv, const string & name, bool repair = false);

/* Read a derivation from a file. */
Derivation readDerivation(const Path & drvPath);

/* Print a derivation. */
string unparseDerivation(const Derivation & drv);

/* Check whether a file name ends with the extensions for
   derivations. */
bool isDerivation(const string & fileName);

/* Return true iff this is a fixed-output derivation. */
bool isFixedOutputDrv(const Derivation & drv);

Hash hashDerivationModulo(StoreAPI & store, Derivation drv);

/* Memoisation of hashDerivationModulo(). */
typedef std::map<Path, Hash> DrvHashes;

extern DrvHashes drvHashes;

/* Split a string specifying a derivation and a set of outputs
   (/nix/store/hash-foo!out1,out2,...) into the derivation path and
   the outputs. */
typedef std::pair<string, std::set<string> > DrvPathWithOutputs;
DrvPathWithOutputs parseDrvPathWithOutputs(const string & s);

Path makeDrvPathWithOutputs(const Path & drvPath, const std::set<string> & outputs);

bool wantOutput(const string & output, const std::set<string> & wanted);

PathSet outputPaths(const Derivation & drv);

}
:09 +0200'>2018-08-09gnu: java-snappy: Update to 1.1.7.2....* gnu/packages/compression.scm (java-snappy): Update to 1.1.7.2. Tobias Geerinckx-Rice 2018-07-26gnu: cabextract: Delete bundled libmspack....* gnu/packages/compression.scm (cabextract)[source](modules, snippet): New field. Marius Bakke 2018-07-26gnu: cabextract: Update to 1.7....* gnu/packages/compression.scm (cabextract): Update to 1.7. Marius Bakke 2018-07-25gnu: Update cabextract.org.uk home pages....* gnu/packages/compression.scm (libmspack, cabextract)[home-page, source]: Use HTTPS. Marius Bakke 2018-07-25gnu: libmspack: Don't build static library....* gnu/packages/compression.scm (libmspack)[arguments]: Add #:configure-flags. Marius Bakke 2018-07-25gnu: libmspack: Update to 0.7....* gnu/packages/compression.scm (libmspack): Update to 0.7. Marius Bakke 2018-07-18gnu: Add bsdiff....* gnu/packages/compression.scm (bsdiff): New public variable. Marius Bakke 2018-07-12gnu: libzip: Update to 1.5.1....* gnu/packages/compression.scm (libzip): Update to 1.5.1. [build-system]: Switch to CMAKE-BUILD-SYSTEM. Marius Bakke 2018-07-02gnu: zstd: Update to 1.3.5....* gnu/packages/compression.scm (zstd): Update to 1.3.5. [source]: Add two patches to make the test suite pass. * gnu/packages/patches/zstd-fix-stdin-list-without-tty.patch, gnu/packages/patches/zstd-fix-stdin-list-test.patch: New files. * gnu/local.mk (dist_patch_DATA): Add both. Tobias Geerinckx-Rice 2018-06-22gnu: sfarkxtc: Update to 0-1.13cd6f937....* gnu/packages/compression.scm (sfarkxtc): Update to 0-1.13cd6f937. Ricardo Wurmus 2018-06-17gnu: upx: Fix CVE-2017-15056....* gnu/packages/patches/upx-protect-against-bad-crafted-input.patch: New file. * gnu/packages/compression.scm (upx)[source]: Use it. * gnu/local.mk (dist_patch_DATA): Add it. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Pierre Neidhardt 2018-06-15gnu: innoextract: Update to 1.7....* gnu/packages/compression.scm (innoextract): Update to 1.7. Rutger Helling 2018-06-05Merge branch 'master' into core-updatesRicardo Wurmus 2018-06-04gnu: lz4: Use HTTPS home page....* gnu/packages/compression.scm (lz4)[home-page]: Use HTTPS. Tobias Geerinckx-Rice 2018-05-28Merge branch 'master' into core-updatesMark H Weaver 2018-05-28gnu: Add squashfs-tools-next....* gnu/packages/compression.scm (squashfs-tools-next): New variable. Ricardo Wurmus 2018-05-27Merge branch 'master' into core-updatesMark H Weaver 2018-05-26gnu: Add upx....* gnu/packages/compression.scm (upx): New variable. Pierre Neidhardt 2018-05-26gnu: Add ucl....* gnu/packages/compression.scm (ucl): New variable. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Pierre Neidhardt 2018-05-21Merge branch 'master' into core-updatesMark H Weaver 2018-05-19gnu: perl-io-compress: Update to 2.081....* gnu/packages/compression.scm (perl-io-compress): Update to 2.081. Tobias Geerinckx-Rice 2018-05-19gnu: perl-compress-raw-bzip2: Update to 2.081....* gnu/packages/compression.scm (perl-compress-raw-bzip2): Update to 2.081. Tobias Geerinckx-Rice 2018-05-19gnu: perl-compress-raw-zlib: Update to 2.081....* gnu/packages/compression.scm (perl-compress-raw-zlib): Update to 2.081. Tobias Geerinckx-Rice 2018-04-21Merge branch 'master' into core-updatesMark H Weaver 2018-04-16gnu: sharutils: Fix CVE-2018-1000097....* gnu/packages/patches/sharutils-CVE-2018-1000097.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. * gnu/packages/compression.scm (sharutils)[source](patches): Use it. Marius Bakke 2018-04-15gnu: google-brotli: Update to 1.0.4....* gnu/packages/compression.scm (google-brotli): Update to 1.0.4. Tobias Geerinckx-Rice 2018-04-12gnu: pzstd: Use invoke....* gnu/packages/compression.scm (pzstd)[arguments]: Use invoke. Mark H Weaver 2018-04-12gnu: unshield: Use invoke....* gnu/packages/compression.scm (unshield)[arguments]: Use invoke. Mark H Weaver 2018-04-12gnu: p7zip: Use invoke....* gnu/packages/compression.scm (p7zip)[arguments]: Use invoke and remove vestigial plumbing. Mark H Weaver 2018-04-12gnu: java-iq80-snappy: Use invoke....* gnu/packages/compression.scm (java-iq80-snappy)[arguments]: Use invoke and remove vestigial plumbing. Mark H Weaver 2018-04-12gnu: java-snappy-1: Use invoke....* gnu/packages/compression.scm (java-snappy-1)[arguments]: Use invoke. Mark H Weaver 2018-04-12gnu: xdelta: Use invoke....* gnu/packages/compression.scm (xdelta)[arguments]: Use invoke. Return a boolean from all phase procedures. Mark H Weaver 2018-04-12gnu: brotli: Use invoke....* gnu/packages/compression.scm (brotli)[arguments]: Use invoke. Mark H Weaver 2018-04-12gnu: libtar: Use invoke....* gnu/packages/compression.scm (libtar)[arguments]: Use invoke. Mark H Weaver 2018-04-12gnu: minizip: Use invoke....* gnu/packages/compression.scm (minizip)[arguments]: Use invoke. Mark H Weaver