summaryrefslogtreecommitdiff
path: root/guix/utils.scm
AgeCommit message (Expand)Author
2013-08-23utils: Add `guile-version>?', and use it....This fixes Guile version comparisons when (version) has a vendor-specific suffix. Reported by Andreas Enge <andreas@enge.fr>. * guix/utils.scm (guile-version>?): New procedure. * tests/utils.scm ("guile-version>? 1.8", "guile-version>? 10.5"): New tests. * guix/scripts/substitute-binary.scm (fetch, progress-report-port): Use `guile-version>?' instead of `version>?'. * guix/http-client.scm (when-guile<=2.0.5, http-fetch): Likewise. Ludovic Courtès
2013-07-01Move `sha256' to (guix hash)....* guix/utils.scm (sha256): Move to... * guix/hash.scm: ... here. New file. * Makefile.am (MODULES): Add it. * guix/derivations.scm, guix/scripts/download.scm, guix/scripts/hash.scm, guix/scripts/refresh.scm, tests/base32.scm, tests/derivations.scm, tests/store.scm: Use (guix hash). Ludovic Courtès
2013-05-24packages: Implement `package-cross-derivation'....* guix/packages.scm (package-transitive-target-inputs, package-transitive-native-inputs): New procedures. (package-derivation): Parametrize `%current-target-system'. (package-cross-derivation): Implement. * guix/utils.scm (%current-target-system): New variable. * tests/packages.scm ("package-cross-derivation"): New test. * doc/guix.texi (Defining Packages): Document `package-cross-derivation'. Ludovic Courtès
2013-05-15substitute-binary: Pass `filtered-port' an unbuffered port....This fixes a bug whereby `read-response' would read more than just the response, with the extra data going into the port's buffer; the "bzip2 -dc" process spawned by `filtered-port' would not see the those buffered data, which are definitely lost, and would bail out with "bzip2: (stdin) is not a bzip2 file." * guix/utils.scm (filtered-port): Document that INPUT must be unbuffered. * guix/web.scm (http-fetch): Add `buffered?' parameter. Call `open-socket-for-uri' explicitly, and call `setvbuf' when BUFFERED? is false. Pass the port to `http-get'. Close it upon 301/302. * guix/scripts/substitute-binary.scm (fetch): Add `buffered?' parameter. Pass it to `http-fetch'; honor it for `file' URIs. (guix-substitute-binary): Call `fetch' with #:buffered? #f for port RAW. * tests/utils.scm ("filtered-port, file"): Open FILE as unbuffered. Ludovic Courtès
2013-05-12Move record utilities to (guix records)....* guix/utils.scm (define-record-type*): Move to... * guix/records.scm: ... here. New file. * guix/build-system.scm, guix/packages.scm: Use it. * guix/gnu-maintenance.scm: Likewise. (official-gnu-packages)[alist->record]: Remove. * guix/scripts/substitute-binary.scm: Likewise. (alist->record, object->fields): Remove. * tests/utils.scm ("define-record-type*", "define-record-type* with letrec* behavior", "define-record-type* & inherit", "define-record-type* & inherit & letrec* behavior", "define-record-type* & thunked", "define-record-type* & thunked & default", "define-record-type* & thunked & inherited"): Move to... * tests/records.scm: ... here. New file. Ludovic Courtès
2013-04-30Merge branch 'core-updates'Ludovic Courtès
2013-04-29substitute-binary: Support decompression from non-file ports....* guix/scripts/substitute-binary.scm (filtered-port): Move to utils.scm. (decompressed-port): Upon "none", return '() as the second value. (guix-substitute-binary): Expect `decompressed-port' to return a list of PIDs as its second value. * guix/utils.scm (filtered-port): New procedure. Add case for when INPUT is not `file-port?'. * tests/utils.scm ("filtered-port, file", "filtered-port, non-file"): New tests. Ludovic Courtès
2013-04-28utils: Add `string-tokenize*'....* guix/utils.scm (string-tokenize*): New procedure. * tests/utils.scm ("string-tokenize*"): New test. Ludovic Courtès
2013-04-25Add `guix refresh' and related auto-update tools....* guix/gnu-maintenance.scm (ftp-server/directory)[quirks]: Add glib. (package-update-path, download-tarball, package-update, update-package-source): New procedures. * guix/gnupg.scm, guix/scripts/refresh.scm: New files. * Makefile.am (MODULES): Add them. * guix/utils.scm (file-extension): New procedure. Ludovic Courtès
2013-04-25utils: Fix column number returned by `source-properties->location'....* guix/utils.scm (source-properties->location): Use COL, not COL + 1. Ludovic Courtès
2013-04-21Factorize `download-and-store'....* guix/download.scm (download-to-store): New procedure. * guix/scripts/download.scm (fetch-and-store): Remove. (guix-download): Use `download-to-store' instead. * guix/ui.scm (call-with-temporary-output-file): Move to... * guix/utils.scm (call-with-temporary-output-file): ... here. Ludovic Courtès
2013-04-14utils: Add `fold2'....* gnu/packages.scm (fold2): Remove. * guix/utils.scm (fold2): New procedure. Generalization of the above to one and two lists. * tests/utils.scm ("fold2, 1 list", "fold2, 2 lists"): New tests. Ludovic Courtès
2013-02-12Add version-compare and version>? to utils.scm....* guix/utils.scm (version-compare, version>?): New exported procedures, based on version-string>?, which was formerly in gnu-maintenance.scm. * guix/gnu-maintenance.scm (version-string>?): Removed procedure. (latest-release): Use 'version>?' instead of 'version-string>?'. Mark H Weaver
2013-01-23define-record-type*: Add the `thunked' field definition keyword....* guix/utils.scm (define-record-type*)[make-syntactic-constructor]: Add a `thunked' parameter. (thunked-field?, field-bindings): New procedures. Use the latter when generating `letrec*' bindings. [thunked-field?, thunked-field-accessor-name, field-spec->srfi-9, thunked-field-accessor-name]: New procedures. Use them when generating the `define-record-type' form, and to generated thunk field accessors, along call to `make-syntactic-constructor' with the new argument. * tests/utils.scm ("define-record-type* & thunked", "define-record-type* & thunked & default", "define-record-type* & thunked & inherited"): New tests. Ludovic Courtès
2013-01-06Update license headers....Change all license headers, except guix/build/* and ld-wrapper.scm, with this code: (use-modules (guix build utils) (srfi srfi-1)) (fluid-set! %default-port-encoding "UTF-8") (substitute* (remove (lambda (f) (or (string-contains f ".tar.") (string-contains f ".git/") (string-contains f ".so") (string-suffix? ".o" f) (string-suffix? ".a" f) (string-suffix? ".go" f) (string-suffix? ".pdf" f) (string-suffix? ".png" f) (string-suffix? ".info" f) (equal? (basename f) "guix-daemon") (equal? (basename f) "nix-setuid-helper") (string-contains f "nix-upstream/") (string-contains f "distro/packages/bootstrap/"))) (find-files "." "\\.[a-z]+$")) (("^([[:graph:]]+) This file is part of Guix." _ comment-start) (string-append comment-start " This file is part of GNU Guix.")) (("^([[:graph:]]+) Guix --- Nix package management.*" _ comment-start) (string-append comment-start " GNU Guix --- Functional package management for GNU\n")) (("^([[:graph:]]+) Guix is " _ comment-start) (string-append comment-start " GNU Guix is ")) (("^([[:graph:]]+) along with Guix." _ comment-start) (string-append comment-start " along with GNU Guix.")) (("^([[:graph:]]+) Copyright \\(C\\)" _ comment-start) (string-append comment-start " Copyright ©"))) Change headers using C-style comments manually. Ludovic Courtès
2012-12-13Merge branch 'nix-integration'...Conflicts: tests/guix-package.sh Ludovic Courtès
2012-12-10Have `%nixpkgs-directory' default to #f when $NIXPKGS is the empty string....* guix/utils.scm (%nixpkgs-directory): Set to #f when the `NIXPKGS' environment variable is set but empty. Reported by Andreas Enge <andreas@enge.fr>. Ludovic Courtès
2012-12-06build: Capture configure-time settings in (guix config)....* configure.ac: Compute and substitute `guix_localstatedir'. * m4/guix.m4: Substitute `guix_system'. * guix/config.scm.in (%store-directory, %store-directory, %system): New variables. * guix/store.scm (%nix-state-dir): Remove. (%default-socket-path): Use %STATE-DIRECTORY as the default. (%store-prefix): Use %STORE-DIRECTORY as the default. * guix/utils.scm (%current-system): Default to %SYSTEM. Ludovic Courtès
2012-11-19guix-package: Add `--list-available'....* guix-package.in (show-help, %options): Add `--list-available'. (guix-package)[process-query]: Add support for `--list-available'. * doc/guix.texi (Invoking guix-package): Document it. * tests/guix-package.sh: Add test. * guix/ui.scm (location->string): New procedure. * guix/utils.scm: Export <location>. Ludovic Courtès
2012-11-11Move base32 code to (guix base32)....* guix/utils.scm (bytevector-quintet-ref, bytevector-quintet-ref-right, bytevector-quintet-length, bytevector-quintet-fold, bytevector-quintet-fold-right, make-bytevector->base32-string, %nix-base32-chars, %rfc4648-base32-chars, bytevector->base32-string, bytevector->nix-base32-string, bytevector-quintet-set!, bytevector-quintet-set-right!, base32-string-unfold, base32-string-unfold-right, make-base32-string->bytevector, base32-string->bytevector, nix-base32-string->bytevector): Move to... * guix/base32.scm: ... here. New file. * tests/utils.scm (%nix-hash, "bytevector->base32-string", "base32-string->bytevector", "nix-base32-string->bytevector", "sha256 & bytevector->base32-string"): Move to... * tests/base32.scm: ... here. New file * guix-download.in, guix/derivations.scm, guix/packages.scm, guix/snix.scm, tests/builders.scm, tests/derivations.scm: Adjust accordingly. * guix.scm (%public-modules): Add `base32'. Ludovic Courtès
2012-11-05utils: Add `default-keyword-arguments' and `substitute-keyword-arguments'....* distro/packages/base.scm (default-keyword-arguments, substitute-keyword-arguments): Move to... * guix/utils.scm: ... here. Ludovic Courtès
2012-11-04utils: Add `package-name->name+version'....* guix/utils.scm (package-name->name+version): New procedure. * guix-package.in (guix-package)[find-package]: Use it. * tests/utils.scm ("package-name->name+version"): New test. Ludovic Courtès
2012-11-03build: Require GNU libgcrypt....* guix/utils.scm (sha256): Remove Coreutils- and libchop-based implementations. * README: Update accordingly. * m4/guix.m4: New file. * configure.ac: Use `GUIX_ASSERT_LIBGCRYPT_USABLE'. Set and substitute `LIBGCRYPT_PREFIX'. * Makefile.am (AM_DISTCHECK_CONFIGURE_FLAGS): Pass `--with-libgcrypt-prefix=$(LIBGCRYPT_PREFIX)'. Ludovic Courtès
2012-11-03build: Produce (guix config) instead of using compile-time tricks....* guix/config.scm.in: New file. * guix/utils.scm: Use it. (%libgcrypt): Remove. (%nixpkgs-directory): Don't capture the compile-time $NIXPKGS; use %NIXPKGS instead. (nixpkgs-derivation): Use %NIX-INSTANTIATE. * pre-inst-env.in (NIX_INSTANTIATE, NIXPKGS, LIBGCRYPT): Remove. * configure.ac: Emit `guix/config.scm'. * Makefile.am (GOBJECTS): Add `guix/config.go'. (nobase_nodist_guilemodule_DATA): Add `guix/config.scm'. Ludovic Courtès
2012-11-03build: Clearly mark Nixpkgs as optional....* configure.ac: Always show the result of checking for Nixpkgs. Don't warn when Nixpkgs is not found. * Makefile.am (AM_DISTCHECK_CONFIGURE_FLAGS): Remove `--with-nixpkgs' flag. * guix/utils.scm (%nixpkgs-directory): Use either the compile-time or the run-time `NIXPKGS' environment variable. * release.nix (jobs.tarball, jobs.build): Remove `--with-nixpkgs' configure flag. * README: Mark Nixpkgs as optional. * distro/packages/databases.scm, distro/packages/guile.scm, distro/packages/typesetting.scm: Change uses of `nixpkgs-derivation*' to `nixpkgs-derivation', to avoid failing at compile-time. Ludovic Courtès
2012-11-01utils: Remove stuff committed by error....This was wrongfully committed in df1fab58. * guix/utils.scm (hash-set-proc, hash-ref*, memoizing-lambda): Remove. Ludovic Courtès
2012-10-27location: Start column numbers at 1....* guix/utils.scm (source-properties->location): Use COL + 1. Ludovic Courtès
2012-10-25Add a `system' parameter to `nixpkgs-derivation'....* guix/utils.scm (nixpkgs-derivation): Add a `system' parameter. Pass it in the `nix-instantiate' invocation. Ludovic Courtès
2012-10-13distro: Add a statically-linked, relocatable Guile 2.0 package....* distro/packages/base.scm (%guile-static, %guile-static-stripped): New variables. * distro/patches/guile-relocatable.patch: New file. * Makefile.am (dist_patch_DATA): Add it. Ludovic Courtès
2012-09-03Move <location> to (guix utils)....* guix/packages.scm (<location>, location): Move to... * guix/utils.scm: ... here. Ludovic Courtès
2012-08-30define-record-type*: Add the `inherit' syntactic constructor keyword....* guix/utils.scm (define-record-type*)[make-syntactic-constructor]: New `type' parameter. Add the `inherit' keyword and corresponding support code. * tests/utils.scm ("define-record-type* & inherit", "define-record-type* & inherit & letrec* behavior"): New tests. Ludovic Courtès
2012-08-17build: Add `--with-libgcrypt-prefix'; capture the path to libgcrypt....* configure.ac: Add `--with-libgcrypt-prefix'. Substitute `LIBGCRYPT'. * Makefile.am (.scm.go): Pass $(LIBGCRYPT). * guix/utils.scm (%libgcrypt): New variable. (sha256): Use it. Ludovic Courtès
2012-08-14build: Pass $(NIX_INSTANTIATE) to the build and test environments....* Makefile.am (.scm.go): Define $NIX_INSTANTIATE. (TESTS_ENVIRONMENT): Likewise, and define $NIX_HASH. * guix/utils.scm (nixpkgs-derivation): Use $NIX_INSTANTIATE when defined. * tests/utils.scm (%nix-hash): New variable. ("sha256 & bytevector->nix-base32-string"): Use it. Ludovic Courtès
2012-07-11Add `nixpkgs-derivation*'; use it in the distro....* guix/utils.scm (nixpkgs-derivation*): New macro. * distro/base.scm: Use it instead of `nixpkgs-derivation'. Ludovic Courtès
2012-07-03define-record-type*: Add `letrec*' behavior....* guix/utils.scm (define-record-type*)[make-syntactic-constructor]: Bind all the ((FIELD VALUE) ...) in a `letrec*'. Adjust `field-value' accordingly. * tests/utils.scm ("define-record-type* with letrec* behavior"): New test. Ludovic Courtès
2012-07-02Make `define-record-type*' error messages more informative....* guix/utils.scm (define-record-type*): In case of missing or extra field initializers, raise a descriptive `syntax-error'. Ludovic Courtès
2012-06-29Add a libgcrypt-based implementation of `sha256'....* guix/utils.scm (sha256): Add a libgcrypt-based implementation using the FFI. Ludovic Courtès
2012-06-28Add a sha256 fallback that uses Coreutils instead of libchop....* guix/utils.scm (compile-time-value): Move to the top. (sha256): Add an implementation that uses Coreutils, for when libchop is unavailable. Ludovic Courtès
2012-06-28Introduce `compile-time-value' and use it....* guix/utils.scm (compile-time-value): New macro. (%nixpkgs-directory): Use it. * guix/build-system/gnu.scm (%standard-inputs): Likewise. Ludovic Courtès
2012-06-27Add `define-record-type*'....* guix/utils.scm (define-record-type*): New macro. * tests/utils.scm ("define-record-type*"): New test. Ludovic Courtès
2012-06-11Add a `%current-system' fluid....* guix/utils.scm (gnu-triplet->nix-system): New procedure. (%current-system): New variable. * tests/utils.scm ("gnu-triplet->nix-system"): New test. * tests/derivations.scm (%current-system): Remove. Update users to use (%current-system) instead. Ludovic Courtès
2012-06-09Add `base16-string->bytevector'....* guix/utils.scm (base16-string->bytevector): New procedure. * tests/utils.scm ("bytevector->base16-string->bytevector"): New test. Ludovic Courtès
2012-06-09Add `base32-string->bytevector' and `nix-base32-string->bytevector'....* guix/utils.scm (bytevector-quintet-set!, bytevector-quintet-set-right!, base32-string-unfold, base32-string-unfold-right, make-base32-string->bytevector, base32-string->bytevector, nix-base32-string->bytevector): New procedures. * tests/utils.scm ("base32-string->bytevector", "nix-base32-string->bytevector"): New tests. Ludovic Courtès
2012-06-07Allow derivations with input derivations....* guix/derivations.scm (derivation-path->output-path): New procedure. (derivation-hash): Call `memoize'. In the fixed-output case, convert HASH-ALGO to a string. In the other case, sort inputs in the alphabetical order of their hex hash. For inputs with no sub-drvs, add "out" as the sub-drv. * guix/utils.scm (%nixpkgs-directory): New parameter. (nixpkgs-derivation, memoize): New procedures. * tests/derivations.scm ("build derivation with 1 source"): Remove useless shebang. (%coreutils): New variable. ("build derivation with coreutils"): New test. Ludovic Courtès
2012-06-03Add `bytevector->base16-string'....* guix/utils.scm (bytevector->base16-string): New procedure. Ludovic Courtès
2012-06-03Fix `bytevector->nix-base32-string'....* guix/utils.scm (bytevector-quintet-ref-right, bytevector-quintet-fold): New procedures. (bytevector-quintet-fold-right): Add `quintet-fold' parameter; use it instead of `bytevector-quintet-fold'. (bytevector->base32-string): Pass BYTEVECTOR-QUINTET-FOLD as the first parameter. (bytevector->nix-base32-string): Pass BYTEVECTOR-QUINTET-FOLD-RIGHT as the first parameter. * tests/utils.scm ("sha256 & bytevector->nix-base32-string"): New test. Ludovic Courtès
2012-06-03Move `sha256' to (guix utils)....* guix/derivations.scm (sha256): Move to... * guix/utils.scm (sha256): ... here. Ludovic Courtès
2012-06-01Add (guix utils), with `bytevector->base32-string'....* guix/utils.scm, tests/utils.scm: New files. Ludovic Courtès