about summary refs log tree commit diff
path: root/src/libstore/store.cc
AgeCommit message (Collapse)AuthorFilesLines
2005-12-12 * Fix NIX-23: quadratic complexity in maintaining the referersEelco Dolstra1-28/+81
mapping. The referer table is replaced by a referrer table (note spelling fix) that stores each referrer separately. That is, instead of having referer[P] = {Q_1, Q_2, Q_3, ...} we store referer[(P, Q_1)] = "" referer[(P, Q_2)] = "" referer[(P, Q_3)] = "" ... To find the referrers of P, we enumerate over the keys with a value lexicographically greater than P. This requires the referrer table to be stored as a B-Tree rather than a hash table. (The tuples (P, Q) are stored as P + null-byte + Q.) Old Nix databases are upgraded automatically to the new schema.
2005-10-29 * Repair the referers table from the references table.Rob Vermaas1-0/+3
2005-05-07 * Don't try to register GC roots in read-only mode.Eelco Dolstra1-2/+2
2005-05-04 * Idem (constness fix).Eelco Dolstra1-2/+2
* `compare' in GCC 2.95 is broken.
2005-04-12 * Garbage collector fix: allow deletion of paths that have invalidEelco Dolstra1-4/+4
(but substitutable) referers.
2005-04-07 * `nix-store --add-fixed' to preload the outputs of fixed-outputEelco Dolstra1-2/+59
derivations. This is mostly to simplify the implementation of nix-prefetch-{url, svn}, which now work properly in setuid installations. * Enforce valid store names in `nix-store --add / --add-fixed'.
2005-03-25 * `nix-store --verify': repair bad referer mappings.Eelco Dolstra1-6/+16
2005-03-23 * `nix-store --register-validity': allow a path to refer to a pathEelco Dolstra1-13/+37
listed later in the list of new valid paths.
2005-03-23 * nix-store: `--isvalid' -> `--check-validity', `--validpath' ->Eelco Dolstra1-1/+1
`--register-validity'. * `nix-store --register-validity': read arguments from stdin, and allow the references and deriver to be set.
2005-03-14 * Bug in clearSubstitutes().Eelco Dolstra1-1/+2
2005-03-03 * Don't use fork() in copyPath(), but a string buffer.Eelco Dolstra1-47/+14
2005-03-03 * Increase Berkeley DB limits a bit more.Eelco Dolstra1-4/+23
* Maintain the cleanup invariant in clearSubstitutes().
2005-03-02 * `nix-store -q --hash' to quickly query the hash of the contents of aEelco Dolstra1-0/+8
store path (which is stored in the database).
2005-02-14 * Type error in constructor call (caught by GCC 3.3, but not 3.4!).Eelco Dolstra1-1/+1
2005-02-09 * Commit more often to prevent out-of-memory errors.Eelco Dolstra1-0/+9
2005-02-09 * Propagate the deriver of a path through the substitute mechanism.Eelco Dolstra1-5/+12
* 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.
2005-02-09 * Automatically upgrade <= 0.7 Nix stores to the new schema (so thatEelco Dolstra1-20/+133
existing user environments continue to work). * `nix-store --verify': detect incomplete closures.
2005-02-08 * Subflag in `--verify': `nix-store --verify --check-contents' checksEelco Dolstra1-9/+35
that the contents of store paths has not changed by comparing hashes of their current contents to the hashes stored in the database.
2005-02-08 * Updated `nix-store --verify' to the new schema.Eelco Dolstra1-17/+95
2005-02-07 * `nix-store -qb' to query derivation environment bindings. UsefulEelco Dolstra1-2/+20
for finding build-time dependencies (possibly after a build). E.g., $ nix-store -qb aterm $(nix-store -qd $(which strc)) /nix/store/jw7c7s65n1gwhxpn35j9rgcci6ilzxym-aterm-2.3.1 * Arguments to nix-store can be files within store objects, e.g., /nix/store/jw7c...-aterm-2.3.1/bin/baffle. * Idem for garbage collector roots.
2005-02-07 * Maintain a database table (`derivers') that maps output paths to theEelco Dolstra1-7/+44
derivation that produced them. * `nix-store -qd PATH' prints out the derivation that produced a path.
2005-02-01 * nix-store, nix-instantiate: added an option `--add-root' toEelco Dolstra1-3/+3
immediately add the result as a permanent GC root. This is the only way to prevent a race with the garbage collector. For instance, the old style ln -s $(nix-store -r $(nix-instantiate foo.nix)) \ /nix/var/nix/gcroots/result has two time windows in which the garbage collector can interfere (by GC'ing the derivation and the output, respectively). On the other hand, nix-store --add-root /nix/var/nix/gcroots/result -r \ $(nix-instantiate --add-root /nix/var/nix/gcroots/drv \ foo.nix) is safe. * nix-build: use `--add-root' to prevent GC races.
2005-02-01 * Add missing files to dist.Eelco Dolstra1-1/+4
* Fix GC and substitute bugs related to self-references. Add a regression test.
2005-01-31 * Topologically sort paths under the references relation to ensureEelco Dolstra1-3/+7
that they are deleted in an order that maintains the closure invariant. * Presence of a path in a temporary roots file does not imply that all paths in its closure are also present, so add the closure.
2005-01-31 * Start of concurrent garbage collection. Processes write temporaryEelco Dolstra1-0/+5
roots to a per-process temporary file in /nix/var/nix/temproots while holding a write lock on that file. The garbage collector acquires read locks on all those files, thus blocking further progress in other Nix processes, and reads the sets of temporary roots.
2005-01-28 * Only invalidate paths when they are in fact valid.Eelco Dolstra1-1/+2
2005-01-27 * Fix deadlock.Eelco Dolstra1-1/+1
2005-01-27 * Update referers mappings when updating/clearing the referencesEelco Dolstra1-7/+27
mapping. * Do things in the right order in invalidatePath().
2005-01-27 * Fix and simplify the garbage collector (it's still not concurrent,Eelco Dolstra1-2/+9
though). In particular it's now much easier to register a GC root. Just place a symlink to whatever store path it is that you want to keep in /nix/var/nix/gcroots.
2005-01-25 * Maintain the references/referers relation also for derivations.Eelco Dolstra1-14/+32
This simplifies garbage collection and `nix-store --query --requisites' since we no longer need to treat derivations specially. * Better maintaining of the invariants, e.g., setReferences() can only be called on a valid/substitutable path.
2005-01-25 * Simplification: registerSubstitutes -> registerSubstitute. We noEelco Dolstra1-16/+9
longer need the former since there we no longer have the substitutes-rev table (which triggered a O(n^2) cost in updating them).
2005-01-25 * Really fix the substitute mechanism, i.e., ensure the closureEelco Dolstra1-4/+4
invariant by registering references through the manifest. * Added a test for nix-pull.
2005-01-20 * Terminology fixes.Eelco Dolstra1-1/+1
2005-01-19 * Nix-store queries `--references' and `referers' to query the pointerEelco Dolstra1-0/+10
graph. That is, `nix-store --query --references PATH' shows the set of paths referenced by PATH, and `nix-store --query --referers PATH' shows the set of paths referencing PATH.
2005-01-19 * Renamed `normalise.cc' -> `build.cc', `storeexprs.cc' ->Eelco Dolstra1-6/+66
`derivations.cc', etc. * Store the SHA-256 content hash of store paths in the database after they have been built/added. This is so that we can check whether the store has been messed with (a la `rpm --verify'). * When registering path validity, verify that the closure property holds.
2005-01-19 * Change extension `.store' to `.drv'.Eelco Dolstra1-0/+2
* Re-enable `nix-store --query --requisites'.
2005-01-19 * Started removing closure store expressions, i.e., the explicitEelco Dolstra1-135/+28
representation of closures as ATerms in the Nix store. Instead, the file system pointer graph is now stored in the Nix database. This has many advantages: - It greatly simplifies the implementation (we can drop the notion of `successors', and so on). - It makes registering roots for the garbage collector much easier. Instead of specifying the closure expression as a root, you can simply specify the store path that must be retained as a root. This could not be done previously, since there was no way to find the closure store expression containing a given store path. - Better traceability: it is now possible to query what paths are referenced by a path, and what paths refer to a path.
2005-01-17 * Removed the `id' attribute hack.Eelco Dolstra1-5/+5
* Formalise the notion of fixed-output derivations, i.e., derivations for which a cryptographic hash of the output is known in advance. Changes to such derivations should not propagate upwards through the dependency graph. Previously this was done by specifying the hash component of the output path through the `id' attribute, but this is insecure since you can lie about it (i.e., you can specify any hash and then produce a completely different output). Now the responsibility for checking the output is moved from the builder to Nix itself. A fixed-output derivation can be created by specifying the `outputHash' and `outputHashAlgo' attributes, the latter taking values `md5', `sha1', and `sha256', and the former specifying the actual hash in hexadecimal or in base-32 (auto-detected by looking at the length of the attribute value). MD5 is included for compatibility but should be considered deprecated. * Removed the `drvPath' pseudo-attribute in derivation results. It's no longer necessary. * Cleaned up the support for multiple output paths in derivation store expressions. Each output now has a unique identifier (e.g., `out', `devel', `docs'). Previously there was no way to tell output paths apart at the store expression level. * `nix-hash' now has a flag `--base32' to specify that the hash should be printed in base-32 notation. * `fetchurl' accepts parameters `sha256' and `sha1' in addition to `md5'. * `nix-prefetch-url' now prints out a SHA-1 hash in base-32. (TODO: a flag to specify the hash.)
2005-01-14 * Shorten SHA-256 hashes used in store path name generation to 160Eelco Dolstra1-7/+5
bits, then encode them in a radix-32 representation (using digits and letters except e, o, u, and t). This produces store paths like /nix/store/4i0zb0z7f88mwghjirkz702a71dcfivn-aterm-2.3.1. The nice thing about this is that the hash part of the file name is still 32 characters, as before with MD5. (Of course, shortening SHA-256 to 160 bits makes it no better than SHA-160 in theory, but hopefully it's a bit more resistant to attacks; it's certainly a lot slower.)
2005-01-14 * Start move towards SHA-256 hashes instead of MD5.Eelco Dolstra1-6/+30
* Start cleaning up unique store path generation (they weren't always unique; in particular the suffix ("-aterm-2.2", "-builder.sh") was not part of the hash, therefore changes to the suffix would cause multiple store objects with the same hash).
2005-01-13 * Added SHA-1 support. `nix-hash' now has an option `--type sha1' toEelco Dolstra1-1/+1
select SHA-1 hashing.
2005-01-13 * Refactoring to support SHA-1.Eelco Dolstra1-1/+1
2004-12-20 * An operation `nix-store --clear-substitutes' to remove allEelco Dolstra1-8/+35
registered substitute mappings.
2004-12-20 * Simplify the substitute mechanism:Eelco Dolstra1-80/+19
- Drop the store expression. So now a substitute is just a command-line invocation (a program name + arguments). If you register a substitute you are responsible for registering the expression that built it (if any) as a root of the garbage collector. - Drop the substitutes-rev DB table.
2004-10-25 * Allow certain operations to succeed even if we don't have writeEelco Dolstra1-7/+17
permission to the Nix store or database. E.g., `nix-env -qa' will work, but `nix-env -qas' won't (the latter needs DB access). The option `--readonly-mode' forces this mode; otherwise, it's only activated when the database cannot be opened.
2004-09-09 * Remove write permission from store objects after they have beenEelco Dolstra1-0/+4
added to the store. Bug reported by Martin.
2004-09-09 * A very dirty hack to make setuid installations a bit nicer to use.Eelco Dolstra1-2/+9
Previously there was the problem that all files read by nix-env etc. should be reachable and readable by the Nix user. So for instance building a Nix expression in your home directory meant that the home directory should have at least g+x or o+x permission so that the Nix user could reach the Nix expression. Now we just switch back to the original user just prior to reading sources and the like. The places where this happens are somewhat arbitrary, however. Any scope that has a live SwitchToOriginalUser object in it is executed as the original user. * Back out r1385. setreuid() sets the saved uid to the new real/effective uid, which prevents us from switching back to the original uid. setresuid() doesn't have this problem (although the manpage has a bug: specifying -1 for the saved uid doesn't leave it unchanged; an explicit value must be specified).
2004-08-31 * Main the `substitutes-rev' table again, but now in a way thatEelco Dolstra1-18/+33
doesn't take \Theta(n^2) space/time complexity.
2004-08-25 * Put the garbage collector in nix-store: operation `--gc',Eelco Dolstra1-1/+1
suboperations `--print-live', `--print-dead', and `--delete'. The roots are not determined by nix-store; they are read from standard input. This is to make it easy to customise what the roots are. The collector now no longer fails when store expressions are missing (which legally happens when using substitutes). It never tries to fetch paths through substitutes. TODO: acquire a global lock on the store while garbage collecting. * Removed `nix-store --delete'.
2004-06-28 * Added a switch `--fallback'. From the manual:Eelco Dolstra1-4/+25
Whenever Nix attempts to realise a derivation for which a closure is already known, but this closure cannot be realised, fall back on normalising the derivation. The most common scenario in which this is useful is when we have registered substitutes in order to perform binary distribution from, say, a network repository. If the repository is down, the realisation of the derivation will fail. When this option is specified, Nix will build the derivation instead. Thus, binary installation falls back on a source installation. This option is not the default since it is generally not desirable for a transient failure in obtaining the substitutes to lead to a full build from source (with the related consumption of resources).