diff options
author | Carlo Nucera <carlo.nucera@protonmail.com> | 2020-06-03 16:08:32 -0400 |
---|---|---|
committer | Carlo Nucera <carlo.nucera@protonmail.com> | 2020-06-03 16:08:32 -0400 |
commit | 132d6f2c2419891b92870c61c599a5e6aa97c865 (patch) | |
tree | 371bf64954cb3d9ded9e610333f4ad184938f1da /src/libstore/store-api.cc | |
parent | 01572c2198de49071827f0be9f5db202bac21703 (diff) |
Clarify the description of StorePath construction
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r-- | src/libstore/store-api.cc | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 095363d0c..e5492ce34 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -69,7 +69,7 @@ string storePathToHash(const Path & path) /* Store paths have the following form: - <store>/<h>-<name> + <realized-path> = <store>/<h>-<name> where @@ -93,11 +93,14 @@ string storePathToHash(const Path & path) <type> = one of: "text:<r1>:<r2>:...<rN>" for plain text files written to the store using - addTextToStore(); <r1> ... <rN> are the references of the - path. - "source" + addTextToStore(); <r1> ... <rN> are the store paths referenced + by this path, in the form described by <realized-path> + "source:<r1>:<r2>:...:<rN>:self" for paths copied to the store using addToStore() when recursive - = true and hashAlgo = "sha256" + = true and hashAlgo = "sha256". Just like in the text case, we + can have the store paths referenced by the path. + Additionally, we can have an optional :self label to denote self + reference. "output:<id>" for either the outputs created by derivations, OR paths copied to the store using addToStore() with recursive != true or @@ -125,6 +128,12 @@ string storePathToHash(const Path & path) the contents of the path (or expected contents of the path for fixed-output derivations) + Note that since an output derivation has always type output, while + something added by addToStore can have type output or source depending + on the hash, this means that the same input can be hashed differently + if added to the store via addToStore or via a derivation, in the sha256 + recursive case. + It would have been nicer to handle fixed-output derivations under "source", e.g. have something like "source:<rec><algo>", but we're stuck with this for now... |