From 29a686688674dc875775305312513405fa396a06 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 5 Jan 2018 17:15:41 +0100 Subject: daemon: Add gzip log compression. * nix/nix-daemon/guix-daemon.cc (GUIX_OPT_LOG_COMPRESSION): New macro. (options): Mark "disable-log-compression" as hidden and add "log-compression". (parse_opt): Handle GUIX_OPT_LOG_COMPRESSION. * nix/libstore/build.cc (DerivationGoal): Add 'gzLogFile'. (openLogFile): Initialize it when 'logCompression' is COMPRESSION_GZIP. (closeLogFile, handleChildOutput): Honor 'gzLogFile'. * nix/libstore/globals.hh (Settings)[compressLog]: Remove. [logCompression]: New field. (CompressionType): New enum. * nix/libstore/globals.cc (Settings::Settings): Initialize it. (update): Remove '_get' call for 'compressLog'. * nix/local.mk (guix_daemon_LDADD, guix_register_LDADD): Add -lz. * guix/store.scm (log-file): Handle '.gz' log files. * tests/guix-daemon.sh: Add test with '--log-compression=gzip'. * doc/guix.texi (Invoking guix-daemon): Adjust accordingly. * config-daemon.ac: Check for libz and zlib.h. --- tests/guix-daemon.sh | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'tests/guix-daemon.sh') diff --git a/tests/guix-daemon.sh b/tests/guix-daemon.sh index 7212e3eb68..6f91eb58bf 100644 --- a/tests/guix-daemon.sh +++ b/tests/guix-daemon.sh @@ -1,5 +1,5 @@ # GNU Guix --- Functional package management for GNU -# Copyright © 2012, 2014, 2015, 2016, 2017 Ludovic Courtès +# Copyright © 2012, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès # # This file is part of GNU Guix. # @@ -193,3 +193,39 @@ do GUIX_DAEMON_SOCKET="$socket" guile -c "$client_code" kill "$daemon_pid" done + +# Log compression. + +guix-daemon --listen="$socket" --disable-chroot --debug --log-compression=gzip & +daemon_pid=$! + +stamp="compressed-build-log-test-$$-`date +%H%M%S`" +client_code=" + (use-modules (guix) (gnu packages bootstrap)) + + (with-store store + (run-with-store store + (mlet %store-monad ((drv (lower-object + (computed-file \"compressed-log-test\" + #~(begin + (display \"$stamp\") + (newline) + (mkdir #\$output)) + #:guile %bootstrap-guile)))) + (display (derivation-file-name drv)) + (newline) + (return #t)))) +" + +GUIX_DAEMON_SOCKET="$socket" +export GUIX_DAEMON_SOCKET + +drv=`guile -c "$client_code"` +guix build "$drv" + +log=`guix build "$drv" --log-file` +test -f "$log" +case "$log" in + *.gz) test "`gunzip -c < "$log"`" = "$stamp" ;; + *) false ;; +esac -- cgit v1.2.3