aboutsummaryrefslogtreecommitdiff
path: root/nix/libstore
diff options
context:
space:
mode:
Diffstat (limited to 'nix/libstore')
-rw-r--r--nix/libstore/build.cc73
1 files changed, 39 insertions, 34 deletions
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index b5551b87ae..b19471a68f 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -2790,10 +2790,6 @@ private:
/* The substituter. */
std::shared_ptr<Agent> substituter;
- /* Either the empty string, or the expected hash as returned by the
- substituter. */
- string expectedHashStr;
-
/* Either the empty string, or the status phrase returned by the
substituter. */
string status;
@@ -3032,36 +3028,47 @@ void SubstitutionGoal::finished()
/* Check the exit status and the build result. */
HashResult hash;
try {
-
- if (status != "success")
- throw SubstError(format("fetching path `%1%' (status: '%2%')")
- % storePath % status);
-
- if (!pathExists(destPath))
- throw SubstError(format("substitute did not produce path `%1%'") % destPath);
-
- if (expectedHashStr == "")
- throw SubstError(format("substituter did not communicate hash for `%1'") % storePath);
-
- hash = hashPath(htSHA256, destPath);
-
- /* Verify the expected hash we got from the substituer. */
- size_t n = expectedHashStr.find(':');
- if (n == string::npos)
- throw Error(format("bad hash from substituter: %1%") % expectedHashStr);
- HashType hashType = parseHashType(string(expectedHashStr, 0, n));
- if (hashType == htUnknown)
- throw Error(format("unknown hash algorithm in `%1%'") % expectedHashStr);
- Hash expectedHash = parseHash16or32(hashType, string(expectedHashStr, n + 1));
- Hash actualHash = hashType == htSHA256 ? hash.first : hashPath(hashType, destPath).first;
- if (expectedHash != actualHash) {
- if (settings.printBuildTrace)
+ auto statusList = tokenizeString<vector<string> >(status);
+
+ if (statusList.empty()) {
+ throw SubstError(format("fetching path `%1%' (empty status: '%2%')")
+ % storePath % status);
+ } else if (statusList[0] == "hash-mismatch") {
+ if (settings.printBuildTrace) {
+ auto hashType = statusList[1];
+ auto expectedHash = statusList[2];
+ auto actualHash = statusList[3];
printMsg(lvlError, format("@ hash-mismatch %1% %2% %3% %4%")
- % storePath % "sha256"
- % printHash16or32(expectedHash)
- % printHash16or32(actualHash));
+ % storePath
+ % hashType % expectedHash % actualHash);
+ }
throw SubstError(format("hash mismatch for substituted item `%1%'") % storePath);
+ } else if (statusList[0] == "success") {
+ if (!pathExists(destPath))
+ throw SubstError(format("substitute did not produce path `%1%'") % destPath);
+
+ std::string hashStr = statusList[1];
+ size_t n = hashStr.find(':');
+ if (n == string::npos)
+ throw Error(format("bad hash from substituter: %1%") % hashStr);
+
+ HashType hashType = parseHashType(string(hashStr, 0, n));
+ switch (hashType) {
+ case htUnknown:
+ throw Error(format("unknown hash algorithm in `%1%'") % hashStr);
+ case htSHA256:
+ hash.first = parseHash16or32(hashType, string(hashStr, n + 1));
+ hash.second = std::atoi(statusList[2].c_str());
+ break;
+ default:
+ /* The database only stores SHA256 hashes, so compute it. */
+ hash = hashPath(htSHA256, destPath);
+ break;
+ }
}
+ else
+ throw SubstError(format("fetching path `%1%' (status: '%2%')")
+ % storePath % status);
} catch (SubstError & e) {
@@ -3123,9 +3130,7 @@ void SubstitutionGoal::handleChildOutput(int fd, const string & data)
string trimmed = (end != string::npos) ? input.substr(0, end) : input;
/* Update the goal's state accordingly. */
- if (expectedHashStr == "") {
- expectedHashStr = trimmed;
- } else if (status == "") {
+ if (status == "") {
status = trimmed;
worker.wakeUp(shared_from_this());
} else {
turns #f, add DRV to BUILD. 2014-10-29tests: Move some of the narinfo test tools to (guix tests).Ludovic Courtès * guix/tests.scm (derivation-narinfo, call-with-derivation-narinfo): New procedures. (with-derivation-narinfo): New macro. * tests/derivations.scm ("derivation-prerequisites-to-build and substitutes"): Use them. 2014-10-29derivations: Add 'offloadable-derivation?' and 'substitutable-derivation?'.Ludovic Courtès * guix/derivations.scm (offloadable-derivation?, substitutable-derivation?): New procedures. * tests/derivations.scm ("offloadable-derivation?"): New test. 2014-10-28build: Adjust lint tests for latest rules.Eric Bavier * tests/guix-lint.sh (dummy)[description]: Add failing case. [doc]: Adjust. 2014-10-26guix: lint: Make exception for package name starting description.Eric Bavier * guix/scripts/lint.scm (check-description-style): Exception for upper-case rule if the description starts with the package name. * tests/lint.scm: Test it. 2014-10-26guix: lint: Allow digits at start of synopsis or description.Eric Bavier * guix/scripts/lint.scm (start-with-capital-letter?): Rename too... (properly-starts-sentence?): Rewrite with regex and add digits. (check-description-style, check-synopsis-style): Use it. * tests/lint.scm: Add tests. 2014-10-26guix: lint: Check for empty synopses and descriptions.Eric Bavier * guix/scripts/lint.scm (check-description-style, check-synopsis-style): New emptiness checks. * tests/lint.scm: Test them. 2014-10-26guix: lint: Check for proper end-of-sentence space.Eric Bavier * guix/scripts/lint.scm (start-with-capital-letter?): Handle empty strings. (check-description-style): New check for end-of-sentence space. * tests/lint.scm: Test it. 2014-10-17packages: Add 'package-transitive-supported-systems'.Ludovic Courtès * guix/packages.scm (package-transitive-supported-systems): New procedure. * tests/packages.scm ("package-transitive-supported-systems"): New test. * build-aux/hydra/gnu-system.scm (package->job): Use it. 2014-10-17derivations: Introduce 'graft' record type.Ludovic Courtès * guix/derivations.scm (<graft>): New record type. (graft-derivation): Rename 'replacements' to 'grafts', and expect it to be a list of <graft> records. Adjust accordingly. * tests/derivations.scm ("graft-derivation"): Use 'graft' instead of pairs in argument to 'graft-derivation'. 2014-10-16guix lint: add the --checkers option.Cyril Roelandt * guix/scripts/lint.scm: add the "--checkers" option. * doc/guix.texi (Invoking guix lint): Document it. * tests/guix-lint.sh: New file * Makefile.am (SCM_TESTS): Add it. 2014-10-12guix package: Add '--switch-generation' option.Alex Kost * guix/scripts/package.scm (switch-to-generation): New procedure. (switch-to-previous-generation): Use it. (guix-package): Adjust for '--switch-generation' option. * tests/guix-package.sh: Test it. * doc/guix.texi (Invoking guix package): Document it. 2014-10-12syscalls: Accept ENOENT in the 'swapoff' test.Ludovic Courtès Fixes <http://bugs.gnu.org/18690>. Reported by Philip Woods <elzairthesorcerer@gmail.com>. * tests/syscalls.scm ("swapoff, EINVAL/EPERM"): Rename to... ("swapoff, ENOENT/EINVAL/EPERM"): ... this. Add ENOENT to the list of possible return values. 2014-10-10build: Make sure tests/guix-package.sh doesn't leave anything behind it.Ludovic Courtès Fixes a regression introduced in commit 300868ba. * tests/guix-package.sh: Move 'module_dir' definition to the top, and "rm -rf" it from the top-most 'trap'. Remove second use of 'trap'. 2014-10-10ui: Move 'show-manifest-transaction' from (guix profiles).Alex Kost * guix/profiles.scm: Do not use (guix ui) module. (right-arrow, manifest-show-transaction): Move and rename to... * guix/ui.scm (right-arrow, show-manifest-transaction): ... here. * tests/profiles.scm ("manifest-show-transaction"): Move to... * tests/ui.scm ("show-manifest-transaction"): ... here. (guile-1.8.8, guile-2.0.9): New variables. * emacs/guix-main.scm (process-package-actions): Rename 'manifest-show-transaction' to 'show-manifest-transaction'. * guix/scripts/package.scm (guix-package): Likewise. Signed-off-by: Ludovic Courtès <ludo@gnu.org> 2014-10-09Break module cycle involving (guix store) and (guix ui).Ludovic Courtès Before, there was a cycle along the lines of: (guix store) -> (guix nar) -> (guix ui) -> (guix store) This caused problems, as discussed at: http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00109.html This patch removes cycles in the (guix ...) modules. * guix/nar.scm (&nar-error, &nar-read-error, dump, write-contents, read-contents, %archive-version-1, write-file, restore-file): Move to... * guix/serialization.scm: ... here. * guix/store.scm: Remove dependency on (guix nar). * guix/scripts/hash.scm, guix/scripts/offload.scm, guix/scripts/substitute-binary.scm, tests/nar.scm, tests/store.scm, tests/substitute-binary.scm: Adjust accordingly. 2014-10-09substitute-binary: Ignore $GUIX_BINARY_SUBSTITUTE_URL.Ludovic Courtès * guix/scripts/substitute-binary.scm (%cache-url): Ignore the 'GUIX_BINARY_SUBSTITUTE_URL' environment variable. * test-env.in: Invoke 'guix-daemon' with '--substitute-urls'. * tests/substitute-binary.scm: Set '%cache-url' to the value of 'GUIX_BINARY_SUBSTITUTE_URL'. 2014-10-08monads: Add 'mbegin'.Ludovic Courtès * guix/monads.scm (mbegin): New macro. * tests/monads.scm ("mbegin"): New test. * doc/guix.texi (The Store Monad): Document it. 2014-10-08packages: Gracefully print packages whose 'location' is #f.Ludovic Courtès * guix/packages.scm (<package> printer): Check whether LOC is #f. * tests/packages.scm ("printer with location", "printer without location"): New tests. 2014-10-08derivations: Add 'graft-derivation'.Ludovic Courtès * guix/derivations.scm (graft-derivation): New procedure. * guix/build/graft.scm: New file. * Makefile.am (MODULES): Add it. * tests/derivations.scm ("graft-derivation"): New test. 2014-10-08guix lint: make sure synopses do not start with the package name.Cyril Roelandt * guix/scripts/lint.scm (check-start-with-package-name): New method. * tests/lint.scm ("synopsis: start with package name"): New test. 2014-10-08guix lint: Make sure a synopsis cannot start with a lower-case article.Cyril Roelandt * guix/scripts/lint.scm (check-start-article): use "string-ci=?" instead of "string=?". * tests/lint.scm ("synopsis: starts with 'a'", "synopsis: starts with 'an'"): New tests. 2014-10-08guix lint: check whether descriptions and synopses start with an upper-case ↵Cyril Roelandt letter. * guix/scripts/lint.scm (check-description-style, check-synopsis-start-upper-case): New methods. * tests/lint.scm ("description: does not start with an upper-case letter", "synopsis: does not start with an upper-case letter"): New tests. 2014-10-08guix lint: Make sure synopses are not too long.Cyril Roelandt * guix/scripts/lint.scm (check-synopsis-length): New procedure. * tests/lint.scm ("synopsis: too long"): New test. 2014-10-05build-system: Bags record their system and target.Ludovic Courtès * guix/build-system.scm (<bag>)[system, target]: New fields. (make-bag): Add #:system parameter and pass it to LOWER. * gnu/packages/bootstrap.scm (make-raw-bag): Initialize 'system' field. * guix/build-system/cmake.scm (lower): Likewise. * guix/build-system/perl.scm (lower): Likewise. * guix/build-system/python.scm (lower): Likewise. * guix/build-system/ruby.scm (lower): Likewise. * guix/build-system/trivial.scm (lower): Likewise. * guix/build-system/gnu.scm (lower): Initialize 'system' and 'target' fields. * guix/packages.scm (bag->derivation, bag->cross-derivation): New procedures. (package-derivation, package-cross-derivation): Use 'bag->derivation'. * tests/packages.scm ("search paths"): Initialize 'system' and 'target' fields. ("package->bag", "package->bag, cross-compilation", "bag->derivation", "bag->derivation, cross-compilation"): New tests. 2014-10-05gnu: cross-base: Use the right dynamic linker name.Ludovic Courtès * gnu/packages/cross-base.scm (cross-gcc-arguments): Parametrize %CURRENT-TARGET-SYSTEM. * tests/monads.scm ("package-file + package->cross-derivation"): Replace "foo64-gnu" with "mips64el-linux-gnu". 2014-10-05build-system: Introduce "bags" as an intermediate representation.Ludovic Courtès * guix/build-system.scm (<build-system>)[build, cross-build]: Remove. [lower]: New field. (<bag>): New record type. (make-bag): New procedure. * guix/packages.scm (bag-transitive-inputs, bag-transitive-build-inputs, bag-transitive-host-inputs, bag-transitive-target-inputs, package->bag): New procedures. (package-derivation): Use it; use the bag, apply its build procedure, etc. (package-cross-derivation): Likewise. * gnu/packages/bootstrap.scm (raw-build, make-raw-bag): New procedure. (%bootstrap-guile): Use them. * guix/build-system/trivial.scm (lower): New procedure. (trivial-build, trivial-cross-build): Remove 'source' parameter. Pass INPUTS as is. (trivial-build-system): Adjust accordingly. * guix/build-system/gnu.scm (%store, inputs-search-paths, standard-search-paths, expand-inputs, standard-inputs): Remove. (gnu-lower): New procedure. (gnu-build): Remove 'source' and #:implicit-inputs? parameters. Remove 'implicit-inputs' and 'implicit-search-paths' variables. Get the source from INPUT-DRVS. (gnu-cross-build): Likewise. (standard-cross-packages): Remove call to 'standard-packages'. (standard-cross-inputs, standard-cross-search-paths): Remove. (gnu-build-system): Remove 'build' and 'cross-build'; add 'lower'. * guix/build-system/cmake.scm (lower): New procedure. (cmake-build): Remove 'source' and #:cmake parameters. Use INPUTS and SEARCH-PATHS as is. Get the source from INPUTS. * guix/build-system/perl.scm: Likewise. * guix/build-system/python.scm: Likewise. * guix/build-system/ruby.scm: Likewise. * gnu/packages/cross-base.scm (cross-gcc): Change "cross-linux-headers" to "linux-headers". (cross-libc)[xlinux-headers]: Pass #:implicit-cross-inputs? #f. Likewise. In 'propagated-inputs', change "cross-linux-headers" to "linux-headers". * guix/git-download.scm (git-fetch): Use 'standard-packages' instead of 'standard-inputs'. * tests/builders.scm ("gnu-build-system"): Remove use of 'build-system-builder'. ("gnu-build"): Remove 'source' and #:implicit-inputs? arguments to 'gnu-build'. * tests/packages.scm ("search paths"): Adjust to new build system API. ("package-cross-derivation, no cross builder"): Likewise. * doc/guix.texi (Build Systems): Add paragraph on bags. 2014-10-05utils: Add 'strip-keyword-arguments'.Ludovic Courtès * guix/utils.scm (strip-keyword-arguments): New procedure. * tests/utils.scm ("strip-keyword-arguments"): New test. 2014-10-03ui: Recognize the same size units as Coreutils.Ludovic Courtès * guix/ui.scm (size->number): Add a bunch of large units. Recognize one-letter unit names. Change "KB" to "kB". * tests/ui.scm ("size->number, 1T"): New test. * doc/guix.texi (Invoking guix gc): Add cross-reference to "Block size" in the Coreutils manual. (Invoking guix system): Likewise. 2014-10-03download: Allow raw file names or file:// URLs.Ludovic Courtès * guix/download.scm (url-fetch): When URL is a string, if it's not a URI or if it's a URI with 'file' or #f scheme, use 'add-to-store'. * tests/builders.scm ("url-fetch, file", "url-fetch, file URI"): New tests. 2014-09-29import: Add PyPI importer.David Thompson * guix/snix.scm: Delete. * guix/import/snix.scm: New file. * guix/import/pypi.scm: New file. * guix/import/utils.scm: New file. * guix/scripts/import/nix.scm: New file. * guix/scripts/import/pypi.scm: New file. * tests/pypi.scm: New file. * tests/snix.scm: Import (guix import snix) module. * guix/scripts/import.scm (%default-options, %options): Delete. (%standard-import-options, importers): New variables. (show-help): List importers. (guix-import): Factor out Nix-specific logic. Delegate to correct importer based upon first argument. * configure.ac (HAVE_GUILE_JSON): New conditional. * Makefile.am (MODULES): Add new files and remove 'guix/snix.scm'. (SCM_TESTS): Add 'tests/pypi.scm' if guile-json is installed. 2014-09-24Introduce the 'GUIX_PACKAGE_PATH' environment variable.Ludovic Courtès * gnu/packages.scm (%package-module-path): Honor $GUIX_PACKAGE_PATH. * test-env.in: Unset 'GUIX_PACKAGE_PATH'. * tests/guix-package.sh: Test it. * doc/guix.texi (Package Modules): Document it. 2014-09-24guix build: Add -L/--load-path as a common option.Ludovic Courtès * guix/scripts/build.scm (show-build-options-help): Document -L. (%standard-build-options): Add -L/--load-path. * tests/guix-package.sh: Test it. 2014-09-22Merge branch 'core-updates'Ludovic Courtès 2014-09-18syscalls: Add 'swapon' and 'swapoff'.Ludovic Courtès * guix/build/syscalls.scm (swapon, swapoff): New procedures. * tests/syscalls.scm ("swapon, ENOENT/EPERM", "swapoff, EINVAL/EPERM"): New tests. 2014-09-14syscalls: Add 'all-network-interfaces'.Ludovic Courtès * guix/build/syscalls.scm (network-interfaces): Update docstring. (%interface-line): New variable. (all-network-interfaces): New procedure. * tests/syscalls.scm ("all-network-interfaces"): New test. ("network-interfaces"): Change to make sure the result is a subset of (all-network-interfaces). 2014-09-14syscalls: Add 'network-interface-flags'.Ludovic Courtès * guix/build/syscalls.scm (SIOCGIFFLAGS, IFF_UP, IFF_BROADCAST, IFF_LOOPBACK, IF_NAMESIZE): New variables. (network-interface-flags, loopback-network-interface?): New procedures. * tests/syscalls.scm ("network-interface-flags", "loopback-network-interface?"): New tests. 2014-09-14syscalls: Add 'network-interfaces'.Ludovic Courtès * guix/build/syscalls.scm (SIOCGIFCONF, ifconf-struct, ifreq-struct-size): New variables. (%ioctl, bytevector->string-list, network-interfaces): New procedures. * tests/syscalls.scm ("network-interfaces"): New test. 2014-09-13utils: Allow wrap-program to be called multiple times.Eric Bavier * guix/build/utils.scm (wrap-program): Multiple invocations of wrap-program for the same file create successive wrappers. Adjust docstring. * tests/build-utils.scm: Test new wrap-program behavior. (%store): New variable.