summaryrefslogtreecommitdiff
path: root/guix/utils.scm
AgeCommit message (Expand)Author
2021-07-21utils: Do not request block buffering in pretty-print-table....Re-testing 'guix package -A' using the default line buffering set in (guix ui), there doesn't seem to be a performance gain to use block buffering, so remove this extraneous side effect. * guix/utils.scm (pretty-print-table): Do not set buffering mode to block. Reported-by: Ludovic Courtès <ludo@gnu.org> Maxim Cournoyer
2021-07-15utils: Add a procedure for pretty printing tabular data....* guix/utils.scm (pretty-print-table): New procedure. Co-authored-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Steve Sprang
2021-04-05utils: 'tarball-sans-extension' recognizes ".tgz"....* guix/utils.scm (tarball-sans-extension): Add ".tgz". Ludovic Courtès
2021-03-23utils: Fix target-64bit? on powerpc64le-linux....* guix/utils.scm (target-64bit?): Change the string from "ppc64" to "powerpc64", which matches Guix system names like "powerpc64le-linux". Chris Marusich
2021-03-23utils: Add target-powerpc? procedure....* guix/utils.scm (target-powerpc?): New exported procedure. Chris Marusich
2021-03-12utils: Use Guile-zlib for gzip compression and decompression....Fixes <https://bugs.gnu.org/46967>. * guix/utils.scm (decompressed-port): Call 'make-zlib-input-port' instead of invoking %GZIP. (compressed-output-port): Call 'make-zlib-output-port' instead of invoking %GZIP. * doc/guix.texi (Requirements): Require Guile-zlib >= 0.1.0. Ludovic Courtès
2021-02-03utils: Add string distance....* guix/utils.scm (string-distance): New procedure. (string-closest): New procedure. * tests/utils.scm ("string-distance", "string-closest"): New tests. Signed-off-by: Ludovic Courtès <ludo@gnu.org> zimoun
2021-02-01utils: Add 'version-unique-prefix'....* guix/utils.scm (version-unique-prefix): New procedure. * tests/utils.scm ("version-unique-prefix"): New test. Ludovic Courtès
2021-01-13utils: Support zstd compression via Guile-zstd....* guix/utils.scm (lzip-port): Return a single value. (zstd-port): New procedure. (decompressed-port, compressed-output-port): Add 'zstd' case. * tests/utils.scm (test-compression/decompression): Test 'zstd' when the (zstd) module is available. Ludovic Courtès
2021-01-13utils: Remove 'compressed-output-port'....This procedure was unused except in one test. * guix/utils.scm (compressed-port): Remove. * tests/utils.scm (test-compression/decompression): Rewrite to use 'compressed-output-port' instead. Ludovic Courtès
2020-12-28utils: Add pkg-config-for-target....* guix/utils.scm (pkg-config-for-target): New procedure. Efraim Flashner
2020-11-16utils: Add 'cxx-for-target'....* guix/utils.scm (cxx-for-target): New procedure. Danny Milosavljevic
2020-08-24Use "guile-zlib" and "guile-lzlib" instead of (guix config)....* Makefile.am (MODULES): Remove guix/zlib.scm and guix/lzlib.scm, (SCM_TESTS): remove tests/zlib.scm, tests/lzlib.scm. * build-aux/build-self.scm (make-config.scm): Remove unused %libz variable. * configure.ac: Remove LIBZ and LIBLZ variables and check instead for Guile-zlib and Guile-lzlib. * doc/guix.texi ("Requirements"): Remove zlib requirement and add Guile-zlib and Guile-lzlib instead. * gnu/packages/package-management.scm (guix)[native-inputs]: Add "guile-zlib" and "guile-lzlib", [inputs]: remove "zlib" and "lzlib", [propagated-inputs]: ditto, [arguments]: add "guile-zlib" and "guile-lzlib" to Guile load path. * guix/config.scm.in (%libz, %liblz): Remove them. * guix/lzlib.scm: Remove it. * guix/man-db.scm: Use (zlib) instead of (guix zlib). * guix/profiles.scm (manual-database): Do not stub (guix config) in imported modules list, instead add "guile-zlib" to the extension list. * guix/scripts/publish.scm: Use (zlib) instead of (guix zlib) and (lzlib) instead of (guix lzlib), (string->compression-type, effective-compression): do not check for zlib and lzlib availability. * guix/scripts/substitute.scm (%compression-methods): Do not check for lzlib availability. * guix/self.scm (specification->package): Add "guile-zlib" and "guile-lzlib" and remove "zlib" and "lzlib", (compiled-guix): remove "zlib" and "lzlib" arguments and add guile-zlib and guile-lzlib to the dependencies, also do not pass "zlib" and "lzlib" to "make-config.scm" procedure, (make-config.scm): remove "zlib" and "lzlib" arguments as well as %libz and %liblz variables. * guix/utils.scm (lzip-port): Use (lzlib) instead of (guix lzlib) and do not check for lzlib availability. * guix/zlib.scm: Remove it. * m4/guix.m4 (GUIX_LIBZ_LIBDIR, GUIX_LIBLZ_FILE_NAME): Remove them. * tests/lzlib.scm: Use (zlib) instead of (guix zlib) and (lzlib) instead of (guix lzlib), and do not check for zlib and lzlib availability. * tests/publish.scm: Ditto. * tests/substitute.scm: Do not check for lzlib availability. * tests/utils.scm: Ditto. * tests/zlib.scm: Remove it. Mathieu Othacehe
2020-08-17utils: Add version-major+minor+point....* guix/utils.scm (version-major+minor+point): New procedure. Efraim Flashner
2020-07-25utils: Move '&fix-hint' to (guix diagnostics)....* guix/utils.scm (&fix-hint): Move to... * guix/diagnostics.scm (&fix-hint): ... here. * gnu.scm: Adjust imports accordingly. * gnu/system/mapped-devices.scm: Likewise. * guix/channels.scm: Likewise. * guix/profiles.scm: Likewise. * guix/scripts/system/reconfigure.scm: Likewise. * guix/ssh.scm: Likewise. Ludovic Courtès
2020-07-25utils: Remove compatibility re-export of 'memoize'....The 'memoize' binding was re-exported in 2016, commit 19e1d5f7f90194f1ac7e783b28a688ce1441786d, as a backwards-compatibility measure that makes little sense now. * guix/utils.scm: Don't re-export 'memoize'. * guix/import/pypi.scm: Adjust imports. * tests/pypi.scm: Remove duplicate (guix memoization) import. Ludovic Courtès
2020-07-25utils: Move <location> and '&error-location' to (guix diagnostics)....* guix/utils.scm (<location>, source-properties->location) (location->source-properties, &error-location): Move to... * guix/diagnostics.scm: ... here. * gnu.scm: Adjust imports accordingly. * gnu/machine.scm: Likewise. * gnu/system.scm: Likewise. * gnu/tests.scm: Likewise. * guix/inferior.scm: Likewise. * tests/channels.scm: Likewise. * tests/packages.scm: Likewise. Ludovic Courtès
2020-06-06utils: Add 'with-environment-variables'....* guix/tests/gnupg.scm (call-with-environment-variables) (with-environment-variables): Move to... * guix/utils.scm: ... here. * guix/tests/git.scm: Adjust accordingly. Ludovic Courtès
2020-05-29utils: Add 'cc-for-target'....* guix/utils.scm (cc-for-target): New procedure. Marius Bakke
2020-05-16utils: 'target-arm32?' & co. take an optional parameter....* guix/utils.scm (target-arm32?, target-aarch64?) (target-arm?, target-64bit?): Make 'target' an optional parameter. Ludovic Courtès
2020-01-06Adjust module autoloads....In Guile < 2.9.7, autoloading a module would give you access to all its bindings. In future versions, autoloading a module gives access only to the listed bindings, as per #:select (see <https://bugs.gnu.org/38895>). This commit adjusts autoloads to the new semantics, allowing Guix to be built with Guile 2.9.7/2.9.8. * guix/build/download.scm <top level>: Remove call to 'module-autoload!'. (load-gnutls): New procedure. (tls-wrap): Call it. * guix/git.scm <top level>: Remove call to 'module-autoload!'. (load-git-submodules): New procedure. (update-submodules): Call it instead of 'resolve-interface'. * gnu/bootloader/grub.scm: Replace #:autoload with #:use-module. * gnu/packages.scm: Likewise. * gnu/packages/ssh.scm: Likewise. * gnu/packages/tex.scm: Likewise. * gnu/services/cuirass.scm: Likewise. * gnu/services/mcron.scm: Likewise. * guix/lint.scm: Augment list of bindings in #:autoload. * guix/scripts/build.scm: Likewise. * guix/scripts/gc.scm: Likewise. * guix/scripts/pack.scm: Likewise. * guix/scripts/publish.scm: Likewise. * guix/scripts/pull.scm: Likewise. * guix/utils.scm: Remove unnecessary #:autoload clauses; replace one of them with #:use-module. Ludovic Courtès
2019-11-22utils: Use target-aarch64? and target-arm? helpers....* guix/utils.scm (target-aarch64?, target-arm?): New exported procedures. Mathieu Othacehe
2019-11-18utils: Handle #f file-name....* guix/utils.scm (current-source-directory): Change dispatch to handle #f file-name. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Alex Sassmannshausen
2019-09-10guix: Rename and move sans-extension to tarball-sans-extension....* guix/gnu-maintenance.scm (sans-extension): Move and rename to ... * guix/utils.scm (tarball-sans-extension): ... here. Hartmut Goebel
2019-06-20utils: canonical-newline-port: Fix handling of carriage return at buffer end....Prior to this change the added test fails for me locally at byte 1024. It might depend on some default buffer sizes. Fixes <https://bugs.gnu.org/35863>. * tests/utils.scm ("canonical-newline-port-1024"): Add test. * guix/utils.scm (canonical-newline-port): Correct comments on CR/LF. Remove CR even when they're at the end of the buffer. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Robert Vollmert
2019-05-27utils: Support compression and decompression with lzip....* guix/utils.scm (lzip-port): New procedure. (decompressed-port, compressed-port, compressed-output-port): Add 'lzip case. * tests/utils.scm <top level>: Call 'test-compression/decompression' for 'lzip as well. Ludovic Courtès
2018-12-19utils: Memoize 'absolute-dirname'....* guix/utils.scm (absolute-dirname): Wrap in 'mlambda'. Ludovic Courtès
2018-07-22Revert "guix: Compress and decompress xz archives in parallel."...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. Marius Bakke
2018-07-13utils: Really clean up temporary directories....Fixes <https://bugs.gnu.org/32126>. * guix/utils.scm (call-with-temporary-directory): Use DELETE-FILE-RECURSIVELY instead of RMDIR. Leo Famulari
2018-07-02utils: Micro-optimize 'source-properties->location'....* guix/utils.scm (source-properties->location): Destructure LOC with 'match', adding a fast path without 'assq-ref' calls. Ludovic Courtès
2018-07-02utils: Disable memoization for 'location'....This was getting 25% hits, which did not quite justify the overhead. * guix/utils.scm (location): Remove 'mlambda'. Ludovic Courtès
2018-06-16gnu: ldb: Fix build on 32-bit systems....* 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. Marius Bakke
2018-05-13utils: Add 'version-prefix?'....* guix/utils.scm (version-prefix?): New procedure. * tests/utils.scm ("version-prefix?"): New test. Ludovic Courtès
2017-12-11guix: utils: Add version-major....* guix/utils.scm (version-major): New procedure. nee
2017-12-01utils: Add target-arm32? procedure....* guix/utils.scm (target-arm32?): New exported procedure. Mathieu Othacehe
2017-11-08ui: Define and honor '&error-location' and '&fix-hint' conditions....* 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'. Ludovic Courtès
2017-10-19Add (guix progress)....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. Ludovic Courtès
2017-10-17guix: substitute: Report the last progress in the child process....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. 宋文武
2017-09-20download: Don't report the progress too fast....* 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. 宋文武
2017-09-19utils: 'current-source-directory' gracefully deals with lack of location info....* guix/utils.scm (current-source-directory): Adjust for when 'syntax-source' returns #f. Ludovic Courtès
2017-07-28utils: Factorize XDG directory handling....* 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'. Ludovic Courtès
2017-05-15utils: 'compressed-file?' matches ".lzma" files....* guix/utils.scm (compressed-file?): Add "lzma" to the list. Ludovic Courtès
2017-04-03utils: Fix handling of shell arguments for xz compression....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. Leo Famulari
2017-04-02guix: Compress and decompress xz archives in parallel....* guix/scripts/pack.scm (%compressors): Add flag '-T0' when calling "xz". * guix/utils.scm (decompressed-port, compressed-port, compressed-output-port): Same. Efraim Flashner
2017-03-16utils: Move base16 procedures to (guix base16)....* 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. Ludovic Courtès
2017-03-09utils: Use an idiom compatible with both 2.0 and 2.2....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. Ludovic Courtès
2017-03-08utils: Make sure to use the right 'bytevector->string'....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). Ludovic Courtès
2017-01-28Use 'mlambda' instead of 'memoize'....* 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. Ludovic Courtès
2017-01-28Add (guix memoization)....* 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. Ludovic Courtès
2017-01-11guix package: Fix version and output for 'guix package -i /gnu/store/…'....* 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. Ludovic Courtès