~ruther/guix-local

ref: cf690129b4e4ea130d9b890b51fa096fae3ce250 guix-local/guix/utils.scm -rw-r--r-- 26.6 KiB
29a7c98a — Ian Denhardt 11 years ago
gnu: Add 'version-prefix' and 'version-major+minor'; use them.

The procedure version-prefix truncates a version string to a certain
number of components. version-major+minor is a special case of this,
which extracts the "major.minor" part of the string. Previously this
was handled by an expression common to several packages.

* guix/utils.scm (version-prefix, version-major+minor): New procedures
* gnu/packages/backup.scm (duplicity): Use version-major+minor.
* gnu/packages/cmake.scm (cmake): Likewise.
* gnu/packages/gnome.scm (libbonobo, libbonoboui): Likewise.
* gnu/packages/gnutls.scm (gnutls): Likewise.
* gnu/packages/mail.scm (gmime): Likewise.
* gnu/packages/mpd.scm (mpd): Likewise.
* gnu/packages/mpi.scm (openmpi): Likewise.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
998fb8fa — Ludovic Courtès 11 years ago
utils: Micro-optimize 'bytevector->base16-string'.

This reduces run time of (package-derivation s emacs) by ~1.5%.

* guix/utils.scm (bytevector->base16-string): Traverse BV from the end
  so as to use 'string-concatenate' instead of
  'string-concatenate-reverse'.
5e110382 — Ludovic Courtès 11 years ago
utils: Add 'strip-keyword-arguments'.

* guix/utils.scm (strip-keyword-arguments): New procedure.
* tests/utils.scm ("strip-keyword-arguments"): New test.
57db49cc — Ludovic Courtès 11 years ago
utils: Create temporary files in $TMPDIR or /tmp.

Reported by Federico Beffa <beffa@ieee.org>.

* guix/utils.scm (call-with-temporary-output-file): Prepend $TMPDIR or
  /tmp to TEMPLATE.
33690ffd — Mark H Weaver 11 years ago
Merge branch 'master' into core-updates
516e3b6f — Eric Bavier 11 years ago
guix: utils: Add fold-tree and fold-tree-leaves.

* guix/utils.scm (fold-tree, fold-tree-leaves): New functions.
* tests/utils.scm: Add tests for them.
af018f5e — Ludovic Courtès 11 years ago
Merge branch 'master' into core-updates
29fa45f4 — Ludovic Courtès 12 years ago
Add (guix build syscalls).

* guix/build/syscalls.scm, tests/syscalls.scm: New files.
* Makefile.am (MODULES): Add guix/build/syscalls.scm.
  (SCM_TESTS): Add tests/syscalls.scm.
* guix/utils.scm (%libc-errno-pointer, errno): Remove; take from (guix
  build syscalls).
30ce8012 — Ludovic Courtès 12 years ago
offload: '{send,receive}-files' wait for completion of the transfer.

Fixes situations where the remote 'guix build' is invoked before the
.drv has been completely copied, as reported at
<https://lists.gnu.org/archive/html/guix-devel/2014-04/msg00174.html>.

In some cases 'send-files' would return before the other end is done
importing the files, and so the subsequent 'guix build' invocation would
just miss the .drv file it refers to.

* guix/utils.scm (call-with-decompressed-port): Don't close PORT.
  (call-with-compressed-output-port): Likewise.
* tests/utils.scm ("compressed-output-port + decompressed-port"): Adjust
  accordingly.
* guix/scripts/offload.scm (send-files): Add explicit (close-pipe pipe)
  call.
  (retrieve-files): Likewise.
af4535c5 — Ludovic Courtès 12 years ago
utils: Make 'errno' procedure more robust.

Partially fixes <http://bugs.gnu.org/17212>.

* guix/utils.scm (errno): Move definition of 'bv' outside of the
  procedure.  Use 'bytevector-s32-native-ref' or
  'bytevector-s64-native-ref' instead of 'bytevector-sint-ref'.
01ac19dc — Ludovic Courtès 12 years ago
utils: Add 'call-with-decompressed-port' and 'call-with-compressed-output-port'.

* guix/utils.scm (call-with-decompressed-port,
  call-with-compressed-output-port): New procedures.
* tests/utils.scm ("compressed-output-port + decompressed-port"):
  Rewrite to use them.
80dea563 — Ludovic Courtès 12 years ago
utils: Add 'filtered-output-port' and 'compressed-output-port'.

* guix/utils.scm (filtered-output-port, compressed-output-port): New
  procedures.
* tests/utils.scm ("compressed-output-port + decompressed-port"): New
  test.
7a8024a3 — Ludovic Courtès 12 years ago
utils: Add 'decompressed-port' and 'compressed-port'.

* guix/utils.scm (decompressed-port, compressed-port): New procedures.
* guix/scripts/substitute-binary.scm (decompressed-port): Remove.
  (guix-substitute-binary): Pass a symbol or #f as the first argument to
  'decompress-port'.
* tests/utils.scm ("compressed-port, decompressed-port, non-file"): New
  test.
443eb4e9 — Ludovic Courtès 12 years ago
utils: 'filtered-port' doesn't leave dangling processes behind.

* guix/utils.scm (filtered-port): Make sure the 'execl' child process
  always exits, and does (primitive-_exit 1) upon execution failure.
  Use 'primitive-_exit' in the 'dump-port' child process.
* tests/utils.scm ("filtered-port, does not exist"): New test.
e06f7865 — Ludovic Courtès 12 years ago
Merge branch 'master' into core-updates
c7445833 — Ludovic Courtès 12 years ago
utils: Add a non-blocking option for 'fcntl-flock'.

* guix/utils.scm (F_SETLK): New variable.
  (fcntl-flock): Add 'wait?' keyword parameter; honor it.
* tests/utils.scm ("fcntl-flock non-blocking"): New test.
9ea3ef26 — Ludovic Courtès 12 years ago
utils: 'fcntl-flock' passes an errno when throwing an exception.

* guix/utils.scm (%libc-errno-pointer, errno): New procedures.
  (fcntl-flock): Use it as the exception's argument.
200a97e6 — Ludovic Courtès 12 years ago
Merge branch 'master' into core-updates
2cd5c038 — Ludovic Courtès 12 years ago
utils: Add 'fcntl-flock'.

* guix/utils.scm (%struct-flock, F_SETLKW, F_xxLCK): New variables.
  (fcntl-flock): New procedure.
* tests/utils.scm ("fcntl-flock"): New test.
2f265602 — Ludovic Courtès 12 years ago
Merge branch 'master' into core-updates
Next