Commit graph

165 commits

Author SHA1 Message Date
Eelco Dolstra 624c48260f * Change the abstract syntax of slices. It used to be that ids were used as
keys to reference slice elements, e.g.,

    Slice(["1ef7..."], [("/nix/store/1ef7...-foo", "1ef7", ["8c99..."]), ...])

  This was wrong, since ids represent contents, not locations.  Therefore we
  now have:

    Slice(["/nix/store/1ef7..."], [("/nix/store/1ef7...-foo", "1ef7", ["/nix/store/8c99-..."]), ...])

* Fix a bug in the computation of slice closures that could cause slice
  elements to be duplicated.
2003-08-20 12:39:56 +00:00
Eelco Dolstra ed0db2e0d8 * Fixed a serious bug in the computation of slices. Sometimes the slices
would not be properly closed under the path reference relation.
2003-08-20 11:30:45 +00:00
Eelco Dolstra 1472cc4825 * Pipe /dev/null into stdin. 2003-08-19 13:07:38 +00:00
Eelco Dolstra 2de8504791 * Delete the temporary directories of failed builds by default, and an
option `--keep-failed' to override this behaviour.
2003-08-19 09:04:47 +00:00
Eelco Dolstra 31e4aa6439 * Allow lists in package bindings, e.g.,
("srcs", [Relative("foo/bar.c"), Relative("foo/baz.h")])

  The result is an environment variable that contains the path names of the
  inputs separated by spaces (so this is not safe for values containing
  spaces).
2003-08-18 16:32:55 +00:00
Eelco Dolstra ebbb6ce578 * Most shells initialise PATH to some default (/bin:/usr/bin:...)
when PATH is not set.  We don't want this, so fill it in with
  some dummy value.
2003-08-18 14:54:54 +00:00
Eelco Dolstra 96c7b98bf0 * Argument support in Fix. Arguments can be passed through the
builder using the `args' binding:

  ("args", ["bla", True, IncludeFix("aterm/aterm.fix")])

  Note that packages can also be declared as inputs by specifying them
  in the argument list.
2003-08-15 13:01:45 +00:00
Eelco Dolstra 555347744d * Derivation expressions now can specify arguments to be passed to the
builder.  Note that this unfortunately causes all Fix-computed
  hashes to change.
2003-08-15 12:32:37 +00:00
Eelco Dolstra 163db7367f * Fix can now read expressions from stdin (by saying `fix -'). 2003-08-15 09:21:19 +00:00
Eelco Dolstra dc0ef2ca98 * Detect infinite loops using blackholing. 2003-08-14 12:37:31 +00:00
Eelco Dolstra 5cde23f869 * Function() takes a list of formals. 2003-08-14 09:49:31 +00:00
Eelco Dolstra 0a2de7f543 * Lam -> Function. Doh! 2003-08-14 09:29:07 +00:00
Eelco Dolstra c602930e08 * deletePath(): some operating systems (e.g., Mac OS X) don't like it
when we delete entries from a directory while we are reading it.
  So read the directory into memory, then delete its contents.
2003-08-08 14:55:56 +00:00
Eelco Dolstra 236eb59293 * Allow locks on paths to be acquired recursively (that is, if the
process is already holding a lock on a path, it may acquire the lock
  again without blocking or failing).  (This might be dangerous, not
  sure).  Necessary for fast builds to work.
2003-08-06 09:34:04 +00:00
Eelco Dolstra 720f06e3b0 * A flag `--flat' to just compute the MD5 checksum of the contents of
a regular file.  I.e., `nix-hash --flat' is equivalent to the
  coreutils `md5sum' command (which doesn't exist on all systems).
2003-08-06 09:06:32 +00:00
Eelco Dolstra 37483672d4 * App -> Call.
* Allow booleans in package environment bindings (True maps to "1",
  False maps to "").
2003-08-06 09:05:04 +00:00
Eelco Dolstra d34b4d4f28 * Conditionals. 2003-08-05 13:05:30 +00:00
Eelco Dolstra 4ce652640b * Cache result of fstatePaths(). TODO: do this in fstore.cc. 2003-08-05 12:29:47 +00:00
Eelco Dolstra 17f05dba77 * Allow the top-level expression to be a list of expressions that
normalise to Nix expression.
2003-08-05 11:13:38 +00:00
Eelco Dolstra d6b6b2d3a8 * Delete obstructed paths prior to building. 2003-08-05 09:47:20 +00:00
Eelco Dolstra d2e963f7a3 * Path locking in addToStore() and expandPath(). 2003-08-04 07:09:36 +00:00
Eelco Dolstra c95b4ad290 * In normaliseFState(), wrap registration of the output paths and the
normal form in a single transaction to ensure that if we crash,
  either everything is registered or nothing is.  This is for
  recoverability: unregistered paths in the store can be deleted
  arbitrarily, while registered paths can only be deleted by running
  the garbage collector.
2003-08-01 15:41:47 +00:00
Eelco Dolstra d99d04e644 * Defensive programming against POSIX locking idiocy.
* Simplified realiseSlice().
2003-08-01 15:06:23 +00:00
Eelco Dolstra 545145cd58 * normaliseFState() now locks all output paths prior to building, thus
ensuring that simultaneous invocations of Nix don't clobber
  each other's  builds.

