mirror of
https://github.com/NixOS/nix
synced 2025-06-28 17:51:15 +02:00
* Unify the treatment of sources copied to the store, and recursive
SHA-256 outputs of fixed-output derivations. I.e. they now produce the same store path: $ nix-store --add x /nix/store/j2fq9qxvvxgqymvpszhs773ncci45xsj-x $ nix-store --add-fixed --recursive sha256 x /nix/store/j2fq9qxvvxgqymvpszhs773ncci45xsj-x the latter being the same as the path that a derivation derivation { name = "x"; outputHashAlgo = "sha256"; outputHashMode = "recursive"; outputHash = "..."; ... }; produces. This does change the output path for such fixed-output derivations. Fortunately they are quite rare. The most common use is fetchsvn calls with SHA-256 hashes. (There are a handful of those is Nixpkgs, mostly unstable development packages.) * Documented the computation of store paths (in store-api.cc).
This commit is contained in:
parent
09bc0c502c
commit
64519cfd65
12 changed files with 191 additions and 79 deletions
|
@ -173,13 +173,13 @@ public:
|
|||
derivation is pre-loaded into the Nix store. The function
|
||||
object `filter' can be used to exclude files (see
|
||||
libutil/archive.hh). */
|
||||
virtual Path addToStore(const Path & srcPath, bool fixed = false,
|
||||
bool recursive = false, string hashAlgo = "",
|
||||
virtual Path addToStore(const Path & srcPath,
|
||||
bool recursive = true, string hashAlgo = "sha256",
|
||||
PathFilter & filter = defaultPathFilter) = 0;
|
||||
|
||||
/* Like addToStore, but the contents written to the output path is
|
||||
a regular file containing the given string. */
|
||||
virtual Path addTextToStore(const string & suffix, const string & s,
|
||||
virtual Path addTextToStore(const string & name, const string & s,
|
||||
const PathSet & references) = 0;
|
||||
|
||||
/* Export a store path, that is, create a NAR dump of the store
|
||||
|
@ -274,7 +274,7 @@ Path followLinksToStorePath(const Path & path);
|
|||
|
||||
/* Constructs a unique store path name. */
|
||||
Path makeStorePath(const string & type,
|
||||
const Hash & hash, const string & suffix);
|
||||
const Hash & hash, const string & name);
|
||||
|
||||
Path makeFixedOutputPath(bool recursive,
|
||||
string hashAlgo, Hash hash, string name);
|
||||
|
@ -285,7 +285,7 @@ Path makeFixedOutputPath(bool recursive,
|
|||
Returns the store path and the cryptographic hash of the
|
||||
contents of srcPath. */
|
||||
std::pair<Path, Hash> computeStorePathForPath(const Path & srcPath,
|
||||
bool fixed = false, bool recursive = false, string hashAlgo = "",
|
||||
bool recursive = true, string hashAlgo = "sha256",
|
||||
PathFilter & filter = defaultPathFilter);
|
||||
|
||||
/* Preparatory part of addTextToStore().
|
||||
|
@ -302,7 +302,7 @@ std::pair<Path, Hash> computeStorePathForPath(const Path & srcPath,
|
|||
simply yield a different store path, so other users wouldn't be
|
||||
affected), but it has some backwards compatibility issues (the
|
||||
hashing scheme changes), so I'm not doing that for now. */
|
||||
Path computeStorePathForText(const string & suffix, const string & s,
|
||||
Path computeStorePathForText(const string & name, const string & s,
|
||||
const PathSet & references);
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue