diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-02-09 12:57:13 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-02-09 12:57:13 +0000 |
commit | 98df735b5149bc1e39ce6b0bae13fbf7cebcdc05 (patch) | |
tree | 9a9549e0689400b71e230ba51317a2590969b63d /src | |
parent | 582e01c06f9ecee25a31c34562926b41dc2856eb (diff) |
* Propagate the deriver of a path through the substitute mechanism.
* Removed some dead code (successor stuff) from nix-push.
* Updated terminology in the tests (store expr -> drv path).
* Check that the deriver is set properly in the tests.
Diffstat (limited to 'src')
-rw-r--r-- | src/libstore/build.cc | 3 | ||||
-rw-r--r-- | src/libstore/store.cc | 17 | ||||
-rw-r--r-- | src/libstore/store.hh | 5 | ||||
-rw-r--r-- | src/nix-store/main.cc | 1 |
4 files changed, 19 insertions, 7 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 3785c7da7..e71201785 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -1502,7 +1502,8 @@ void SubstitutionGoal::finished() Transaction txn; createStoreTransaction(txn); - registerValidPath(txn, storePath, contentHash, references, ""); + registerValidPath(txn, storePath, contentHash, + references, sub.deriver); txn.commit(); outputLock->setDeletion(true); diff --git a/src/libstore/store.cc b/src/libstore/store.cc index 83577e4fb..5516dc801 100644 --- a/src/libstore/store.cc +++ b/src/libstore/store.cc @@ -391,6 +391,9 @@ Path queryDeriver(const Transaction & txn, const Path & storePath) } +const int substituteVersion = 2; + + static Substitutes readSubstitutes(const Transaction & txn, const Path & srcPath) { @@ -406,13 +409,15 @@ static Substitutes readSubstitutes(const Transaction & txn, break; } Strings ss2 = unpackStrings(*i); - if (ss2.size() == 3) { - /* Another old-style substitute. */ - continue; - } - if (ss2.size() != 2) throw Error("malformed substitute"); + if (ss2.size() == 0) continue; + int version; + if (!string2Int(ss2.front(), version)) continue; + if (version != substituteVersion) continue; + if (ss2.size() != 4) throw Error("malformed substitute"); Strings::iterator j = ss2.begin(); + j++; Substitute sub; + sub.deriver = *j++; sub.program = *j++; sub.args = unpackStrings(*j++); subs.push_back(sub); @@ -431,6 +436,8 @@ static void writeSubstitutes(const Transaction & txn, i != subs.end(); ++i) { Strings ss2; + ss2.push_back((format("%1%") % substituteVersion).str()); + ss2.push_back(i->deriver); ss2.push_back(i->program); ss2.push_back(packStrings(i->args)); ss.push_back(packStrings(ss2)); diff --git a/src/libstore/store.hh b/src/libstore/store.hh index 082fc9de4..3b18664de 100644 --- a/src/libstore/store.hh +++ b/src/libstore/store.hh @@ -16,7 +16,10 @@ const int nixSchemaVersion = 2; path (typically by fetching it from somewhere, e.g., from the network). */ struct Substitute -{ +{ + /* The derivation that built this store path (empty if none). */ + Path deriver; + /* Program to be executed to create the store path. Must be in the output path of `storeExpr'. */ Path program; diff --git a/src/nix-store/main.cc b/src/nix-store/main.cc index a124543fb..fa7960c38 100644 --- a/src/nix-store/main.cc +++ b/src/nix-store/main.cc @@ -280,6 +280,7 @@ static void opSubstitute(Strings opFlags, Strings opArgs) PathSet references; getline(cin, srcPath); if (cin.eof()) break; + getline(cin, sub.deriver); getline(cin, sub.program); string s; int n; |