* Fixed a bug in `make install'.
2003-08-01 14:11:19 +00:00
Eelco Dolstra 9df93f30bd * Don't use substitutes in addToStore(). 2003-08-01 09:01:51 +00:00
Eelco Dolstra 06434072e7 * Put the database verifier in a transaction. 2003-07-31 19:49:11 +00:00
Eelco Dolstra 06d3d7355d * Enclose most operations that update the database in transactions.
* Open all database tables (Db objects) at initialisation time, not
  every time they are used.  This is necessary because tables have to
  outlive all transactions that refer to them.
2003-07-31 16:05:35 +00:00
Eelco Dolstra 177a7782ae * Use a more reasonable log file size (256 KB instead of 10 MB).
* Checkpoint on exit.
2003-07-31 14:28:49 +00:00
Eelco Dolstra 4a013962bd * Started using Berkeley DB environments. This is necessary for
transaction support (but we don't actually use transactions yet).
2003-07-31 13:47:13 +00:00
Eelco Dolstra 758bd4673a * Set execute bit. 2003-07-31 13:13:27 +00:00
Eelco Dolstra 83075304e5 * Don't make the builder executable. 2003-07-30 09:49:47 +00:00
Eelco Dolstra 8846465934 * Get garbage collection and cache population to work *properly*.
Renamed `fstateRefs' to `fstateRequisites'.  The semantics of this
  function is that it returns a list of all paths necessary to realise
  a given expression.  For a derive expression, this is the union of
  requisites of the inputs; for a slice expression, it is the path of
  each element in the slice.  Also included are the paths of the
  expressions themselves.  Optionally, one can also include the
  requisites of successor expressions (to recycle intermediate
  results).

* `nix-switch' now distinguishes between an expression and its normal
  form.  Usually, only the normal form is registered as a root of the
  garbage collector.  With the `--source-root' flag, it will also
  register the original expression as a root.

* `nix-collect-garbage' now has a flag `--keep-successors' which
  causes successors not to be included in the list of garbage paths.

* `nix-collect-garbage' now has a flag `--invert' which will print all
  paths that should *not* be garbage collected.
2003-07-29 14:28:17 +00:00
Eelco Dolstra dc14a3de46 * Nicer dot graphs. 2003-07-29 10:53:27 +00:00
Eelco Dolstra 79ba0431db * `fstateRefs' now works on derive expressions as well. TODO: make
this more efficient.
* A flag `-n' in 'nix --query' to normalise the argument.  Default is
  not to normalise.
2003-07-29 10:43:12 +00:00
Eelco Dolstra 5acb45446e * Let `nix --install' print out the id of the normal form.
* Some minor refactoring.
2003-07-29 09:45:03 +00:00
Eelco Dolstra 949c4fa1a8 * `nix --help'.
* `nix --query --graph' to print a dot dependency graph of derive
  expressions.
2003-07-28 12:19:23 +00:00
Eelco Dolstra f21b341957 * Fix message. 2003-07-24 15:03:36 +00:00
Eelco Dolstra 0a0c1fcb4d * The `-v' flag no longer takes an argument; it should be repeated
instead (e.g., `-vvvv' for lots of output).  Default is to only
  print error messages.
2003-07-24 13:43:16 +00:00
Eelco Dolstra 3b521bb1bd * Do sync the database, since not doing so caused database changes not
to reach the disk at all.  Looks like a bug.
2003-07-24 13:35:17 +00:00
Eelco Dolstra 1a7468a57a * Debug levels. Use `--verbose / -v LEVEL' to display only messages
up to the given verbosity levels.  These currently are:

    lvlError = 0, 
    lvlNormal = 5,
    lvlDebug = 10,
    lvlDebugMore = 15

  although only lvlError and lvlDebug are actually used right now.
2003-07-24 08:53:43 +00:00
Eelco Dolstra b75719b984 * Don't sync the database on close. This was killing performance.
(Of course, the real problem is that we open the database for
  *every* operation; we should only open it once.  And we should use
  transactions.)
2003-07-24 08:24:32 +00:00
Eelco Dolstra 39ce70025b * Incorporated Berkeley DB and ATerm into the source tree.
* `make dist'.
2003-07-23 15:53:34 +00:00
Eelco Dolstra 9202570f8c * libdb_cxx-4 -> libdb_cxx 2003-07-22 20:02:33 +00:00
Eelco Dolstra e877c69d78 * Substitutes now should produce a path with the same id as they are
substituting for (obvious, really).

* For greater efficiency, nix-pull/unnar will place the output in a
  path that is probably the same as what is actually needed, thus
  preventing a path copy.

* Even if a output id is given in a Fix package expression, ensure
  that the resulting Nix derive expression has a different id.  This
  is because Nix expressions that are semantically equivalent (i.e.,
  build the same result) might be different w.r.t. efficiency or
  divergence.  It is absolutely vital for the substitute mechanism
  that such expressions are not used interchangeably.
2003-07-22 15:15:15 +00:00
Eelco Dolstra df648c4967 * nix --query --expansion' (-qe') to get any path with content
corresponding to the given id.
2003-07-22 10:24:22 +00:00
Eelco Dolstra d5ee6f8700 * In `--query --generators', print out paths, not ids.
(There should really be a switch for this).
2003-07-21 21:31:03 +00:00
Eelco Dolstra 2616e6a6f3 * Check for errors. 2003-07-21 20:58:34 +00:00
Eelco Dolstra 9f4ad99e92 * Canonicalise path. 2003-07-21 20:58:21 +00:00
Eelco Dolstra 249988a787 * Allow the output/expression id to be forced to a certain
value; this potentially dangerous feature enables better 
  sharing for those paths for which the content is known in 
  advance (e.g., because a content hash is given).
* Fast builds: if we can expand all output paths of a derive 
  expression, we don't have to build.
2003-07-21 20:07:12 +00:00
Eelco Dolstra 49231fbe41 * Changes to the command line syntax of Nix.
* A function to find all Nix expressions whose output ids are
  completely contained in some set.  Useful for uploading relevant Nix
  expressions to a shared cache.
2003-07-21 14:46:01 +00:00