summaryrefslogtreecommitdiff
path: root/guix/utils.scm
Commit message (Collapse)AuthorAge
* utils: Memoize 'absolute-dirname'.Ludovic Courtès2018-12-19
| | | | * guix/utils.scm (absolute-dirname): Wrap in 'mlambda'.
* Revert "guix: Compress and decompress xz archives in parallel."Marius Bakke2018-07-22
| | | | | | | Threaded compression makes archives non-deterministic: the result depends on the number of threads used for compressing. See <https://bugs.gnu.org/31015>. This reverts commit 63102406f22412bb922de5549deb89d3594a38c0.
* utils: Really clean up temporary directories.Leo Famulari2018-07-13
| | | | | | | Fixes <https://bugs.gnu.org/32126>. * guix/utils.scm (call-with-temporary-directory): Use DELETE-FILE-RECURSIVELY instead of RMDIR.
* utils: Micro-optimize 'source-properties->location'.Ludovic Courtès2018-07-02
| | | | | * guix/utils.scm (source-properties->location): Destructure LOC with 'match', adding a fast path without 'assq-ref' calls.
* utils: Disable memoization for 'location'.Ludovic Courtès2018-07-02
| | | | | | This was getting 25% hits, which did not quite justify the overhead. * guix/utils.scm (location): Remove 'mlambda'.
* gnu: ldb: Fix build on 32-bit systems.Marius Bakke2018-06-16
| | | | | | * guix/utils.scm (target-64bit?): New procedure. * gnu/packages/samba.scm (ldb)[inputs]: Only add LMDB on 64-bit systems. [arguments]: Make #:tests? conditional on LMDB availability.
* utils: Add 'version-prefix?'.Ludovic Courtès2018-05-13
| | | | | * guix/utils.scm (version-prefix?): New procedure. * tests/utils.scm ("version-prefix?"): New test.
* guix: utils: Add version-major.nee2017-12-11
| | | | * guix/utils.scm (version-major): New procedure.
* utils: Add target-arm32? procedure.Mathieu Othacehe2017-12-01
| | | | * guix/utils.scm (target-arm32?): New exported procedure.
* ui: Define and honor '&error-location' and '&fix-hint' conditions.Ludovic Courtès2017-11-08
| | | | | | * guix/utils.scm (&error-location, &fix-hint): New condition types. * guix/ui.scm (report-load-error): Handle them. (call-with-error-handling): Honor '&error-location'.
* Add (guix progress).Ludovic Courtès2017-10-19
| | | | | | | | | | | | | | | | | | Among other things, this removes (guix utils), (guix ui), (guix config), etc. from the closure of (guix build download), as was the case since 798648515b77507c242752457b4dc17c155bad6e. * guix/utils.scm (<progress-reporter>, call-with-progress-reporter): Move to... * guix/progress.scm: ... here. New file. * Makefile.am (MODULES): Add it. * guix/build/download.scm (current-terminal-columns) (nearest-exact-integer, duration->seconds, seconds->string) (byte-count->string, progress-bar, string-pad-middle) (rate-limited, progress-reporter/file, dump-port*) (time-monotonic): Move to progress.scm. * guix/scripts/download.scm: Adjust accordingly. * guix/scripts/substitute.scm: Likewise.
* guix: substitute: Report the last progress in the child process.宋文武2017-10-17
| | | | | | | | | Fixes <https://bugs.gnu.org/28756>. * guix/utils.scm (filtered-port): Close the 'input' port for the current process, and close it upon exit in the child process. * guix/scripts/substitute.scm (progress-substitution): Display "\n\n" after the reporter has finished.
* download: Don't report the progress too fast.宋文武2017-09-20
| | | | | | | | | | | | * guix/utils.scm (<progress-reporter>): New record type. (call-with-progress-reporter): New procedure. * guix/build/download.scm (dump-port*, rate-limited, progress-reporter/file): New procedures. (ftp-fetch, http-fetch): Use 'dump-port*'. (progress-proc): Remove procedure. * guix/scripts/substitute.scm (progress-report-port): Rewrite in terms of <progress-reporter>. (process-substitution): Adjust accordingly.
* utils: 'current-source-directory' gracefully deals with lack of location info.Ludovic Courtès2017-09-19
| | | | | * guix/utils.scm (current-source-directory): Adjust for when 'syntax-source' returns #f.
* utils: Factorize XDG directory handling.Ludovic Courtès2017-07-28
| | | | | | | | * guix/ui.scm (config-directory): Remove. * guix/utils.scm (xdg-directory, config-directory): New procedures. (cache-directory): Rewrite in terms of 'xdg-directory'. * guix/scripts/substitute.scm (%narinfo-cache-directory): Pass #:ensure? #f to 'cache-directory'.
* utils: 'compressed-file?' matches ".lzma" files.Ludovic Courtès2017-05-15
| | | | * guix/utils.scm (compressed-file?): Add "lzma" to the list.
* utils: Fix handling of shell arguments for xz compression.Leo Famulari2017-04-03
| | | | | | | | | Fixes test failures related to xz compression in tests/utils.scm. This is a followup to commit 63102406f22412bb922de5549deb89d3594a38c0. * guix/utils.scm (decompressed-port, compressed-port, compressed-output-port): Split each shell argument into its own list element.
* guix: Compress and decompress xz archives in parallel.Efraim Flashner2017-04-02
| | | | | | * guix/scripts/pack.scm (%compressors): Add flag '-T0' when calling "xz". * guix/utils.scm (decompressed-port, compressed-port, compressed-output-port): Same.
* utils: Move base16 procedures to (guix base16).Ludovic Courtès2017-03-16
| | | | | | | | | | | | | | | * guix/utils.scm (bytevector->base16-string, base16-string->bytevector): Move to... * guix/base16.scm: ... here. New file. * tests/utils.scm ("bytevector->base16-string->bytevector"): Move to... * tests/base16.scm: ... here. New file. * Makefile.am (MODULES): Add guix/base16.scm. (SCM_TESTS): Add tests/base16.scm. * build-aux/download.scm, guix/derivations.scm, guix/docker.scm, guix/import/snix.scm, guix/pk-crypto.scm, guix/scripts/authenticate.scm, guix/scripts/download.scm, guix/scripts/hash.scm, guix/store.scm, tests/hash.scm, tests/pk-crypto.scm: Adjust imports accordingly.
* utils: Use an idiom compatible with both 2.0 and 2.2.Ludovic Courtès2017-03-09
| | | | | | | | Fixes a regression introduced in 7447aa36e16fb77f75df4d3369db9c942615632e. Reported by Ricardo Wurmus. * guix/utils.scm: Revert 7447aa36e16fb77f75df4d3369db9c942615632e. Use #:prefix for (ice-9 iconv) to support both 2.0 and 2.2.
* utils: Make sure to use the right 'bytevector->string'.Ludovic Courtès2017-03-08
| | | | | | | In Guile 2.2, (rnrs io ports) exports 'bytevector->string', which conflicts with that of (ice-9 iconv). * guix/utils.scm: Hide 'bytevector->string' from (rnrs io ports).
* Use 'mlambda' instead of 'memoize'.Ludovic Courtès2017-01-28
| | | | | | | | | | | | | | | | | * gnu/packages.scm (find-newest-available-packages): Use 'mlambda' instead of (memoize (lambda ...) ...). * gnu/packages/bootstrap.scm (package-with-bootstrap-guile): Likewise. * guix/build-system/gnu.scm (package-with-explicit-inputs)[rewritten-input]: Likewise. * guix/build-system/python.scm (package-with-explicit-python)[transform]: Likewise. * guix/derivations.scm (derivation->string): Likewise. * guix/gnu-maintenance.scm (gnu-package?): Likewise. * guix/modules.scm (module-file-dependencies): Likewise. * guix/scripts/graph.scm (standard-package-set): Likewise. * guix/scripts/lint.scm (official-gnu-packages*): Likewise. * guix/store.scm (store-regexp*): Likewise. * guix/utils.scm (location): Likewise.
* Add (guix memoization).Ludovic Courtès2017-01-28
| | | | | | | | | | | | | * guix/combinators.scm (memoize): Remove. * guix/memoization.scm: New file. * Makefile.am (MODULES): Add it. * gnu/packages.scm, gnu/packages/bootstrap.scm, guix/build-system/gnu.scm, guix/build-system/python.scm, guix/derivations.scm, guix/gnu-maintenance.scm, guix/import/cran.scm, guix/import/elpa.scm, guix/modules.scm, guix/scripts/build.scm, guix/scripts/graph.scm, guix/scripts/lint.scm, guix/store.scm, guix/utils.scm: Adjust imports accordingly.
* guix package: Fix version and output for 'guix package -i /gnu/store/…'.Ludovic Courtès2017-01-11
| | | | | | | | | * guix/utils.scm (package-name->name+version): Add optional 'delimiter' parameter. * guix/scripts/package.scm (store-item->manifest-entry): Pass #\- as the delimiter for 'package-name->name+version'. Use "out" instead of #f for the 'output' field. * tests/guix-package.sh: Add test.
* gnu: cross-base: Add i686-w64-mingw32 target.Jan Nieuwenhuizen2016-12-07
| | | | | | | | | | * guix/utils.scm (mingw-target?): New function. * gnu/packages/cross-base.scm (cross-gcc-snippet): New procedure (cross-gcc): Use it. (cross-gcc-arguments, cross-gcc-patches, cross-gcc): Support MinGW. (native-libc, cross-newlib?): New functions. (cross-libc): Use cross-newlib? to support MinGW. (%gcc-include-paths, %gcc-cross-include-paths): New variables.
* Use (ice-9 binary-ports) instead of (rnrs io ports).Ludovic Courtès2016-10-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reduces the closure of (guix ui) from 123 to 106 modules. * guix/derivations.scm: Use (ice-9 binary-ports) instead of (rnrs io ports). (map-derivation)[substitute-file]: Use 'read-string' instead of 'get-string-all'. * guix/ftp-client.scm: Likewise. * guix/hash.scm: Likewise. * guix/http-client.scm: Likewise. * guix/pki.scm (ensure-acl, current-acl): Likewise. * guix/scripts/archive.scm (authorize-key)[read-key]: Likewise. * guix/scripts/authenticate.scm (read-canonical-sexp) (read-hash-data): Likewise. * guix/scripts/download.scm: Likewise. * guix/scripts/offload.scm (register-gc-root, remove-gc-roots) (send-files): Likewise. * guix/scripts/publish.scm (lazy-read-file-sexp): Likewise. * guix/scripts/refresh.scm: Likewise. * guix/scripts/substitute.scm (check-acl-initialized): Likewise. * guix/serialization.scm (read-maybe-utf8-string): Likewise. * guix/scripts/hash.scm (guix-hash): Use 'force-output' instead of 'flush-output-port'. * guix/store.scm (process-stderr): Likewise. * guix/tests.scm: Likewise. * guix/utils.scm: Use (ice-9 binary-ports) and autoload (rnrs io ports) for 'make-custom-binary-input-port'.
* utils: Support defaults in substitute-keyword-arguments.Eric Bavier2016-10-07
| | | | | | | * guix/utils.scm (collect-default-args, expand-default-args): New syntax. (substitute-keyword-arguments): Allow default value declarations. * tests/utils.scm (substitute-keyword-arguments): New test.
* utils: Fix default-keyword-arguments.Eric Bavier2016-10-07
| | | | | | * guix/utils.scm (default-keyword-arguments): Properly test for present keywords. * tests/utils.scm (default-keyword-arguments): New test.
* publish: Do not compress already-compressed files.Ludovic Courtès2016-08-01
| | | | | | | * guix/scripts/publish.scm (narinfo-string): Force %NO-COMPRESSION when STORE-PATH matches 'compressed-file?'. * guix/utils.scm (compressed-file?): New procedure. * tests/publish.scm ("/*.narinfo for a compressed file"): New test.
* utils: 'cache-directory' always appends "/guix".Ludovic Courtès2016-06-25
| | | | | | | | Fixes <http://bugs.gnu.org/23836>. Fixes a regression introduced in f10dcbf1a92c147a2fedba6f774afa6a7013fcdf. Reported by myglc2 <myglc2@gmail.com>. * guix/utils.scm (cache-directory): Always append "/guix".
* utils: 'cache-directory' honors 'XDG_CACHE_HOME'.Ludovic Courtès2016-06-22
| | | | | * guix/utils.scm (cache-directory): Honor 'XDG_CACHE_HOME', not 'XDG_CONFIG_HOME'.
* utils: 'current-source-directory' gracefully handles lack of source info.Ludovic Courtès2016-06-20
| | | | | * guix/utils.scm (current-source-directory): Add case for when FILE-NAME is #f.
* utils: 'current-source-directory' resolves relative file names at run time.Ludovic Courtès2016-06-20
| | | | | | * guix/utils.scm (absolute-dirname): New procedure. (current-source-directory): Emit code to use it instead of calling 'search-path'.
* utils: 'current-source-directory' returns the absolute directory name.Ludovic Courtès2016-06-16
| | | | | * guix/utils.scm (current-source-directory): When FILE-NAME is relative, use 'search-path' to determine the absolute file name.
* utils: 'current-source-directory' is now purely an expansion-time thing.Ludovic Courtès2016-06-16
| | | | | * guix/utils.scm (extract-directory): Remove. (current-source-directory): Rewrite as a 'syntax-case' macro.
* gexp: Move 'current-source-directory' to (guix utils).Ludovic Courtès2016-06-16
| | | | | | * guix/gexp.scm (extract-directory, current-source-directory): Move to... * guix/utils.scm (extract-directory, current-source-directory): ... here. New procedures.
* utils: 'with-atomic-file-output' closes the port upon exception.Ludovic Courtès2016-06-13
| | | | | | Previously it could have left the file descriptor open. * guix/utils.scm (with-atomic-file-output): Call 'close-port' in handler.
* utils: 'with-atomic-file-output' calls 'fdatasync'.Ludovic Courtès2016-06-13
| | | | | | | | | Suggested by Danny Milosavljevic <dannym@scratchpost.org> at <https://lists.gnu.org/archive/html/guix-devel/2016-06/msg00456.html>. * guix/build/syscalls.scm (fdatasync): New procedure. * guix/utils.scm (with-atomic-file-output): Use it. Use 'close-port' instead of 'close'.
* guix: utils: Re-export 'memoize'.Alex Kost2016-05-09
| | | | | | | | | Suggested by Ludovic Courtès <ludo@gnu.org>. * guix/utils.scm: Re-export 'memoize' to avoid a potential breakage of emacs interface. See <http://lists.gnu.org/archive/html/guix-devel/2016-05/msg00146.html> for details.
* utils: Move 'fcntl-flock' to (guix build syscalls).Ludovic Courtès2016-05-06
| | | | | | | | | | | * guix/utils.scm (%struct-flock, F_SETLKW, F_SETLK, F_xxLCK) (fcntl-flock): Move to... * guix/build/syscalls.scm: ... here. New variables. * guix/nar.scm: Adjust imports accordingly. * tests/utils.scm ("fcntl-flock wait", "fcntl-flock non-blocking"): Move to... * tests/syscalls.scm: ... here. New tests. (temp-file): New variable.
* utils: Move combinators to (guix combinators).Ludovic Courtès2016-05-04
| | | | | | | | | | | | | | | | | | | * guix/utils.scm (compile-time-value, memoize, fold2) (fold-tree, fold-tree-leaves): Move to... * guix/combinators: ... here. New file. * tests/utils.scm ("fold2, 1 list", "fold2, 2 lists") (fold-tree tests): Move to... * tests/combinators.scm: ... here. New file. * Makefile.am (MODULES, SCM_TESTS): Add them. * gnu/packages.scm, gnu/packages/bootstrap.scm, gnu/services/herd.scm, guix/build-system/gnu.scm, guix/build-system/python.scm, guix/derivations.scm, guix/gnu-maintenance.scm, guix/import/elpa.scm, guix/scripts/archive.scm, guix/scripts/build.scm, guix/scripts/graph.scm, guix/scripts/lint.scm, guix/scripts/size.scm, guix/scripts/substitute.scm, guix/serialization.scm, guix/store.scm, guix/ui.scm: Adjust imports accordingly.
* utils: Remove 'split'.Ludovic Courtès2016-05-04
| | | | | | | | This procedure was redundant with SRFI-1's 'break'. * guix/utils.scm (split): Remove. * tests/utils.scm ("split, element is in list") ("split, element is not in list"): Remove.
* utils: 'cache-directory' gracefully deals with unset 'HOME'.Ludovic Courtès2016-04-18
| | | | | | Fixes <http://bugs.gnu.org/23165>. * guix/utils.scm (cache-directory): Use 'getpwuid' when 'HOME' is unset.
* utils: Add 'location->source-properties'.宋文武2016-04-13
| | | | * guix/utils (location-source->properties): New procedure.
* utils: Add 'edit-expression'.宋文武2016-04-13
| | | | | * guix/utils.scm (edit-expression): New procedure. * tests/utils.scm (edit-expression): New test.
* utils: Use '@' for separating package names and version numbers.Mathieu Lirzin2016-03-02
| | | | | | | | | | | | | | | | | | | | | This provides the ability to use numbers in package names. Fixes <http://bugs.gnu.org/19219>. * guix/utils.scm (package-name->name+version): New procedure. * gnu/packages.scm (%find-package): Add a FALLBACK? keyword argument. Use the previous method when no package is found. (specification->package+output, specification->package): Adapt documentation to new syntax. * doc/guix.texi (Invoking guix package, Invoking guix import): Likewise. * guix/ui.scm (package-specification->name+version+output): Likewise. * guix/scripts/import/hackage.scm (show-help): Likewise. * tests/guix-build.sh: Adapt to new syntax. * tests/guix-lint.sh: Likewise. * tests/guix-package.sh: Likewise. * tests/ui.scm ("package-specification->name+version+output"): Likewise. * tests/utils.scm ("package-name->name+version"): Likewise. * NEWS: Mention new syntax.
* utils: Add 'ensure-keyword-arguments'.Ludovic Courtès2016-01-06
| | | | | * guix/utils.scm (delkw, ensure-keyword-arguments): New procedures. * tests/utils.scm ("ensure-keyword-arguments"): New test.
* utils: Add 'canonical-newline-port'.Federico Beffa2015-11-26
| | | | | * guix/utils.scm (canonical-newline-port): New procedure. * tests/utils.scm ("canonical-newline-port"): New test.
* utils: Add 'switch-symlinks', moved from (guix ui).Ludovic Courtès2015-10-27
| | | | | | * guix/ui.scm (switch-symlinks): Move to... * guix/utils.scm: ... here. New procedure. * guix/scripts/pull.scm: Use it.
* utils: Add 'readlink*'.Ludovic Courtès2015-10-27
| | | | | * guix/scripts/package.scm (readlink*): Move to... * guix/utils.scm (readlink*): ... here. New procedure.