summaryrefslogtreecommitdiff
path: root/tests/publish.scm
Commit message (Collapse)AuthorAge
* publish: '--compression' can be repeated.Ludovic Courtès2019-06-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows 'guix publish' to compress and advertise multiple compression methods from which users can choose. * guix/scripts/publish.scm (actual-compression): Rename to... (actual-compressions): ... this. Expect REQUESTED to be a list, and always return a list. (%default-options): Remove 'compression. (store-item->recutils): New procedure. (narinfo-string): Change #:compression to #:compressions (plural). Adjust accordingly. (render-narinfo, render-narinfo/cached): Likewise. (bake-narinfo+nar): Change #:compression to #:compressions. [compressed-nar-size]: New procedure. Call 'compress-nar' for each item returned by 'actual-compressions'. Create a narinfo for each compression. (effective-compression): New procedure. (make-request-handler): Change #:compression to #:compressions. Use 'effective-compression' to determine the applicable compression. (guix-publish): Adjust handling of '--compression'. Print a message for each compression that is enabled. * tests/publish.scm ("/*.narinfo"): Adjust to new narinfo field ordering. ("/*.narinfo with properly encoded '+' sign"): Likewise. ("/*.narinfo with lzip + gzip"): New test. ("with cache, lzip + gzip"): New test. * doc/guix.texi (Invoking guix publish): Document it.
* publish: Add support for lzip.Ludovic Courtès2019-05-27
| | | | | | | | | | | | | | | * guix/scripts/publish.scm (show-help, %options): Support '-C METHOD' and '-C METHOD:LEVEL'. (default-compression): New procedure. (bake-narinfo+nar): Add lzip. (nar-response-port): Likewise. (string->compression-type): New procedure. (make-request-handler): Generalize /nar/gzip handler to handle /nar/lzip as well. * tests/publish.scm ("/nar/lzip/*"): New test. ("/*.narinfo with lzip compression"): New test. * doc/guix.texi (Invoking guix publish): Document it. (Requirements): Mention lzlib.
* publish: Maintain a hash-part-to-store-item mapping in cache.Ludovic Courtès2019-05-26
| | | | | | | | | | | Fixes <https://bugs.gnu.org/33897>. * guix/scripts/publish.scm (hash-part-mapping-cache-file) (hash-part->path*): New procedures. * guix/scripts/publish.scm (render-narinfo/cached)[delete-entry]: Delete the 'hash-part-mapping-cache-file'. Use 'hash-part->path*' instead of 'hash-part->path'. * tests/publish.scm ("with cache, vanishing item"): New test.
* Remove most uses of the _IO*F constants.Ludovic Courtès2019-01-09
| | | | | | | | | | | | | | | | | | | | | | | | These constants, for use with 'setvbuf', were deprecated in Guile 2.2 and disappeared in Guile 3.0. Here we keep these constants in build-side code where removing them is not feasible. * guix/build/download-nar.scm (download-nar): Adjust 'setvbuf' calls to the Guile 2.2+ API. * guix/build/download.scm (open-socket-for-uri): Likewise. (open-connection-for-uri, url-fetch): Likewise. * guix/build/make-bootstrap.scm (make-stripped-libc): Likewise. * guix/build/union.scm (setvbuf) [guile-2.0]: New conditional wrapper. (union-build): Adjust to new API. * guix/ftp-client.scm (ftp-open, ftp-list, ftp-retr): Likewise. * guix/http-client.scm (http-fetch): Likewise. * guix/inferior.scm (proxy): Likewise. * guix/scripts/substitute.scm (fetch, http-multiple-get): Likewise. * guix/self.scm (compiled-modules): Likewise. * guix/ssh.scm (remote-daemon-channel, store-import-channel) (store-export-channel): Likewise. * guix/ui.scm (initialize-guix): Likewise. * tests/publish.scm (http-get-port): Likewise. * guix/store.scm (%newlines): Adjust comment.
* publish: Add a 'Cache-Control' header on /nar responses.Ludovic Courtès2018-12-17
| | | | | | | | | | | Fixes <https://bugs.gnu.org/33721>. Reported by Chris Marusich <cmmarusich@gmail.com>. * guix/scripts/publish.scm (render-nar/cached): Add #:ttl and honor it. (make-request-handler): Pass #:ttl to 'render-nar/cached'. * tests/publish.scm ("with cache, uncompressed"): Pass "--ttl=42h" to 'guix publish'. Check 'Cache-Control' on narinfo response and on nar response.
* Switch to Guile-Gcrypt.Ludovic Courtès2018-09-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes (guix hash) and (guix pk-crypto), which now live as part of Guile-Gcrypt (version 0.1.0.) * guix/gcrypt.scm, guix/hash.scm, guix/pk-crypto.scm, tests/hash.scm, tests/pk-crypto.scm: Remove. * configure.ac: Test for Guile-Gcrypt. Remove LIBGCRYPT and LIBGCRYPT_LIBDIR assignments. * m4/guix.m4 (GUIX_ASSERT_LIBGCRYPT_USABLE): Remove. * README: Add Guile-Gcrypt to the dependencies; move libgcrypt as "required unless --disable-daemon". * doc/guix.texi (Requirements): Likewise. * gnu/packages/bash.scm, guix/derivations.scm, guix/docker.scm, guix/git.scm, guix/http-client.scm, guix/import/cpan.scm, guix/import/cran.scm, guix/import/crate.scm, guix/import/elpa.scm, guix/import/gnu.scm, guix/import/hackage.scm, guix/import/texlive.scm, guix/import/utils.scm, guix/nar.scm, guix/pki.scm, guix/scripts/archive.scm, guix/scripts/authenticate.scm, guix/scripts/download.scm, guix/scripts/hash.scm, guix/scripts/pack.scm, guix/scripts/publish.scm, guix/scripts/refresh.scm, guix/scripts/substitute.scm, guix/store.scm, guix/store/deduplication.scm, guix/tests.scm, tests/base32.scm, tests/builders.scm, tests/challenge.scm, tests/cpan.scm, tests/crate.scm, tests/derivations.scm, tests/gem.scm, tests/nar.scm, tests/opam.scm, tests/pki.scm, tests/publish.scm, tests/pypi.scm, tests/store-deduplication.scm, tests/store.scm, tests/substitute.scm: Adjust imports. * gnu/system/vm.scm: Likewise. (guile-sqlite3&co): Rename to... (gcrypt-sqlite3&co): ... this. Add GUILE-GCRYPT. (expression->derivation-in-linux-vm)[config]: Remove. (iso9660-image)[config]: Remove. (qemu-image)[config]: Remove. (system-docker-image)[config]: Remove. * guix/scripts/pack.scm: Adjust imports. (guile-sqlite3&co): Rename to... (gcrypt-sqlite3&co): ... this. Add GUILE-GCRYPT. (self-contained-tarball)[build]: Call 'make-config.scm' without #:libgcrypt argument. (squashfs-image)[libgcrypt]: Remove. [build]: Call 'make-config.scm' without #:libgcrypt. (docker-image)[config, json]: Remove. [build]: Add GUILE-GCRYPT to the extensions Remove (guix config) from the imported modules. * guix/self.scm (specification->package): Remove "libgcrypt", add "guile-gcrypt". (compiled-guix): Remove #:libgcrypt. [guile-gcrypt]: New variable. [dependencies]: Add it. [*core-modules*]: Remove #:libgcrypt from 'make-config.scm' call. Add #:extensions. [*config*]: Remove #:libgcrypt from 'make-config.scm' call. (%dependency-variables): Remove %libgcrypt. (make-config.scm): Remove #:libgcrypt. * build-aux/build-self.scm (guile-gcrypt): New variable. (make-config.scm): Remove #:libgcrypt. (build-program)[fake-gcrypt-hash]: New variable. Add (gcrypt hash) to the imported modules. Adjust load path assignments. * gnu/packages/package-management.scm (guix)[propagated-inputs]: Add GUILE-GCRYPT. [arguments]: In 'wrap-program' phase, add GUILE-GCRYPT to the search path.
* publish: Always build a new derivation for the "/log/NAME" test.Ludovic Courtès2018-03-22
| | | | | | | Fixes <https://bugs.gnu.org/30868>. Reported by Martin Castillo <castilma@uni-bremen.de>. * tests/publish.scm ("/log/NAME"): Use #$(random-text) in the builder.
* publish: Add test for non-GET queries.Ludovic Courtès2018-03-22
| | | | * tests/publish.scm ("non-GET query"): New test.
* publish: Restore gzip compression in cache-less mode.Ludovic Courtès2018-01-22
| | | | | | | | | | Fixes <https://bugs.gnu.org/30184>. Regression introduced in 297e04d66010ada31a40f40143d81bf6b62affcc. Reported by Christopher Baines <mail@cbaines.net>. * guix/scripts/publish.scm (nar-response-port): Add 'compression' parameter and honor it. (http-write): Get 'x-nar-compression' from the initial RESPONSE.
* publish: Publish build logs.Ludovic Courtès2018-01-07
| | | | | | | | * guix/scripts/publish.scm (render-log-file): New procedure. (make-request-handler): Add "log" case. * tests/publish.scm ("/log/NAME") ("/log/NAME not found"): New tests. * doc/guix.texi (Invoking guix publish): Document /log URLs.
* tests: Avoid double slash in URIs.Ludovic Courtès2017-12-01
| | | | | * tests/publish.scm ("with cache"): Remove extra slash in NAR-URL. This would lead to a 'uri-error' exception on Guile 2.2.3.
* publish: Cache uncompressed nars as well.Ludovic Courtès2017-10-05
| | | | | | | | | | | | Fixes <https://bugs.gnu.org/28664>. Reported by Maxim Cournoyer <maxim.cournoyer@gmail.com>. * guix/scripts/publish.scm (bake-narinfo+nar): When COMPRESSION is 'none, write NAR instead of doing nothing. (make-request-handler): Use 'render-nar/cached' for /nar URLs with no compression. * tests/publish.scm ("with cache", "with cache, uncompressed"): Adjust expected result accordingly.
* publish: Fix narinfo rendering for already-compressed items.Ludovic Courtès2017-05-18
| | | | | | | | | | | Fixes <http://bugs.gnu.org/26975>. Reported by Mark H Weaver <mhw@netris.org>. * guix/scripts/publish.scm (bake-narinfo+nar): Pass #f as the 2nd argument to 'stat' and properly handle #f. * tests/publish.scm (wait-for-file): New procedure. ("with cache"): Remove 'wait-for-file' procedure. ("with cache, uncompressed"): New test.
* publish: Advertise a short TTL for "baking" 404s.Ludovic Courtès2017-05-11
| | | | | | | * guix/scripts/publish.scm (not-found): Add #:phrase and #:ttl parameters and honor them. * tests/publish.scm ("with cache"): Check the 'cache-control' header on of the 404 response.
* publish: Produce a "FileSize" narinfo field when possible.Ludovic Courtès2017-05-01
| | | | | | | | | | * guix/scripts/publish.scm (narinfo-string): Add #:file-size parameter. Produce a "FileSize" field when COMPRESSION is eq? to '%no-compression' or when FILE-SIZE is true. (bake-narinfo+nar): Pass #:file-size. * tests/publish.scm ("/*.narinfo") ("/*.narinfo with properly encoded '+' sign") ("with cache"): Check for "FileSize".
* publish: Add '--cache' and '--workers'.Ludovic Courtès2017-04-18
| | | | | | | | | | | | | | | | | | | | | | | Fixes <http://bugs.gnu.org/26201>. Reported by <dian_cecht@zoho.com>. These options allow nars to be "baked" off-line and cached instead of being compressed on the fly. As a side-effect, this allows us to provide a 'Content-Length' header for nars. * guix/scripts/publish.scm (show-help, %options): Add '--cache' and '--workers'. (%default-options): Add 'workers'. (nar-cache-file, narinfo-cache-file, run-single-baker): New procedures. (single-baker): New macro. (render-narinfo/cached, bake-narinfo+nar) (render-nar/cached): New procedures. (make-request-handler): Add #:cache and #:pool parameters and honor them. (run-publish-server): Likewise. (guix-publish): Honor '--cache' and '--workers'. * tests/publish.scm ("with cache"): New test. * doc/guix.texi (Invoking guix publish): Document it.
* publish: Make the nar URL prefix a parameter.Ludovic Courtès2017-03-22
| | | | | | | | * guix/scripts/publish.scm (narinfo-string): Add #:nar-path and honor it. (render-narinfo): Likewise. (make-request-handler): Likewise. (run-publish-server): Likewise. * tests/publish.scm ("custom nar path"): New test.
* publish: The public and private keys are now SRFI-39 parameters.Ludovic Courtès2017-03-22
| | | | | | | | | | | | * guix/scripts/publish.scm (%default-options): Add 'public-key-file' and 'private-key-file'. (lazy-read-file-sexp): Remove. (%private-key, %public-key): Turn into SRFI-39 parameters. (signed-string, render-narinfo): Adjust accordingly. (guix-publish): Honor 'public-key-file' and 'private-key-file' from OPTS. Use 'parameterize'. * guix/pk-crypto.scm (read-file-sexp): New procedure. * tests/publish.scm: Initialize '%public-key' and '%private-key'.
* tests: Make sure threads use separate output ports.Ludovic Courtès2016-08-02
| | | | | | * tests/publish.scm (with-separate-output-ports): New macro. <top level>: Use it when spawning new thread. ("/*.narinfo with compression"): Likewise.
* tests: Work around Guile bug with unbuffered custom binary input ports.Ludovic Courtès2016-08-02
| | | | | | | | Reported by Chris Marusich <cmmarusich@gmail.com> at <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=24060#19> * tests/publish.scm (http-get-port): Remove 'setvbuf' call for the response port.
* 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.
* tests: Use unbuffered input ports when decompressing from 'guix publish'.Ludovic Courtès2016-07-27
| | | | | | | | Fixes <http://bugs.gnu.org/24060>. Reported by Chris Marusich <cmmarusich@gmail.com>. * tests/publish.scm (http-get-port): Explicitly call 'open-socket-for-uri' and add calls to 'setvbuf'.
* publish: Handle '/file' URLs, for content-addressed files.Ludovic Courtès2016-07-20
| | | | | | | | | | * guix/scripts/publish.scm (render-content-addressed-file): New procedure. (http-write): Add 'application/octet-stream' case. (make-request-handler): Add /file/NAME/sha256/HASH URLs. * tests/publish.scm ("/file/NAME/sha256/HASH") ("/file/NAME/sha256/INVALID-NIX-BASE32-STRING") ("/file/NAME/sha256/INVALID-HASH"): New tests. * doc/guix.texi (Invoking guix publish): Mention the /file URLs.
* publish: Add '--compression'.Ludovic Courtès2016-07-19
| | | | | | | | | | | | | | | | | | | | | | | * guix/scripts/publish.scm (show-help, %options): Add '--compression'. (<compression>): New record type. (%no-compression, %default-gzip-compression): New variables. (%default-options): Add 'compression' key. (narinfo-string): Add #:compression parameter and honor it. (render-narinfo): Likewise. (render-nar): Likewise. <top level>: Add call to 'declare-header!'. (swallow-zlib-error): New macro. (nar-response-port): New procedure. (http-write): Add call to 'force-output'. Use 'nar-response-port' instead of 'response-port'. Use 'swallow-zlib-error'. (make-request-handler): Add #:compression parameter and honor it. Add "nar/gzip" URL handler. (run-publish-server): Add #:compression parameter and honor it. (guix-publish): Honor --compression. * tests/publish.scm (http-get-port, wait-until-ready): New procedures. <top level>: Run main server with "-C0". Call 'wait-until-ready'. ("/nar/gzip/*", "/*.narinfo with compression"): New tests. * doc/guix.texi (Invoking guix publish): Document it.
* publish: Encore URIs that appear in narinfos.Ludovic Courtès2016-06-08
| | | | | | | | | | Fixes <http://bugs.gnu.org/21888>. Reported by iyzsong@member.fsf.org (宋文武). * guix/scripts/publish.scm (narinfo-string): Use 'encode-and-join-uri-path' instead of 'string-append' to compute URL. * tests/publish.scm ("/*.narinfo with properly encoded '+' sign"): ("/nar/ with properly encoded '+' sign"): New tests.
* build: Add a Guile custom test driver using SRFI-64.Mathieu Lirzin2016-04-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before that '.log' files for scheme tests were fragmented and not included in test-suite.log. This unifies the semantics of SRFI-64 API with Automake test suite. * build-aux/test-driver.scm: New file. * Makefile.am (SCM_LOG_DRIVER, AM_SCM_LOG_DRIVER_FLAGS): New variables. (SCM_LOG_COMPILER, AM_SCM_LOG_FLAGS): Delete variables. (AM_TESTS_ENVIRONMENT): Set GUILE_AUTO_COMPILE to 0. * test-env.in: Silence guix-daemon. * doc/guix.texi (Running the Test Suite): Describe how to display the detailed results. Bug reports require only 'test-suite.log' file. * tests/base32.scm, tests/build-utils.scm, tests/builders.scm, tests/challenge.scm, tests/cpan.scm, tests/cpio.scm, tests/cran.scm, tests/cve.scm, tests/derivations.scm, tests/elpa.scm, tests/file-systems.scm, tests/gem.scm, tests/gexp.scm, tests/gnu-maintenance.scm, tests/grafts.scm, tests/graph.scm, tests/gremlin.scm, tests/hackage.scm, tests/hash.scm, tests/import-utils.scm, tests/lint.scm, tests/monads.scm, tests/nar.scm, tests/packages.scm, tests/pk-crypto.scm, tests/pki.scm, tests/profiles.scm, tests/publish.scm, tests/pypi.scm, tests/records.scm, tests/scripts-build.scm, tests/scripts.scm, tests/services.scm, tests/sets.scm, tests/size.scm, tests/snix.scm, tests/store.scm, tests/substitute.scm, tests/syscalls.scm, tests/system.scm, tests/ui.scm, tests/union.scm, tests/upstream.scm, tests/utils.scm: Don't exit at the end of test groups. * tests/containers.scm: Likewise. Use 'test-skip' instead of exiting with error code 77.
* publish: Do not publish nars for invalid store items.Ludovic Courtès2016-02-25
| | | | | | | | | | | Before that, /nar requests could succeed if the requested store item exists but is invalid (although such requests were unlikely because the corresponding narinfo request would have failed.) * guix/scripts/publish.scm (render-nar): Add 'store' parameter. Use 'valid-path?' instead of 'file-exists?'. (make-request-handler): Adjust 'render-nar' call accordingly. * tests/publish.scm ("/nar/invalid"): New test.
* tests: Prevent 'http_proxy' from breaking Web server tests.Ludovic Courtès2016-01-22
| | | | | * tests/lint.scm: Add call to 'unsetenv' to remove 'http_proxy'. * tests/publish.scm: Likewise.
* tests: Fix 'publish' test for nix-base32 format.Alex Kost2015-07-18
| | | | | | | This is a followup to commit 3b307162e892e0050836434b12e14376758419cc. * tests/publish.scm ("/*.narinfo"): Use 'bytevector->nix-base32-string', not 'bytevector->base32-string'.
* scripts: Add 'publish' command.David Thompson2015-04-04
* guix/scripts/publish.scm: New file. * po/guix/POTFILES.in: Add it. * tests/publish.scm: New file. * Makefile.am (MODULES): Add script module. (SCM_TESTS): Add test module. * doc/guix.texi ("Invoking guix publish"): New node.