summaryrefslogtreecommitdiff
path: root/guix/utils.scm
AgeCommit message (Collapse)Author
2021-10-10utils: Define 'target-riscv64?' predicate.Efraim Flashner
* guix/utils.scm (target-riscv64?): New predicate.
2021-08-17utils: Define target-ppc64le? predicate.Efraim Flashner
* guix/utils.scm (target-ppc64le?): New predicate.
2021-08-17utils: Define 'target-ppc32?' predicate.Efraim Flashner
* guix/utils.scm (target-ppc32?): New predicate.
2021-07-29Merge branch 'master' into core-updates-frozenMarius Bakke
Conflicts: gnu/packages/bioinformatics.scm gnu/packages/cmake.scm gnu/packages/curl.scm gnu/packages/emacs-xyz.scm gnu/packages/gpodder.scm gnu/packages/music.scm gnu/packages/patches/glibc-bootstrap-system.patch gnu/packages/python-xyz.scm gnu/packages/shells.scm gnu/packages/statistics.scm
2021-07-21utils: Do not request block buffering in pretty-print-table.Maxim Cournoyer
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>
2021-07-18Merge branch 'master' into core-updatesLudovic Courtès
2021-07-15utils: Add a procedure for pretty printing tabular data.Steve Sprang
* 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>
2021-07-14utils: Define a target-x86-32? and target-x86-64? predicate.Maxime Devos
* guix/utils.scm (target-x86-32?, target-x86-64?): New predicates. * tests/utils.scm ("target-x86-32?", "target-x86-64?"): New tests. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2021-07-14utils: Give 'target-mingw?' a docstring.Maxime Devos
target-hurd? and target-linux? have docstrings, but target-mingw? doesn't. * guix/utils.scm (target-mingw?): Add a docstring. Reported-By: Mathieu Othacehe <othacehe@gnu.org> Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2021-07-14utils: Define 'target-hurd?' predicate.Maxime Devos
It behaves similarily to the other target-...? procedures. The usage of hurd-triplet? / target-hurd? in libgc appears incorrect to me, as (%current-system) is normally never false. * gnu/packages/hurd.scm (hurd-triplet?): Move to ... * guix/util.scm (target-hurd?): ... here, let its argument default to (%current-target-system) or (%current-system), and write a docstring. * gnu/packages/hurd.scm (hurd-target?, hurd-system?): Use target-hurd? instead of hurd-triplet?. * gnu/packages/bdw-gc.scm (libgc): Likewise. * gnu/packages/cross-base.scm (cross-libc)[arguments]<#:configure-flags>: Likewise. (cross-libc)[arguments]<#:phases>: Likewise. (cross-libc)[arguments]<#:native-inputs>: Likewise. * gnu/packages/make-boostrap.scm (%glibc-stripped)[inputs]: Likewise. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2021-07-14utils: Define 'target-linux?' predicate.Maxime Devos
* guix/utils.scm (target-linux?): New predicate. * tests/utils.scm ("target-linux?"): Test it. ("target-mingw?"): Also test ‘target-mingw?’. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2021-07-11utils: 'edit-expression' copies part of the original source map.Ludovic Courtès
* guix/utils.scm (source-location-key/stamp): New procedure. (go-to-location): Use it. (move-source-location-map!): New procedure. (edit-expression): Call it.
2021-07-11utils: 'edit-expression' modifies the file only if necessary.Ludovic Courtès
* guix/utils.scm (edit-expression): Check whether STR* equals STR.
2021-07-11utils: Add 'go-to-location' with source location caching.Ludovic Courtès
* guix/utils.scm (%source-location-map): New variable. (go-to-location): New procedure. (edit-expression): Use it instead of custom loop. * guix/packages.scm (package-field-location)[goto]: Remove. Use 'go-to-location' instead of 'goto'.
2021-07-11utils: 'edit-expression' no longer leaks file ports.Ludovic Courtès
* guix/utils.scm (edit-expression): Use 'call-with-input-file' to make sure IN gets closed.
2021-04-16Merge remote-tracking branch 'origin/master' into core-updatesEfraim Flashner
Conflicts: gnu/local.mk gnu/packages/boost.scm gnu/packages/chez.scm gnu/packages/compression.scm gnu/packages/crates-io.scm gnu/packages/docbook.scm gnu/packages/engineering.scm gnu/packages/gcc.scm gnu/packages/gl.scm gnu/packages/gtk.scm gnu/packages/nettle.scm gnu/packages/python-check.scm gnu/packages/python-xyz.scm gnu/packages/radio.scm gnu/packages/rust.scm gnu/packages/sqlite.scm guix/build-system/node.scm
2021-04-05utils: 'tarball-sans-extension' recognizes ".tgz".Ludovic Courtès
* guix/utils.scm (tarball-sans-extension): Add ".tgz".
2021-03-24Merge remote-tracking branch 'origin/master' into core-updatesEfraim Flashner
2021-03-23utils: Fix target-64bit? on powerpc64le-linux.Chris Marusich
* guix/utils.scm (target-64bit?): Change the string from "ppc64" to "powerpc64", which matches Guix system names like "powerpc64le-linux".
2021-03-23utils: Add target-powerpc? procedure.Chris Marusich
* guix/utils.scm (target-powerpc?): New exported procedure.
2021-03-12utils: Use Guile-zlib for gzip compression and decompression.Ludovic Courtès
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.
2021-02-11Merge branch 'master' into core-updatesDanny Milosavljevic
2021-02-03utils: Add string distance.zimoun
* 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>
2021-02-03Merge branch 'master' into core-updatesChristopher Baines
2021-02-01utils: Add 'version-unique-prefix'.Ludovic Courtès
* guix/utils.scm (version-unique-prefix): New procedure. * tests/utils.scm ("version-unique-prefix"): New test.
2021-01-13Merge branch 'staging' into 'core-updates'.Maxim Cournoyer
Conflicts: gnu/local.mk gnu/packages/cmake.scm gnu/packages/curl.scm gnu/packages/gl.scm gnu/packages/glib.scm gnu/packages/guile.scm gnu/packages/node.scm gnu/packages/openldap.scm gnu/packages/package-management.scm gnu/packages/python-xyz.scm gnu/packages/python.scm gnu/packages/tls.scm gnu/packages/vpn.scm gnu/packages/xorg.scm
2021-01-13utils: Support zstd compression via Guile-zstd.Ludovic Courtès
* 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.
2021-01-13utils: Remove 'compressed-output-port'.Ludovic Courtès
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.
2020-12-28utils: Add pkg-config-for-target.Efraim Flashner
* guix/utils.scm (pkg-config-for-target): New procedure.
2020-11-29Merge remote-tracking branch 'origin/master' into core-updatesChristopher Baines
2020-11-16utils: Add 'cxx-for-target'.Danny Milosavljevic
* guix/utils.scm (cxx-for-target): New procedure.
2020-10-08packages, scripts, utils: Enable multi-threaded xz compression.Maxim Cournoyer
xz compression is slow; using the multi-thread mode of xz can make it more than 6 times faster, for example when compressing the large linux-libre source. * guix/build/utils.scm (%xz-parallel-args): New procedure. * guix/packages.scm (patch-and-repack): Specify the required above xz arguments by setting the XZ_DEFAULTS environment variable. * guix/scripts/pack.scm (%compressors, bootstrap-xz): Modify the commands Gexps so they do not need to be quoted. This allows lazily evaluating the arguments on the builder's side. Specify the required xz arguments. (self-contained-tarball): Do not quote the compressor command value. (docker-image): Likewise. * guix/utils.scm (decompressed-port, compressed-port) (compressed-output-port): Specify the required above xz arguments.
2020-09-19utils: Add 'call-with-temporary-output-file'.Ludovic Courtès
* guix/utils.scm: Re-export 'call-with-temporary-output-file'. (call-with-temporary-output-file): Move to... * guix/build/utils.scm (call-with-temporary-output-file): ... here.
2020-08-24Use "guile-zlib" and "guile-lzlib" instead of (guix config).Mathieu Othacehe
* 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.
2020-08-17utils: Add version-major+minor+point.Efraim Flashner
* guix/utils.scm (version-major+minor+point): New procedure.
2020-07-25utils: Move '&fix-hint' to (guix diagnostics).Ludovic Courtès
* 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.
2020-07-25utils: Remove compatibility re-export of 'memoize'.Ludovic Courtès
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.
2020-07-25utils: Move <location> and '&error-location' to (guix diagnostics).Ludovic Courtès
* 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.
2020-06-06utils: Add 'with-environment-variables'.Ludovic Courtès
* guix/tests/gnupg.scm (call-with-environment-variables) (with-environment-variables): Move to... * guix/utils.scm: ... here. * guix/tests/git.scm: Adjust accordingly.
2020-05-29utils: Add 'cc-for-target'.Marius Bakke
* guix/utils.scm (cc-for-target): New procedure.
2020-05-16utils: 'target-arm32?' & co. take an optional parameter.Ludovic Courtès
* guix/utils.scm (target-arm32?, target-aarch64?) (target-arm?, target-64bit?): Make 'target' an optional parameter.
2020-01-06Adjust module autoloads.Ludovic Courtès
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.
2019-11-22utils: Use target-aarch64? and target-arm? helpers.Mathieu Othacehe
* guix/utils.scm (target-aarch64?, target-arm?): New exported procedures.
2019-11-18utils: Handle #f file-name.Alex Sassmannshausen
* guix/utils.scm (current-source-directory): Change dispatch to handle #f file-name. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2019-09-10guix: Rename and move sans-extension to tarball-sans-extension.Hartmut Goebel
* guix/gnu-maintenance.scm (sans-extension): Move and rename to ... * guix/utils.scm (tarball-sans-extension): ... here.
2019-06-20utils: canonical-newline-port: Fix handling of carriage return at buffer end.Robert Vollmert
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>
2019-05-27utils: Support compression and decompression with lzip.Ludovic Courtès
* 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.
2018-12-19utils: Memoize 'absolute-dirname'.Ludovic Courtès
* guix/utils.scm (absolute-dirname): Wrap in 'mlambda'.
2018-07-22Revert "guix: Compress and decompress xz archives in parallel."Marius Bakke
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.
2018-07-13utils: Really clean up temporary directories.Leo Famulari
Fixes <https://bugs.gnu.org/32126>. * guix/utils.scm (call-with-temporary-directory): Use DELETE-FILE-RECURSIVELY instead of RMDIR.