about summary refs log tree commit diff
path: root/src/libstore/store-api.hh
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2008-12-03T15·06+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2008-12-03T15·06+0000
commit64519cfd657d024ae6e2bb74cb21ad21b886fd2a (patch)
treecfcc6f0457009a392914201f8379f2cbd734d147 /src/libstore/store-api.hh
parent09bc0c502c4a52baf0bd363d8ee5f18d49244f73 (diff)
* 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).

Diffstat (limited to 'src/libstore/store-api.hh')
-rw-r--r--src/libstore/store-api.hh12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh
index ed7e60146029..adfd40a91908 100644
--- a/src/libstore/store-api.hh
+++ b/src/libstore/store-api.hh
@@ -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);