2015-03-17 10:21:31 -04:00
|
|
|
|
;;; GNU Guix --- Functional package management for GNU
|
|
|
|
|
;;; Copyright © 2015 David Thompson <davet@gnu.org>
|
2020-10-20 16:32:02 -04:00
|
|
|
|
;;; Copyright © 2020 by Amar M. Singh <nly@disroot.org>
|
2022-02-09 12:36:35 -05:00
|
|
|
|
;;; Copyright © 2015-2022 Ludovic Courtès <ludo@gnu.org>
|
2020-11-10 16:59:13 -05:00
|
|
|
|
;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
2021-03-29 06:18:03 -04:00
|
|
|
|
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
|
2021-08-31 07:31:57 -04:00
|
|
|
|
;;; Copyright © 2021 Mathieu Othacehe <othacehe@gnu.org>
|
2015-03-17 10:21:31 -04:00
|
|
|
|
;;;
|
|
|
|
|
;;; This file is part of GNU Guix.
|
|
|
|
|
;;;
|
|
|
|
|
;;; GNU Guix is free software; you can redistribute it and/or modify it
|
|
|
|
|
;;; under the terms of the GNU General Public License as published by
|
|
|
|
|
;;; the Free Software Foundation; either version 3 of the License, or (at
|
|
|
|
|
;;; your option) any later version.
|
|
|
|
|
;;;
|
|
|
|
|
;;; GNU Guix is distributed in the hope that it will be useful, but
|
|
|
|
|
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;;; GNU General Public License for more details.
|
|
|
|
|
;;;
|
|
|
|
|
;;; You should have received a copy of the GNU General Public License
|
|
|
|
|
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
(define-module (guix scripts publish)
|
|
|
|
|
#:use-module ((system repl server) #:prefix repl:)
|
|
|
|
|
#:use-module (ice-9 binary-ports)
|
|
|
|
|
#:use-module (ice-9 format)
|
2021-08-13 06:30:29 -04:00
|
|
|
|
#:use-module (ice-9 iconv)
|
2015-03-17 10:21:31 -04:00
|
|
|
|
#:use-module (ice-9 match)
|
2021-05-20 04:42:56 -04:00
|
|
|
|
#:use-module (ice-9 poll)
|
2015-03-17 10:21:31 -04:00
|
|
|
|
#:use-module (ice-9 regex)
|
2016-10-19 08:28:56 -04:00
|
|
|
|
#:use-module (ice-9 rdelim)
|
2017-04-17 17:13:40 -04:00
|
|
|
|
#:use-module (ice-9 threads)
|
2015-03-17 10:21:31 -04:00
|
|
|
|
#:use-module (rnrs bytevectors)
|
|
|
|
|
#:use-module (srfi srfi-1)
|
|
|
|
|
#:use-module (srfi srfi-2)
|
2016-07-18 17:58:34 -04:00
|
|
|
|
#:use-module (srfi srfi-9)
|
2015-07-19 18:37:47 -04:00
|
|
|
|
#:use-module (srfi srfi-9 gnu)
|
2016-06-09 17:33:20 -04:00
|
|
|
|
#:use-module (srfi srfi-19)
|
2015-03-17 10:21:31 -04:00
|
|
|
|
#:use-module (srfi srfi-26)
|
2016-07-20 10:54:31 -04:00
|
|
|
|
#:use-module (srfi srfi-34)
|
2015-03-17 10:21:31 -04:00
|
|
|
|
#:use-module (srfi srfi-37)
|
2022-04-06 05:20:21 -04:00
|
|
|
|
#:use-module (srfi srfi-71)
|
2015-03-17 10:21:31 -04:00
|
|
|
|
#:use-module (web http)
|
|
|
|
|
#:use-module (web request)
|
|
|
|
|
#:use-module (web response)
|
|
|
|
|
#:use-module (web server)
|
|
|
|
|
#:use-module (web uri)
|
2017-04-19 17:39:27 -04:00
|
|
|
|
#:autoload (sxml simple) (sxml->xml)
|
2020-11-29 12:05:11 -05:00
|
|
|
|
#:autoload (guix avahi) (avahi-publish-service-thread)
|
2015-03-17 10:21:31 -04:00
|
|
|
|
#:use-module (guix base32)
|
|
|
|
|
#:use-module (guix base64)
|
|
|
|
|
#:use-module (guix config)
|
|
|
|
|
#:use-module (guix derivations)
|
Switch to Guile-Gcrypt.
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.
2018-08-31 11:07:07 -04:00
|
|
|
|
#:use-module (gcrypt hash)
|
2015-03-17 10:21:31 -04:00
|
|
|
|
#:use-module (guix pki)
|
Switch to Guile-Gcrypt.
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.
2018-08-31 11:07:07 -04:00
|
|
|
|
#:use-module (gcrypt pk-crypto)
|
2017-04-17 17:13:40 -04:00
|
|
|
|
#:use-module (guix workers)
|
2015-03-17 10:21:31 -04:00
|
|
|
|
#:use-module (guix store)
|
2016-10-19 08:28:56 -04:00
|
|
|
|
#:use-module ((guix serialization) #:select (write-file))
|
Use "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.
2020-07-27 10:36:39 -04:00
|
|
|
|
#:use-module (zlib)
|
|
|
|
|
#:autoload (lzlib) (call-with-lzip-output-port
|
|
|
|
|
make-lzip-output-port)
|
2020-12-27 06:10:15 -05:00
|
|
|
|
#:autoload (zstd) (call-with-zstd-output-port
|
|
|
|
|
make-zstd-output-port)
|
2017-04-18 17:12:35 -04:00
|
|
|
|
#:use-module (guix cache)
|
2015-03-17 10:21:31 -04:00
|
|
|
|
#:use-module (guix ui)
|
2015-09-10 05:37:36 -04:00
|
|
|
|
#:use-module (guix scripts)
|
2017-04-17 17:13:40 -04:00
|
|
|
|
#:use-module ((guix utils)
|
|
|
|
|
#:select (with-atomic-file-output compressed-file?))
|
2017-04-18 17:12:35 -04:00
|
|
|
|
#:use-module ((guix build utils)
|
|
|
|
|
#:select (dump-port mkdir-p find-files))
|
2017-05-28 10:09:32 -04:00
|
|
|
|
#:use-module ((guix build syscalls) #:select (set-thread-name))
|
2020-11-04 08:40:08 -05:00
|
|
|
|
#:export (%default-gzip-compression
|
|
|
|
|
|
|
|
|
|
%public-key
|
2017-03-22 04:50:06 -04:00
|
|
|
|
%private-key
|
2020-01-16 04:43:29 -05:00
|
|
|
|
signed-string
|
2017-03-22 04:50:06 -04:00
|
|
|
|
|
2020-11-04 08:40:08 -05:00
|
|
|
|
open-server-socket
|
2020-11-22 09:15:17 -05:00
|
|
|
|
publish-service-type
|
2020-11-04 08:40:08 -05:00
|
|
|
|
run-publish-server
|
2017-03-22 04:50:06 -04:00
|
|
|
|
guix-publish))
|
2015-03-17 10:21:31 -04:00
|
|
|
|
|
|
|
|
|
(define (show-help)
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(format #t (G_ "Usage: guix publish [OPTION]...
|
2015-03-17 10:21:31 -04:00
|
|
|
|
Publish ~a over HTTP.\n") %store-directory)
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(display (G_ "
|
2015-03-17 10:21:31 -04:00
|
|
|
|
-p, --port=PORT listen on PORT"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(display (G_ "
|
2015-05-12 15:20:19 -04:00
|
|
|
|
--listen=HOST listen on the network interface for HOST"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(display (G_ "
|
2015-05-12 05:41:55 -04:00
|
|
|
|
-u, --user=USER change privileges to USER as soon as possible"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(display (G_ "
|
2020-11-22 09:15:17 -05:00
|
|
|
|
-a, --advertise advertise on the local network"))
|
|
|
|
|
(display (G_ "
|
2019-05-24 02:26:38 -04:00
|
|
|
|
-C, --compression[=METHOD:LEVEL]
|
|
|
|
|
compress archives with METHOD at LEVEL"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(display (G_ "
|
2017-04-17 17:13:40 -04:00
|
|
|
|
-c, --cache=DIRECTORY cache published items to DIRECTORY"))
|
2020-10-24 10:31:18 -04:00
|
|
|
|
(display (G_ "
|
|
|
|
|
--cache-bypass-threshold=SIZE
|
|
|
|
|
serve store items below SIZE even when not cached"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(display (G_ "
|
2017-04-17 17:13:40 -04:00
|
|
|
|
--workers=N use N workers to bake items"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(display (G_ "
|
2016-06-09 17:33:20 -04:00
|
|
|
|
--ttl=TTL announce narinfos can be cached for TTL seconds"))
|
2021-05-11 09:01:00 -04:00
|
|
|
|
(display (G_ "
|
|
|
|
|
--negative-ttl=TTL announce missing narinfos can be cached for TTL seconds"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(display (G_ "
|
2017-03-22 09:00:06 -04:00
|
|
|
|
--nar-path=PATH use PATH as the prefix for nar URLs"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(display (G_ "
|
2017-03-22 06:26:05 -04:00
|
|
|
|
--public-key=FILE use FILE as the public key for signatures"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(display (G_ "
|
2017-03-22 06:26:05 -04:00
|
|
|
|
--private-key=FILE use FILE as the private key for signatures"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(display (G_ "
|
2015-03-17 10:21:31 -04:00
|
|
|
|
-r, --repl[=PORT] spawn REPL server on PORT"))
|
|
|
|
|
(newline)
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(display (G_ "
|
2015-03-17 10:21:31 -04:00
|
|
|
|
-h, --help display this help and exit"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(display (G_ "
|
2015-03-17 10:21:31 -04:00
|
|
|
|
-V, --version display version information and exit"))
|
|
|
|
|
(newline)
|
|
|
|
|
(show-bug-report-information))
|
|
|
|
|
|
2015-05-12 15:20:19 -04:00
|
|
|
|
(define (getaddrinfo* host)
|
|
|
|
|
"Like 'getaddrinfo', but properly report errors."
|
|
|
|
|
(catch 'getaddrinfo-error
|
|
|
|
|
(lambda ()
|
|
|
|
|
(getaddrinfo host))
|
|
|
|
|
(lambda (key error)
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(leave (G_ "lookup of host '~a' failed: ~a~%")
|
2015-05-12 15:20:19 -04:00
|
|
|
|
host (gai-strerror error)))))
|
|
|
|
|
|
2016-07-18 17:58:34 -04:00
|
|
|
|
;; Nar compression parameters.
|
|
|
|
|
(define-record-type <compression>
|
|
|
|
|
(compression type level)
|
|
|
|
|
compression?
|
|
|
|
|
(type compression-type)
|
|
|
|
|
(level compression-level))
|
|
|
|
|
|
|
|
|
|
(define %no-compression
|
|
|
|
|
(compression 'none 0))
|
|
|
|
|
|
|
|
|
|
(define %default-gzip-compression
|
|
|
|
|
;; Since we compress on the fly, default to fast compression.
|
|
|
|
|
(compression 'gzip 3))
|
|
|
|
|
|
2019-05-24 02:26:38 -04:00
|
|
|
|
(define (default-compression type)
|
|
|
|
|
(compression type 3))
|
|
|
|
|
|
2019-05-30 12:36:37 -04:00
|
|
|
|
(define (actual-compressions item requested)
|
|
|
|
|
"Return the actual compressions used for ITEM, which may be %NO-COMPRESSION
|
2017-04-17 17:11:28 -04:00
|
|
|
|
if ITEM is already compressed."
|
|
|
|
|
(if (compressed-file? item)
|
2019-05-30 12:36:37 -04:00
|
|
|
|
(list %no-compression)
|
2017-04-17 17:11:28 -04:00
|
|
|
|
requested))
|
|
|
|
|
|
2020-10-24 10:31:18 -04:00
|
|
|
|
(define (low-compression c)
|
|
|
|
|
"Return <compression> of the same type as C, but optimized for low CPU
|
|
|
|
|
usage."
|
|
|
|
|
(compression (compression-type c)
|
|
|
|
|
(min (compression-level c) 2)))
|
|
|
|
|
|
2015-03-17 10:21:31 -04:00
|
|
|
|
(define %options
|
|
|
|
|
(list (option '(#\h "help") #f #f
|
|
|
|
|
(lambda _
|
|
|
|
|
(show-help)
|
|
|
|
|
(exit 0)))
|
|
|
|
|
(option '(#\V "version") #f #f
|
|
|
|
|
(lambda _
|
|
|
|
|
(show-version-and-exit "guix publish")))
|
2020-11-22 09:15:17 -05:00
|
|
|
|
(option '(#\a "advertise") #f #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(alist-cons 'advertise? #t result)))
|
2015-05-12 05:41:55 -04:00
|
|
|
|
(option '(#\u "user") #t #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(alist-cons 'user arg result)))
|
2015-03-17 10:21:31 -04:00
|
|
|
|
(option '(#\p "port") #t #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(alist-cons 'port (string->number* arg) result)))
|
2015-05-12 15:20:19 -04:00
|
|
|
|
(option '("listen") #t #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(match (getaddrinfo* arg)
|
|
|
|
|
((info _ ...)
|
|
|
|
|
(alist-cons 'address (addrinfo:addr info)
|
|
|
|
|
result))
|
|
|
|
|
(()
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(leave (G_ "lookup of host '~a' returned nothing")
|
2015-05-12 15:20:19 -04:00
|
|
|
|
name)))))
|
2016-07-18 17:58:34 -04:00
|
|
|
|
(option '(#\C "compression") #f #t
|
|
|
|
|
(lambda (opt name arg result)
|
2019-05-24 02:26:38 -04:00
|
|
|
|
(let* ((colon (string-index arg #\:))
|
|
|
|
|
(type (cond
|
|
|
|
|
(colon (string-take arg colon))
|
|
|
|
|
((string->number arg) "gzip")
|
|
|
|
|
(else arg)))
|
|
|
|
|
(level (if colon
|
|
|
|
|
(string->number*
|
|
|
|
|
(string-drop arg (+ 1 colon)))
|
|
|
|
|
(or (string->number arg) 3))))
|
|
|
|
|
(match level
|
|
|
|
|
(0
|
|
|
|
|
(alist-cons 'compression %no-compression result))
|
|
|
|
|
(level
|
|
|
|
|
(match (string->compression-type type)
|
|
|
|
|
((? symbol? type)
|
|
|
|
|
(alist-cons 'compression
|
|
|
|
|
(compression type level)
|
|
|
|
|
result))
|
|
|
|
|
(_
|
|
|
|
|
(warning (G_ "~a: unsupported compression type~%")
|
|
|
|
|
type)
|
|
|
|
|
result)))))))
|
2017-04-17 17:13:40 -04:00
|
|
|
|
(option '(#\c "cache") #t #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(alist-cons 'cache arg result)))
|
2020-10-24 10:31:18 -04:00
|
|
|
|
(option '("cache-bypass-threshold") #t #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(alist-cons 'cache-bypass-threshold (size->number arg)
|
|
|
|
|
result)))
|
2017-04-17 17:13:40 -04:00
|
|
|
|
(option '("workers") #t #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(alist-cons 'workers (string->number* arg)
|
|
|
|
|
result)))
|
2016-06-09 17:33:20 -04:00
|
|
|
|
(option '("ttl") #t #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(let ((duration (string->duration arg)))
|
|
|
|
|
(unless duration
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(leave (G_ "~a: invalid duration~%") arg))
|
2016-06-09 17:33:20 -04:00
|
|
|
|
(alist-cons 'narinfo-ttl (time-second duration)
|
|
|
|
|
result))))
|
2021-05-11 09:01:00 -04:00
|
|
|
|
(option '("negative-ttl") #t #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(let ((duration (string->duration arg)))
|
|
|
|
|
(unless duration
|
|
|
|
|
(leave (G_ "~a: invalid duration~%") arg))
|
|
|
|
|
(alist-cons 'narinfo-negative-ttl (time-second duration)
|
|
|
|
|
result))))
|
2017-03-22 09:00:06 -04:00
|
|
|
|
(option '("nar-path") #t #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(alist-cons 'nar-path arg result)))
|
2017-03-22 06:26:05 -04:00
|
|
|
|
(option '("public-key") #t #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(alist-cons 'public-key-file arg result)))
|
|
|
|
|
(option '("private-key" "secret-key") #t #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(alist-cons 'private-key-file arg result)))
|
2015-03-17 10:21:31 -04:00
|
|
|
|
(option '(#\r "repl") #f #t
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
;; If port unspecified, use default Guile REPL port.
|
|
|
|
|
(let ((port (and arg (string->number* arg))))
|
|
|
|
|
(alist-cons 'repl (or port 37146) result))))))
|
|
|
|
|
|
|
|
|
|
(define %default-options
|
2015-05-12 15:20:19 -04:00
|
|
|
|
`((port . 8080)
|
2016-07-18 17:58:34 -04:00
|
|
|
|
|
2017-03-22 09:00:06 -04:00
|
|
|
|
;; By default, serve nars under "/nar".
|
|
|
|
|
(nar-path . "nar")
|
|
|
|
|
|
2017-03-22 04:50:06 -04:00
|
|
|
|
(public-key-file . ,%public-key-file)
|
|
|
|
|
(private-key-file . ,%private-key-file)
|
|
|
|
|
|
2017-04-17 17:13:40 -04:00
|
|
|
|
;; Default number of workers when caching is enabled.
|
|
|
|
|
(workers . ,(current-processor-count))
|
|
|
|
|
|
2015-05-12 15:20:19 -04:00
|
|
|
|
(address . ,(make-socket-address AF_INET INADDR_ANY 0))
|
2015-03-17 10:21:31 -04:00
|
|
|
|
(repl . #f)))
|
|
|
|
|
|
2017-03-22 04:50:06 -04:00
|
|
|
|
;; The key pair used to sign narinfos.
|
2015-03-17 10:21:31 -04:00
|
|
|
|
(define %private-key
|
2017-03-22 04:50:06 -04:00
|
|
|
|
(make-parameter #f))
|
2015-03-17 10:21:31 -04:00
|
|
|
|
(define %public-key
|
2017-03-22 04:50:06 -04:00
|
|
|
|
(make-parameter #f))
|
2015-03-17 10:21:31 -04:00
|
|
|
|
|
|
|
|
|
(define %nix-cache-info
|
|
|
|
|
`(("StoreDir" . ,%store-directory)
|
|
|
|
|
("WantMassQuery" . 0)
|
|
|
|
|
("Priority" . 100)))
|
|
|
|
|
|
2020-11-10 16:59:13 -05:00
|
|
|
|
;;; A common buffer size value used for the TCP socket SO_SNDBUF option and
|
|
|
|
|
;;; the gzip compressor buffer size.
|
|
|
|
|
(define %default-buffer-size
|
|
|
|
|
(* 208 1024))
|
|
|
|
|
|
|
|
|
|
(define %default-socket-options
|
|
|
|
|
;; List of options passed to 'setsockopt' when transmitting files.
|
|
|
|
|
(list (list SO_SNDBUF %default-buffer-size)))
|
|
|
|
|
|
|
|
|
|
(define* (configure-socket socket #:key (level SOL_SOCKET)
|
|
|
|
|
(options %default-socket-options))
|
|
|
|
|
"Apply multiple option tuples in OPTIONS to SOCKET, using LEVEL."
|
|
|
|
|
(for-each (cut apply setsockopt socket level <>)
|
|
|
|
|
options))
|
|
|
|
|
|
2015-03-17 10:21:31 -04:00
|
|
|
|
(define (signed-string s)
|
2020-01-16 04:43:29 -05:00
|
|
|
|
"Sign the hash of the string S with the daemon's key. Return a canonical
|
|
|
|
|
sexp for the signature."
|
2017-03-22 04:50:06 -04:00
|
|
|
|
(let* ((public-key (%public-key))
|
2015-03-17 10:21:31 -04:00
|
|
|
|
(hash (bytevector->hash-data (sha256 (string->utf8 s))
|
|
|
|
|
#:key-type (key-type public-key))))
|
2017-03-22 04:50:06 -04:00
|
|
|
|
(signature-sexp hash (%private-key) public-key)))
|
2015-03-17 10:21:31 -04:00
|
|
|
|
|
|
|
|
|
(define base64-encode-string
|
|
|
|
|
(compose base64-encode string->utf8))
|
|
|
|
|
|
2019-05-30 12:36:37 -04:00
|
|
|
|
(define* (store-item->recutils store-item
|
|
|
|
|
#:key
|
|
|
|
|
(nar-path "nar")
|
|
|
|
|
(compression %no-compression)
|
|
|
|
|
file-size)
|
|
|
|
|
"Return the 'Compression' and 'URL' fields of the narinfo for STORE-ITEM,
|
|
|
|
|
with COMPRESSION, starting at NAR-PATH."
|
|
|
|
|
(let ((url (encode-and-join-uri-path
|
|
|
|
|
`(,@(split-and-decode-uri-path nar-path)
|
|
|
|
|
,@(match compression
|
|
|
|
|
(($ <compression> 'none)
|
|
|
|
|
'())
|
|
|
|
|
(($ <compression> type)
|
|
|
|
|
(list (symbol->string type))))
|
|
|
|
|
,(basename store-item)))))
|
|
|
|
|
(format #f "URL: ~a~%Compression: ~a~%~@[FileSize: ~a~%~]"
|
|
|
|
|
url (compression-type compression) file-size)))
|
|
|
|
|
|
2021-08-09 02:35:32 -04:00
|
|
|
|
(define* (narinfo-string store store-path
|
2019-05-30 12:36:37 -04:00
|
|
|
|
#:key (compressions (list %no-compression))
|
|
|
|
|
(nar-path "nar") (file-sizes '()))
|
2016-02-24 07:00:11 -05:00
|
|
|
|
"Generate a narinfo key/value string for STORE-PATH; an exception is raised
|
2016-07-18 17:58:34 -04:00
|
|
|
|
if STORE-PATH is invalid. Produce a URL that corresponds to COMPRESSION. The
|
2017-05-01 11:24:41 -04:00
|
|
|
|
narinfo is signed with KEY. NAR-PATH specifies the prefix for nar URLs.
|
2019-05-30 12:36:37 -04:00
|
|
|
|
|
|
|
|
|
Optionally, FILE-SIZES is a list of compression/integer pairs, where the
|
|
|
|
|
integer is size in bytes of the compressed NAR; it informs the client of how
|
|
|
|
|
much needs to be downloaded."
|
2016-02-24 07:00:11 -05:00
|
|
|
|
(let* ((path-info (query-path-info store store-path))
|
2019-05-30 12:36:37 -04:00
|
|
|
|
(compressions (actual-compressions store-path compressions))
|
2015-07-17 18:14:04 -04:00
|
|
|
|
(hash (bytevector->nix-base32-string
|
2015-03-17 10:21:31 -04:00
|
|
|
|
(path-info-hash path-info)))
|
|
|
|
|
(size (path-info-nar-size path-info))
|
2019-05-30 12:36:37 -04:00
|
|
|
|
(file-sizes `((,%no-compression . ,size) ,@file-sizes))
|
2015-03-17 10:21:31 -04:00
|
|
|
|
(references (string-join
|
|
|
|
|
(map basename (path-info-references path-info))
|
|
|
|
|
" "))
|
2015-09-03 17:37:33 -04:00
|
|
|
|
(deriver (path-info-deriver path-info))
|
2015-03-17 10:21:31 -04:00
|
|
|
|
(base-info (format #f
|
2016-07-18 17:58:34 -04:00
|
|
|
|
"\
|
|
|
|
|
StorePath: ~a
|
2015-03-17 10:21:31 -04:00
|
|
|
|
NarHash: sha256:~a
|
|
|
|
|
NarSize: ~d
|
2019-05-30 12:36:37 -04:00
|
|
|
|
References: ~a~%"
|
|
|
|
|
store-path
|
|
|
|
|
hash size references))
|
2021-08-31 07:31:57 -04:00
|
|
|
|
;; Do not render a "Deriver" line if we are rendering info for a
|
|
|
|
|
;; derivation. Also do not render a "System" line that would be
|
|
|
|
|
;; expensive to compute and is currently unused.
|
2016-02-26 17:14:28 -05:00
|
|
|
|
(info (if (not deriver)
|
2015-09-03 17:37:33 -04:00
|
|
|
|
base-info
|
2021-09-02 06:00:02 -04:00
|
|
|
|
(format #f "~aDeriver: ~a~%"
|
|
|
|
|
base-info (basename deriver))))
|
2015-03-17 10:21:31 -04:00
|
|
|
|
(signature (base64-encode-string
|
|
|
|
|
(canonical-sexp->string (signed-string info)))))
|
2022-02-09 12:36:35 -05:00
|
|
|
|
(format #f "~aSignature: 1;~a;~a~%~{~a~}"
|
|
|
|
|
info (gethostname) signature
|
|
|
|
|
|
|
|
|
|
;; Move information about the actual nars
|
|
|
|
|
;; (URL/Compression/FileSize) *after* the normative part that is
|
|
|
|
|
;; signed. That makes it possible to alter these bits of the
|
|
|
|
|
;; narinfo without having to resign them.
|
|
|
|
|
(map (lambda (compression)
|
|
|
|
|
(let ((size (assoc-ref file-sizes
|
|
|
|
|
compression)))
|
|
|
|
|
(store-item->recutils store-path
|
|
|
|
|
#:file-size size
|
|
|
|
|
#:nar-path nar-path
|
|
|
|
|
#:compression
|
|
|
|
|
compression)))
|
|
|
|
|
compressions))))
|
2015-03-17 10:21:31 -04:00
|
|
|
|
|
2017-05-11 04:23:27 -04:00
|
|
|
|
(define* (not-found request
|
|
|
|
|
#:key (phrase "Resource not found")
|
|
|
|
|
ttl)
|
2015-03-17 10:21:31 -04:00
|
|
|
|
"Render 404 response for REQUEST."
|
2017-05-11 04:23:27 -04:00
|
|
|
|
(values (build-response #:code 404
|
|
|
|
|
#:headers (if ttl
|
|
|
|
|
`((cache-control (max-age . ,ttl)))
|
|
|
|
|
'()))
|
|
|
|
|
(string-append phrase ": "
|
2015-03-17 10:21:31 -04:00
|
|
|
|
(uri-path (request-uri request)))))
|
|
|
|
|
|
|
|
|
|
(define (render-nix-cache-info)
|
|
|
|
|
"Render server information."
|
|
|
|
|
(values '((content-type . (text/plain)))
|
|
|
|
|
(lambda (port)
|
|
|
|
|
(for-each (match-lambda
|
|
|
|
|
((key . value)
|
|
|
|
|
(format port "~a: ~a~%" key value)))
|
|
|
|
|
%nix-cache-info))))
|
|
|
|
|
|
2016-07-18 17:58:34 -04:00
|
|
|
|
(define* (render-narinfo store request hash
|
2019-05-30 12:36:37 -04:00
|
|
|
|
#:key ttl (compressions (list %no-compression))
|
2021-05-11 09:01:00 -04:00
|
|
|
|
(nar-path "nar") negative-ttl)
|
2016-06-09 17:33:20 -04:00
|
|
|
|
"Render metadata for the store path corresponding to HASH. If TTL is true,
|
|
|
|
|
advertise it as the maximum validity period (in seconds) via the
|
|
|
|
|
'Cache-Control' header. This allows 'guix substitute' to cache it for an
|
2017-03-22 08:31:54 -04:00
|
|
|
|
appropriate duration. NAR-PATH specifies the prefix for nar URLs."
|
2016-02-24 07:00:11 -05:00
|
|
|
|
(let ((store-path (hash-part->path store hash)))
|
|
|
|
|
(if (string-null? store-path)
|
2021-05-11 09:01:00 -04:00
|
|
|
|
(not-found request #:phrase "" #:ttl negative-ttl)
|
2021-08-13 06:30:29 -04:00
|
|
|
|
(values `((content-type . (application/x-nix-narinfo
|
|
|
|
|
(charset . "UTF-8")))
|
|
|
|
|
(x-nar-path . ,nar-path)
|
|
|
|
|
(x-narinfo-compressions . ,compressions)
|
2016-06-09 17:33:20 -04:00
|
|
|
|
,@(if ttl
|
|
|
|
|
`((cache-control (max-age . ,ttl)))
|
|
|
|
|
'()))
|
2021-08-13 06:30:29 -04:00
|
|
|
|
;; Do not call narinfo-string directly here as it is an
|
|
|
|
|
;; expensive call that could potentially block the main
|
|
|
|
|
;; thread. Instead, create the narinfo string in the
|
|
|
|
|
;; http-write procedure.
|
|
|
|
|
store-path))))
|
2016-07-18 17:58:34 -04:00
|
|
|
|
|
2017-04-17 17:13:40 -04:00
|
|
|
|
(define* (nar-cache-file directory item
|
|
|
|
|
#:key (compression %no-compression))
|
|
|
|
|
(string-append directory "/"
|
|
|
|
|
(symbol->string (compression-type compression))
|
|
|
|
|
"/" (basename item) ".nar"))
|
|
|
|
|
|
|
|
|
|
(define* (narinfo-cache-file directory item
|
|
|
|
|
#:key (compression %no-compression))
|
|
|
|
|
(string-append directory "/"
|
|
|
|
|
(symbol->string (compression-type compression))
|
|
|
|
|
"/" (basename item)
|
|
|
|
|
".narinfo"))
|
|
|
|
|
|
2019-05-25 19:18:53 -04:00
|
|
|
|
(define (hash-part-mapping-cache-file directory hash)
|
|
|
|
|
(string-append directory "/hashes/" hash))
|
|
|
|
|
|
2017-04-17 17:13:40 -04:00
|
|
|
|
(define run-single-baker
|
|
|
|
|
(let ((baking (make-weak-value-hash-table))
|
|
|
|
|
(mutex (make-mutex)))
|
|
|
|
|
(lambda (item thunk)
|
|
|
|
|
"Run THUNK, which is supposed to bake ITEM, but make sure only one
|
|
|
|
|
thread is baking ITEM at a given time."
|
|
|
|
|
(define selected?
|
|
|
|
|
(with-mutex mutex
|
|
|
|
|
(and (not (hash-ref baking item))
|
|
|
|
|
(begin
|
|
|
|
|
(hash-set! baking item (current-thread))
|
|
|
|
|
#t))))
|
|
|
|
|
|
|
|
|
|
(when selected?
|
|
|
|
|
(dynamic-wind
|
|
|
|
|
(const #t)
|
|
|
|
|
thunk
|
|
|
|
|
(lambda ()
|
|
|
|
|
(with-mutex mutex
|
|
|
|
|
(hash-remove! baking item))))))))
|
|
|
|
|
|
|
|
|
|
(define-syntax-rule (single-baker item exp ...)
|
|
|
|
|
"Bake ITEM by evaluating EXP, but make sure there's only one baker for ITEM
|
|
|
|
|
at a time."
|
|
|
|
|
(run-single-baker item (lambda () exp ...)))
|
|
|
|
|
|
|
|
|
|
|
2017-04-18 17:12:35 -04:00
|
|
|
|
(define (narinfo-files cache)
|
|
|
|
|
"Return the list of .narinfo files under CACHE."
|
|
|
|
|
(if (file-is-directory? cache)
|
|
|
|
|
(find-files cache
|
|
|
|
|
(lambda (file stat)
|
|
|
|
|
(string-suffix? ".narinfo" file)))
|
|
|
|
|
'()))
|
|
|
|
|
|
2017-07-21 11:02:19 -04:00
|
|
|
|
(define (nar-expiration-time ttl)
|
|
|
|
|
"Return the narinfo expiration time (in seconds since the Epoch). The
|
|
|
|
|
expiration time is +inf.0 when passed an item that is still in the store; in
|
|
|
|
|
other cases, it is the last-access time of the item plus TTL.
|
|
|
|
|
|
|
|
|
|
This policy allows us to keep cached nars that correspond to valid store
|
|
|
|
|
items. Failing that, we could eventually have to recompute them and return
|
|
|
|
|
404 in the meantime."
|
|
|
|
|
(let ((expiration-time (file-expiration-time ttl)))
|
|
|
|
|
(lambda (file)
|
|
|
|
|
(let ((item (string-append (%store-prefix) "/"
|
|
|
|
|
(basename file ".narinfo"))))
|
|
|
|
|
;; Note: We don't need to use 'valid-path?' here because FILE would
|
|
|
|
|
;; not exist if ITEM were not valid in the first place.
|
|
|
|
|
(if (file-exists? item)
|
|
|
|
|
+inf.0
|
|
|
|
|
(expiration-time file))))))
|
|
|
|
|
|
2019-05-25 19:18:53 -04:00
|
|
|
|
(define (hash-part->path* store hash cache)
|
2020-10-24 10:31:18 -04:00
|
|
|
|
"Like 'hash-part->path' but cache results under CACHE. This ensures we can
|
2019-05-25 19:18:53 -04:00
|
|
|
|
still map HASH to the corresponding store file name, even if said store item
|
|
|
|
|
vanished from the store in the meantime."
|
|
|
|
|
(let ((cached (hash-part-mapping-cache-file cache hash)))
|
|
|
|
|
(catch 'system-error
|
|
|
|
|
(lambda ()
|
|
|
|
|
(call-with-input-file cached read-string))
|
|
|
|
|
(lambda args
|
|
|
|
|
(if (= ENOENT (system-error-errno args))
|
|
|
|
|
(match (hash-part->path store hash)
|
|
|
|
|
("" "")
|
|
|
|
|
(result
|
|
|
|
|
(mkdir-p (dirname cached))
|
|
|
|
|
(call-with-output-file (string-append cached ".tmp")
|
|
|
|
|
(lambda (port)
|
|
|
|
|
(display result port)))
|
|
|
|
|
(rename-file (string-append cached ".tmp") cached)
|
|
|
|
|
result))
|
|
|
|
|
(apply throw args))))))
|
|
|
|
|
|
2020-10-24 10:31:18 -04:00
|
|
|
|
(define cache-bypass-threshold
|
|
|
|
|
;; Maximum size of a store item that may be served by the '/cached' handlers
|
|
|
|
|
;; below even when not in cache.
|
|
|
|
|
(make-parameter (* 10 (expt 2 20))))
|
|
|
|
|
|
|
|
|
|
(define (bypass-cache? store item)
|
|
|
|
|
"Return true if we allow ITEM to be downloaded before it is cached. ITEM is
|
|
|
|
|
interpreted as the basename of a store item."
|
|
|
|
|
(guard (c ((store-error? c) #f))
|
|
|
|
|
(< (path-info-nar-size (query-path-info store item))
|
|
|
|
|
(cache-bypass-threshold))))
|
|
|
|
|
|
2017-04-17 17:13:40 -04:00
|
|
|
|
(define* (render-narinfo/cached store request hash
|
2019-05-30 12:36:37 -04:00
|
|
|
|
#:key ttl (compressions (list %no-compression))
|
2021-05-11 09:01:00 -04:00
|
|
|
|
(nar-path "nar") negative-ttl
|
2017-04-17 17:13:40 -04:00
|
|
|
|
cache pool)
|
|
|
|
|
"Respond to the narinfo request for REQUEST. If the narinfo is available in
|
|
|
|
|
CACHE, then send it; otherwise, return 404 and \"bake\" that nar and narinfo
|
|
|
|
|
requested using POOL."
|
2017-04-18 17:12:35 -04:00
|
|
|
|
(define (delete-entry narinfo)
|
|
|
|
|
;; Delete NARINFO and the corresponding nar from CACHE.
|
2019-05-25 19:18:53 -04:00
|
|
|
|
(let* ((nar (string-append (string-drop-right narinfo
|
|
|
|
|
(string-length ".narinfo"))
|
|
|
|
|
".nar"))
|
|
|
|
|
(base (basename narinfo ".narinfo"))
|
|
|
|
|
(hash (string-take base (string-index base #\-)))
|
|
|
|
|
(mapping (hash-part-mapping-cache-file cache hash)))
|
2017-04-18 17:12:35 -04:00
|
|
|
|
(delete-file* narinfo)
|
2019-05-25 19:18:53 -04:00
|
|
|
|
(delete-file* nar)
|
|
|
|
|
(delete-file* mapping)))
|
2017-04-18 17:12:35 -04:00
|
|
|
|
|
2019-05-30 12:36:37 -04:00
|
|
|
|
(let* ((item (hash-part->path* store hash cache))
|
|
|
|
|
(compressions (actual-compressions item compressions))
|
|
|
|
|
(cached (and (not (string-null? item))
|
|
|
|
|
(narinfo-cache-file cache item
|
|
|
|
|
#:compression
|
|
|
|
|
(first compressions)))))
|
2017-04-17 17:13:40 -04:00
|
|
|
|
(cond ((string-null? item)
|
2021-05-11 09:01:00 -04:00
|
|
|
|
(not-found request #:ttl negative-ttl))
|
2017-04-17 17:13:40 -04:00
|
|
|
|
((file-exists? cached)
|
|
|
|
|
;; Narinfo is in cache, send it.
|
|
|
|
|
(values `((content-type . (application/x-nix-narinfo))
|
|
|
|
|
,@(if ttl
|
|
|
|
|
`((cache-control (max-age . ,ttl)))
|
|
|
|
|
'()))
|
|
|
|
|
(lambda (port)
|
|
|
|
|
(display (call-with-input-file cached
|
|
|
|
|
read-string)
|
|
|
|
|
port))))
|
2017-07-21 08:52:08 -04:00
|
|
|
|
((and (file-exists? item) ;cheaper than the 'valid-path?' RPC
|
|
|
|
|
(valid-path? store item))
|
2017-04-17 17:13:40 -04:00
|
|
|
|
;; Nothing in cache: bake the narinfo and nar in the background and
|
|
|
|
|
;; return 404.
|
|
|
|
|
(eventually pool
|
|
|
|
|
(single-baker item
|
2017-05-24 04:51:34 -04:00
|
|
|
|
;; Check whether CACHED has been produced in the meantime.
|
|
|
|
|
(unless (file-exists? cached)
|
|
|
|
|
(bake-narinfo+nar cache item
|
|
|
|
|
#:ttl ttl
|
2019-05-30 12:36:37 -04:00
|
|
|
|
#:compressions compressions
|
2017-05-24 04:51:34 -04:00
|
|
|
|
#:nar-path nar-path)))
|
2017-04-18 17:12:35 -04:00
|
|
|
|
|
|
|
|
|
(when ttl
|
|
|
|
|
(single-baker 'cache-cleanup
|
|
|
|
|
(maybe-remove-expired-cache-entries cache
|
|
|
|
|
narinfo-files
|
|
|
|
|
#:entry-expiration
|
2017-07-21 11:02:19 -04:00
|
|
|
|
(nar-expiration-time ttl)
|
2017-04-18 17:12:35 -04:00
|
|
|
|
#:delete-entry delete-entry
|
|
|
|
|
#:cleanup-period ttl))))
|
2020-10-24 10:31:18 -04:00
|
|
|
|
|
|
|
|
|
;; If ITEM passes 'bypass-cache?', render a temporary narinfo right
|
|
|
|
|
;; away, with a short TTL. The narinfo is temporary because it
|
|
|
|
|
;; lacks 'FileSize', for instance, which the cached narinfo will
|
|
|
|
|
;; have. Chances are that the nar will be baked by the time the
|
|
|
|
|
;; client asks for it.
|
|
|
|
|
(if (bypass-cache? store item)
|
|
|
|
|
(render-narinfo store request hash
|
|
|
|
|
#:ttl 300 ;temporary
|
|
|
|
|
#:nar-path nar-path
|
|
|
|
|
#:compressions compressions)
|
|
|
|
|
(not-found request
|
|
|
|
|
#:phrase "We're baking it"
|
|
|
|
|
#:ttl 300))) ;should be available within 5m
|
2017-04-17 17:13:40 -04:00
|
|
|
|
(else
|
2021-05-11 09:01:00 -04:00
|
|
|
|
(not-found request #:phrase "" #:ttl negative-ttl)))))
|
2017-04-17 17:13:40 -04:00
|
|
|
|
|
2019-05-29 05:38:17 -04:00
|
|
|
|
(define (compress-nar cache item compression)
|
|
|
|
|
"Save in directory CACHE the nar for ITEM compressed with COMPRESSION."
|
|
|
|
|
(define nar
|
|
|
|
|
(nar-cache-file cache item #:compression compression))
|
|
|
|
|
|
2020-12-27 06:10:15 -05:00
|
|
|
|
(define (write-compressed-file call-with-compressed-output-port)
|
|
|
|
|
;; Note: the file port gets closed along with the compressed port.
|
|
|
|
|
(call-with-compressed-output-port (open-output-file (string-append nar ".tmp"))
|
|
|
|
|
(lambda (port)
|
|
|
|
|
(write-file item port))
|
|
|
|
|
#:level (compression-level compression))
|
|
|
|
|
(rename-file (string-append nar ".tmp") nar))
|
|
|
|
|
|
2019-05-29 05:38:17 -04:00
|
|
|
|
(mkdir-p (dirname nar))
|
|
|
|
|
(match (compression-type compression)
|
|
|
|
|
('gzip
|
2020-12-27 06:10:15 -05:00
|
|
|
|
(write-compressed-file call-with-gzip-output-port))
|
2019-05-29 05:38:17 -04:00
|
|
|
|
('lzip
|
2020-12-27 06:10:15 -05:00
|
|
|
|
(write-compressed-file call-with-lzip-output-port))
|
|
|
|
|
('zstd
|
|
|
|
|
(write-compressed-file call-with-zstd-output-port))
|
2019-05-29 05:38:17 -04:00
|
|
|
|
('none
|
|
|
|
|
;; Cache nars even when compression is disabled so that we can
|
|
|
|
|
;; guarantee the TTL (see <https://bugs.gnu.org/28664>.)
|
|
|
|
|
(with-atomic-file-output nar
|
|
|
|
|
(lambda (port)
|
2020-11-08 17:35:45 -05:00
|
|
|
|
(write-file item port)
|
|
|
|
|
;; Make the file world-readable, contrary to what
|
|
|
|
|
;; 'with-atomic-file-output' does.
|
|
|
|
|
(chmod port (logand #o644 (lognot (umask)))))))))
|
2019-05-29 05:38:17 -04:00
|
|
|
|
|
2017-04-17 17:13:40 -04:00
|
|
|
|
(define* (bake-narinfo+nar cache item
|
2019-05-30 12:36:37 -04:00
|
|
|
|
#:key ttl (compressions (list %no-compression))
|
2017-04-17 17:13:40 -04:00
|
|
|
|
(nar-path "/nar"))
|
|
|
|
|
"Write the narinfo and nar for ITEM to CACHE."
|
2019-05-30 12:36:37 -04:00
|
|
|
|
(define (compressed-nar-size compression)
|
|
|
|
|
(let* ((nar (nar-cache-file cache item #:compression compression))
|
|
|
|
|
(stat (stat nar #f)))
|
|
|
|
|
(and stat
|
|
|
|
|
(cons compression (stat:size stat)))))
|
|
|
|
|
|
|
|
|
|
(let ((compression (actual-compressions item compressions)))
|
|
|
|
|
|
|
|
|
|
(for-each (cut compress-nar cache item <>) compressions)
|
|
|
|
|
|
|
|
|
|
(match compressions
|
|
|
|
|
((main others ...)
|
|
|
|
|
(let ((narinfo (narinfo-cache-file cache item
|
|
|
|
|
#:compression main)))
|
|
|
|
|
(with-atomic-file-output narinfo
|
|
|
|
|
(lambda (port)
|
|
|
|
|
;; Open a new connection to the store. We cannot reuse the main
|
|
|
|
|
;; thread's connection to the store since we would end up sending
|
|
|
|
|
;; stuff concurrently on the same channel.
|
|
|
|
|
(with-store store
|
|
|
|
|
(let ((sizes (filter-map compressed-nar-size compression)))
|
|
|
|
|
(display (narinfo-string store item
|
|
|
|
|
#:nar-path nar-path
|
|
|
|
|
#:compressions compressions
|
|
|
|
|
#:file-sizes sizes)
|
2020-11-08 17:35:45 -05:00
|
|
|
|
port)))
|
|
|
|
|
|
|
|
|
|
;; Make the cached narinfo world-readable, contrary to what
|
|
|
|
|
;; 'with-atomic-file-output' does, so that other users can rsync
|
|
|
|
|
;; the whole cache.
|
|
|
|
|
(chmod port (logand #o644 (lognot (umask))))))
|
2019-05-30 12:36:37 -04:00
|
|
|
|
|
|
|
|
|
;; Make narinfo files for OTHERS hard links to NARINFO such that the
|
|
|
|
|
;; atime-based cache eviction considers either all the nars or none
|
|
|
|
|
;; of them as candidates.
|
|
|
|
|
(for-each (lambda (other)
|
|
|
|
|
(let ((other (narinfo-cache-file cache item
|
|
|
|
|
#:compression other)))
|
|
|
|
|
(link narinfo other)))
|
|
|
|
|
others))))))
|
2017-04-17 17:13:40 -04:00
|
|
|
|
|
2021-08-13 06:30:29 -04:00
|
|
|
|
(define (compression->sexp compression)
|
|
|
|
|
"Return the SEXP representation of COMPRESSION."
|
|
|
|
|
(match compression
|
|
|
|
|
(($ <compression> type level)
|
|
|
|
|
`(compression ,type ,level))))
|
|
|
|
|
|
|
|
|
|
(define (sexp->compression sexp)
|
|
|
|
|
"Turn the given SEXP into a <compression> record and return it."
|
|
|
|
|
(match sexp
|
|
|
|
|
(('compression type level)
|
|
|
|
|
(compression type level))))
|
|
|
|
|
|
2018-01-09 16:38:47 -05:00
|
|
|
|
;; XXX: Declare the 'X-Nar-Compression' HTTP header, which is in fact for
|
2016-07-18 17:58:34 -04:00
|
|
|
|
;; internal consumption: it allows us to pass the compression info to
|
|
|
|
|
;; 'http-write', as part of the workaround to <http://bugs.gnu.org/21093>.
|
2018-01-09 16:38:47 -05:00
|
|
|
|
(declare-header! "X-Nar-Compression"
|
2016-07-18 17:58:34 -04:00
|
|
|
|
(lambda (str)
|
2021-08-13 06:30:29 -04:00
|
|
|
|
(sexp->compression
|
|
|
|
|
(call-with-input-string str read)))
|
2016-07-18 17:58:34 -04:00
|
|
|
|
compression?
|
|
|
|
|
(lambda (compression port)
|
2021-08-13 06:30:29 -04:00
|
|
|
|
(write (compression->sexp compression) port)))
|
|
|
|
|
|
|
|
|
|
;; This header is used to pass the supported compressions to http-write in
|
|
|
|
|
;; order to format on-the-fly narinfo responses.
|
|
|
|
|
(declare-header! "X-Narinfo-Compressions"
|
|
|
|
|
(lambda (str)
|
|
|
|
|
(map sexp->compression
|
|
|
|
|
(call-with-input-string str read)))
|
|
|
|
|
(cut every compression? <>)
|
|
|
|
|
(lambda (compressions port)
|
|
|
|
|
(write (map compression->sexp compressions) port)))
|
2016-07-18 17:58:34 -04:00
|
|
|
|
|
|
|
|
|
(define* (render-nar store request store-item
|
|
|
|
|
#:key (compression %no-compression))
|
2015-03-17 10:21:31 -04:00
|
|
|
|
"Render archive of the store path corresponding to STORE-ITEM."
|
|
|
|
|
(let ((store-path (string-append %store-directory "/" store-item)))
|
|
|
|
|
;; The ISO-8859-1 charset *must* be used otherwise HTTP clients will
|
|
|
|
|
;; interpret the byte stream as UTF-8 and arbitrarily change invalid byte
|
|
|
|
|
;; sequences.
|
2016-02-25 05:48:17 -05:00
|
|
|
|
(if (valid-path? store store-path)
|
2016-07-18 17:58:34 -04:00
|
|
|
|
(values `((content-type . (application/x-nix-archive
|
|
|
|
|
(charset . "ISO-8859-1")))
|
2018-01-09 16:38:47 -05:00
|
|
|
|
(x-nar-compression . ,compression))
|
2015-07-19 18:37:47 -04:00
|
|
|
|
;; XXX: We're not returning the actual contents, deferring
|
|
|
|
|
;; instead to 'http-write'. This is a hack to work around
|
|
|
|
|
;; <http://bugs.gnu.org/21093>.
|
|
|
|
|
store-path)
|
2015-03-17 10:21:31 -04:00
|
|
|
|
(not-found request))))
|
|
|
|
|
|
2017-04-17 17:13:40 -04:00
|
|
|
|
(define* (render-nar/cached store cache request store-item
|
2018-12-17 17:01:51 -05:00
|
|
|
|
#:key ttl (compression %no-compression))
|
2017-04-17 17:13:40 -04:00
|
|
|
|
"Respond to REQUEST with a nar for STORE-ITEM. If the nar is in CACHE,
|
2018-12-17 17:01:51 -05:00
|
|
|
|
return it; otherwise, return 404. When TTL is true, use it as the
|
|
|
|
|
'Cache-Control' expiration time."
|
2017-04-17 17:13:40 -04:00
|
|
|
|
(let ((cached (nar-cache-file cache store-item
|
|
|
|
|
#:compression compression)))
|
2020-10-24 10:31:18 -04:00
|
|
|
|
(cond ((file-exists? cached)
|
|
|
|
|
(values `((content-type . (application/octet-stream
|
|
|
|
|
(charset . "ISO-8859-1")))
|
|
|
|
|
,@(if ttl
|
|
|
|
|
`((cache-control (max-age . ,ttl)))
|
|
|
|
|
'())
|
|
|
|
|
|
|
|
|
|
;; XXX: We're not returning the actual contents, deferring
|
|
|
|
|
;; instead to 'http-write'. This is a hack to work around
|
|
|
|
|
;; <http://bugs.gnu.org/21093>.
|
|
|
|
|
(x-raw-file . ,cached))
|
|
|
|
|
#f))
|
|
|
|
|
((let* ((hash (and=> (string-index store-item #\-)
|
|
|
|
|
(cut string-take store-item <>)))
|
|
|
|
|
(item (and hash
|
|
|
|
|
(guard (c ((store-error? c) #f))
|
|
|
|
|
(hash-part->path store hash)))))
|
2020-11-04 09:57:00 -05:00
|
|
|
|
(and item (not (string-null? item))
|
|
|
|
|
(bypass-cache? store item)))
|
2020-10-24 10:31:18 -04:00
|
|
|
|
;; Render STORE-ITEM live. We reach this because STORE-ITEM is
|
|
|
|
|
;; being baked but clients are already asking for it. Thus, we're
|
|
|
|
|
;; duplicating work, but doing so allows us to reduce delays.
|
|
|
|
|
(render-nar store request store-item
|
|
|
|
|
#:compression (low-compression compression)))
|
|
|
|
|
(else
|
|
|
|
|
(not-found request)))))
|
2017-04-17 17:13:40 -04:00
|
|
|
|
|
2016-07-20 10:54:31 -04:00
|
|
|
|
(define (render-content-addressed-file store request
|
|
|
|
|
name algo hash)
|
|
|
|
|
"Return the content of the result of the fixed-output derivation NAME that
|
|
|
|
|
has the given HASH of type ALGO."
|
|
|
|
|
;; TODO: Support other hash algorithms.
|
|
|
|
|
(if (and (eq? algo 'sha256) (= 32 (bytevector-length hash)))
|
|
|
|
|
(let ((item (fixed-output-path name hash
|
|
|
|
|
#:hash-algo algo
|
|
|
|
|
#:recursive? #f)))
|
|
|
|
|
(if (valid-path? store item)
|
|
|
|
|
(values `((content-type . (application/octet-stream
|
2018-01-04 18:15:51 -05:00
|
|
|
|
(charset . "ISO-8859-1")))
|
|
|
|
|
;; XXX: We're not returning the actual contents,
|
|
|
|
|
;; deferring instead to 'http-write'. This is a hack to
|
|
|
|
|
;; work around <http://bugs.gnu.org/21093>.
|
|
|
|
|
(x-raw-file . ,item))
|
|
|
|
|
#f)
|
2016-07-20 10:54:31 -04:00
|
|
|
|
(not-found request)))
|
|
|
|
|
(not-found request)))
|
|
|
|
|
|
2018-01-04 18:19:35 -05:00
|
|
|
|
(define (render-log-file store request name)
|
|
|
|
|
"Render the log file for NAME, the base name of a store item. Don't attempt
|
|
|
|
|
to compress or decompress the log file; just return it as-is."
|
|
|
|
|
(define (response-headers file)
|
|
|
|
|
;; XXX: We're not returning the actual contents, deferring instead to
|
|
|
|
|
;; 'http-write'. This is a hack to work around
|
|
|
|
|
;; <http://bugs.gnu.org/21093>.
|
|
|
|
|
(cond ((string-suffix? ".gz" file)
|
|
|
|
|
`((content-type . (text/plain (charset . "UTF-8")))
|
|
|
|
|
(content-encoding . (gzip))
|
|
|
|
|
(x-raw-file . ,file)))
|
|
|
|
|
((string-suffix? ".bz2" file)
|
|
|
|
|
`((content-type . (application/x-bzip2
|
|
|
|
|
(charset . "ISO-8859-1")))
|
|
|
|
|
(x-raw-file . ,file)))
|
|
|
|
|
(else ;uncompressed
|
|
|
|
|
`((content-type . (text/plain (charset . "UTF-8")))
|
|
|
|
|
(x-raw-file . ,file)))))
|
|
|
|
|
|
|
|
|
|
(let ((log (log-file store
|
|
|
|
|
(string-append (%store-prefix) "/" name))))
|
|
|
|
|
(if log
|
|
|
|
|
(values (response-headers log) log)
|
|
|
|
|
(not-found request))))
|
|
|
|
|
|
2020-10-20 16:32:02 -04:00
|
|
|
|
(define (render-signing-key)
|
|
|
|
|
"Render signing key."
|
|
|
|
|
(let ((file %public-key-file))
|
|
|
|
|
(values `((content-type . (text/plain (charset . "UTF-8")))
|
|
|
|
|
(x-raw-file . ,file))
|
|
|
|
|
file)))
|
|
|
|
|
|
2017-04-19 17:39:27 -04:00
|
|
|
|
(define (render-home-page request)
|
|
|
|
|
"Render the home page."
|
|
|
|
|
(values `((content-type . (text/html (charset . "UTF-8"))))
|
|
|
|
|
(call-with-output-string
|
|
|
|
|
(lambda (port)
|
|
|
|
|
(sxml->xml '(html
|
|
|
|
|
(head (title "GNU Guix Substitute Server"))
|
|
|
|
|
(body
|
|
|
|
|
(h1 "GNU Guix Substitute Server")
|
|
|
|
|
(p "Hi, "
|
|
|
|
|
(a (@ (href
|
2019-07-15 12:46:39 -04:00
|
|
|
|
"https://guix.gnu.org/manual/en/html_node/Invoking-guix-publish.html"))
|
2017-04-19 17:39:27 -04:00
|
|
|
|
(tt "guix publish"))
|
2020-10-20 16:32:02 -04:00
|
|
|
|
" speaking. Welcome!")
|
|
|
|
|
(p "Here is the "
|
|
|
|
|
(a (@ (href
|
|
|
|
|
"signing-key.pub"))
|
|
|
|
|
(tt "signing key"))
|
|
|
|
|
" for this server. Knock yourselves out!")))
|
2017-04-19 17:39:27 -04:00
|
|
|
|
port)))))
|
|
|
|
|
|
2017-07-21 08:48:52 -04:00
|
|
|
|
(define (extract-narinfo-hash str)
|
|
|
|
|
"Return the hash within the narinfo resource string STR, or false if STR
|
2015-03-17 10:21:31 -04:00
|
|
|
|
is invalid."
|
2017-07-21 08:48:52 -04:00
|
|
|
|
(and (string-suffix? ".narinfo" str)
|
|
|
|
|
(let ((base (string-drop-right str 8)))
|
|
|
|
|
(and (string-every %nix-base32-charset base)
|
|
|
|
|
base))))
|
2015-03-17 10:21:31 -04:00
|
|
|
|
|
|
|
|
|
(define (get-request? request)
|
|
|
|
|
"Return #t if REQUEST uses the GET method."
|
|
|
|
|
(eq? (request-method request) 'GET))
|
|
|
|
|
|
|
|
|
|
(define (request-path-components request)
|
|
|
|
|
"Split the URI path of REQUEST into a list of component strings. For
|
|
|
|
|
example: \"/foo/bar\" yields '(\"foo\" \"bar\")."
|
|
|
|
|
(split-and-decode-uri-path (uri-path (request-uri request))))
|
|
|
|
|
|
2015-07-19 17:58:37 -04:00
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; Server.
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
(define %http-write
|
|
|
|
|
(@@ (web server http) http-write))
|
|
|
|
|
|
2018-01-09 16:38:47 -05:00
|
|
|
|
(define (strip-headers response)
|
|
|
|
|
"Return RESPONSE's headers minus 'Content-Length' and our internal headers."
|
|
|
|
|
(fold alist-delete
|
|
|
|
|
(response-headers response)
|
2021-08-13 06:30:29 -04:00
|
|
|
|
'(content-length x-raw-file x-nar-compression
|
|
|
|
|
x-narinfo-compressions x-nar-path)))
|
2018-01-09 16:38:47 -05:00
|
|
|
|
|
2015-07-19 18:37:47 -04:00
|
|
|
|
(define (sans-content-length response)
|
|
|
|
|
"Return RESPONSE without its 'content-length' header."
|
|
|
|
|
(set-field response (response-headers)
|
2018-01-09 16:38:47 -05:00
|
|
|
|
(strip-headers response)))
|
2015-07-19 18:37:47 -04:00
|
|
|
|
|
2016-12-03 18:38:30 -05:00
|
|
|
|
(define (with-content-length response length)
|
|
|
|
|
"Return RESPONSE with a 'content-length' header set to LENGTH."
|
|
|
|
|
(set-field response (response-headers)
|
|
|
|
|
(alist-cons 'content-length length
|
2018-01-09 16:38:47 -05:00
|
|
|
|
(strip-headers response))))
|
2016-12-03 18:38:30 -05:00
|
|
|
|
|
2015-10-06 17:45:38 -04:00
|
|
|
|
(define-syntax-rule (swallow-EPIPE exp ...)
|
|
|
|
|
"Swallow EPIPE errors raised by EXP..."
|
|
|
|
|
(catch 'system-error
|
|
|
|
|
(lambda ()
|
|
|
|
|
exp ...)
|
|
|
|
|
(lambda args
|
|
|
|
|
(if (= EPIPE (system-error-errno args))
|
|
|
|
|
(values)
|
|
|
|
|
(apply throw args)))))
|
|
|
|
|
|
2016-07-18 17:58:34 -04:00
|
|
|
|
(define-syntax-rule (swallow-zlib-error exp ...)
|
|
|
|
|
"Swallow 'zlib-error' exceptions raised by EXP..."
|
|
|
|
|
(catch 'zlib-error
|
|
|
|
|
(lambda ()
|
|
|
|
|
exp ...)
|
|
|
|
|
(const #f)))
|
|
|
|
|
|
2021-05-20 04:42:56 -04:00
|
|
|
|
(define (nar-compressed-port port compression)
|
|
|
|
|
"Return a port on which to write the body of the response of a /nar request,
|
|
|
|
|
according to COMPRESSION."
|
2018-01-22 04:46:34 -05:00
|
|
|
|
(match compression
|
2016-07-18 17:58:34 -04:00
|
|
|
|
(($ <compression> 'gzip level)
|
|
|
|
|
;; Note: We cannot used chunked encoding here because
|
|
|
|
|
;; 'make-gzip-output-port' wants a file port.
|
2021-05-20 04:42:56 -04:00
|
|
|
|
(make-gzip-output-port port
|
2016-07-18 17:58:34 -04:00
|
|
|
|
#:level level
|
2020-11-10 16:59:13 -05:00
|
|
|
|
#:buffer-size %default-buffer-size))
|
2019-05-24 02:26:38 -04:00
|
|
|
|
(($ <compression> 'lzip level)
|
2021-05-20 04:42:56 -04:00
|
|
|
|
(make-lzip-output-port port
|
2019-05-24 02:26:38 -04:00
|
|
|
|
#:level level))
|
2020-12-27 06:10:15 -05:00
|
|
|
|
(($ <compression> 'zstd level)
|
2021-05-20 04:42:56 -04:00
|
|
|
|
(make-zstd-output-port port
|
2020-12-27 06:10:15 -05:00
|
|
|
|
#:level level))
|
2016-07-18 17:58:34 -04:00
|
|
|
|
(($ <compression> 'none)
|
2021-05-20 04:42:56 -04:00
|
|
|
|
port)
|
2016-07-18 17:58:34 -04:00
|
|
|
|
(#f
|
2021-05-20 04:42:56 -04:00
|
|
|
|
port)))
|
2016-07-18 17:58:34 -04:00
|
|
|
|
|
2015-07-19 17:58:37 -04:00
|
|
|
|
(define (http-write server client response body)
|
|
|
|
|
"Write RESPONSE and BODY to CLIENT, possibly in a separate thread to avoid
|
|
|
|
|
blocking."
|
2021-05-20 04:42:56 -04:00
|
|
|
|
;; XXX: The default Guile web server implementation supports the keep-alive
|
|
|
|
|
;; mechanism. However, as we run our own modified version of the http-write
|
|
|
|
|
;; procedure, we need to access a few server implementation details to keep
|
|
|
|
|
;; it functional.
|
|
|
|
|
(define *error-events*
|
|
|
|
|
(logior POLLHUP POLLERR))
|
|
|
|
|
|
|
|
|
|
(define *read-events*
|
|
|
|
|
POLLIN)
|
|
|
|
|
|
|
|
|
|
(define *events*
|
|
|
|
|
(logior *error-events* *read-events*))
|
|
|
|
|
|
|
|
|
|
;; Access the server poll set variable.
|
|
|
|
|
(define http-poll-set
|
|
|
|
|
(@@ (web server http) http-poll-set))
|
|
|
|
|
|
|
|
|
|
;; Copied from (web server http).
|
|
|
|
|
(define (keep-alive? response)
|
|
|
|
|
(let ((v (response-version response)))
|
|
|
|
|
(and (or (< (response-code response) 400)
|
|
|
|
|
(= (response-code response) 404))
|
|
|
|
|
(case (car v)
|
|
|
|
|
((1)
|
|
|
|
|
(case (cdr v)
|
|
|
|
|
((1) (not (memq 'close (response-connection response))))
|
|
|
|
|
((0) (memq 'keep-alive (response-connection response)))))
|
|
|
|
|
(else #f)))))
|
|
|
|
|
|
|
|
|
|
(define (keep-alive port)
|
|
|
|
|
"Add the given PORT the server poll set."
|
|
|
|
|
(force-output port)
|
|
|
|
|
(poll-set-add! (http-poll-set server) port *events*))
|
|
|
|
|
|
|
|
|
|
(define compression
|
|
|
|
|
(assoc-ref (response-headers response) 'x-nar-compression))
|
|
|
|
|
|
2015-07-19 17:58:37 -04:00
|
|
|
|
(match (response-content-type response)
|
|
|
|
|
(('application/x-nix-archive . _)
|
2021-05-20 04:42:56 -04:00
|
|
|
|
;; When compressing the NAR on the go, we cannot announce its size
|
|
|
|
|
;; beforehand to the client. Hence, the keep-alive mechanism cannot work
|
|
|
|
|
;; here.
|
|
|
|
|
(let ((keep-alive? (and (eq? (compression-type compression) 'none)
|
|
|
|
|
(keep-alive? response))))
|
|
|
|
|
;; Add the client to the server poll set, so that we can receive
|
|
|
|
|
;; further requests without closing the connection.
|
|
|
|
|
(when keep-alive?
|
|
|
|
|
(keep-alive client))
|
|
|
|
|
;; Sending the the whole archive can take time so do it in a separate
|
|
|
|
|
;; thread so that the main thread can keep working in the meantime.
|
|
|
|
|
(call-with-new-thread
|
|
|
|
|
(lambda ()
|
|
|
|
|
(set-thread-name "publish nar")
|
|
|
|
|
(let* ((response (write-response (sans-content-length response)
|
|
|
|
|
client))
|
|
|
|
|
(port (begin
|
|
|
|
|
(force-output client)
|
|
|
|
|
(configure-socket client)
|
|
|
|
|
;; Duplicate the response port, so that it is
|
|
|
|
|
;; not automatically closed when closing the
|
|
|
|
|
;; returned port. This is needed for the
|
|
|
|
|
;; keep-alive mechanism.
|
|
|
|
|
(nar-compressed-port
|
|
|
|
|
(duplicate-port
|
|
|
|
|
(response-port response) "w+0b")
|
|
|
|
|
compression))))
|
|
|
|
|
;; XXX: Given our ugly workaround for <http://bugs.gnu.org/21093>
|
|
|
|
|
;; in 'render-nar', BODY here is just the file name of the store
|
|
|
|
|
;; item. We call 'write-file' from here because we know that's
|
|
|
|
|
;; the only way to avoid building the whole nar in memory, which
|
|
|
|
|
;; could quickly become a real problem. As a bonus, we even do
|
|
|
|
|
;; sendfile(2) directly from the store files to the socket.
|
|
|
|
|
(swallow-zlib-error
|
|
|
|
|
(swallow-EPIPE
|
|
|
|
|
(write-file (utf8->string body) port)))
|
|
|
|
|
(swallow-zlib-error
|
|
|
|
|
(close-port port)
|
|
|
|
|
(unless keep-alive?
|
|
|
|
|
(close-port client)))
|
|
|
|
|
(values))))))
|
2021-08-13 06:30:29 -04:00
|
|
|
|
(('application/x-nix-narinfo . _)
|
|
|
|
|
(let ((compressions (assoc-ref (response-headers response)
|
|
|
|
|
'x-narinfo-compressions))
|
|
|
|
|
(nar-path (assoc-ref (response-headers response)
|
|
|
|
|
'x-nar-path)))
|
|
|
|
|
(if nar-path
|
|
|
|
|
(begin
|
|
|
|
|
(when (keep-alive? response)
|
|
|
|
|
(keep-alive client))
|
|
|
|
|
(call-with-new-thread
|
|
|
|
|
(lambda ()
|
|
|
|
|
(set-thread-name "publish narinfo")
|
|
|
|
|
(let* ((narinfo
|
|
|
|
|
(with-store store
|
|
|
|
|
(narinfo-string store (utf8->string body)
|
|
|
|
|
#:nar-path nar-path
|
|
|
|
|
#:compressions compressions)))
|
|
|
|
|
(narinfo-bv (string->bytevector narinfo "UTF-8"))
|
|
|
|
|
(narinfo-length
|
|
|
|
|
(bytevector-length narinfo-bv))
|
|
|
|
|
(response (write-response
|
|
|
|
|
(with-content-length response
|
|
|
|
|
narinfo-length)
|
|
|
|
|
client))
|
|
|
|
|
(output (response-port response)))
|
|
|
|
|
(configure-socket client)
|
|
|
|
|
(put-bytevector output narinfo-bv)
|
|
|
|
|
(force-output output)
|
|
|
|
|
(unless (keep-alive? response)
|
|
|
|
|
(close-port output))
|
|
|
|
|
(values)))))
|
|
|
|
|
(%http-write server client response body))))
|
2015-07-19 17:58:37 -04:00
|
|
|
|
(_
|
2018-01-04 18:15:51 -05:00
|
|
|
|
(match (assoc-ref (response-headers response) 'x-raw-file)
|
|
|
|
|
((? string? file)
|
2021-05-20 04:42:56 -04:00
|
|
|
|
(when (keep-alive? response)
|
|
|
|
|
(keep-alive client))
|
2018-01-04 18:15:51 -05:00
|
|
|
|
;; Send a raw file in a separate thread.
|
|
|
|
|
(call-with-new-thread
|
|
|
|
|
(lambda ()
|
|
|
|
|
(set-thread-name "publish file")
|
|
|
|
|
(catch 'system-error
|
|
|
|
|
(lambda ()
|
|
|
|
|
(call-with-input-file file
|
|
|
|
|
(lambda (input)
|
|
|
|
|
(let* ((size (stat:size (stat input)))
|
2021-05-20 04:42:56 -04:00
|
|
|
|
(response (write-response
|
|
|
|
|
(with-content-length response size)
|
|
|
|
|
client))
|
2018-01-04 18:15:51 -05:00
|
|
|
|
(output (response-port response)))
|
2020-11-10 16:59:13 -05:00
|
|
|
|
(configure-socket client)
|
2018-01-04 18:15:51 -05:00
|
|
|
|
(if (file-port? output)
|
|
|
|
|
(sendfile output input size)
|
|
|
|
|
(dump-port input output))
|
2021-05-20 04:42:56 -04:00
|
|
|
|
(unless (keep-alive? response)
|
|
|
|
|
(close-port output))
|
2018-01-04 18:15:51 -05:00
|
|
|
|
(values)))))
|
|
|
|
|
(lambda args
|
2021-05-20 04:42:56 -04:00
|
|
|
|
;; If the file was GC'd behind our back, that's fine. Likewise
|
|
|
|
|
;; if the client closes the connection.
|
2018-01-04 18:15:51 -05:00
|
|
|
|
(unless (memv (system-error-errno args)
|
|
|
|
|
(list ENOENT EPIPE ECONNRESET))
|
|
|
|
|
(apply throw args))
|
|
|
|
|
(values))))))
|
|
|
|
|
(#f
|
|
|
|
|
;; Handle other responses sequentially.
|
|
|
|
|
(%http-write server client response body))))))
|
2015-07-19 17:58:37 -04:00
|
|
|
|
|
|
|
|
|
(define-server-impl concurrent-http-server
|
|
|
|
|
;; A variant of Guile's built-in HTTP server that offloads possibly long
|
|
|
|
|
;; responses to a different thread.
|
|
|
|
|
(@@ (web server http) http-open)
|
|
|
|
|
(@@ (web server http) http-read)
|
|
|
|
|
http-write
|
|
|
|
|
(@@ (web server http) http-close))
|
|
|
|
|
|
2019-05-24 02:26:38 -04:00
|
|
|
|
(define (string->compression-type string)
|
|
|
|
|
"Return a symbol denoting the compression method expressed by STRING; return
|
|
|
|
|
#f if STRING doesn't match any supported method."
|
|
|
|
|
(match string
|
Use "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.
2020-07-27 10:36:39 -04:00
|
|
|
|
("gzip" 'gzip)
|
|
|
|
|
("lzip" 'lzip)
|
2020-12-27 06:10:15 -05:00
|
|
|
|
("zstd" 'zstd)
|
2019-05-24 02:26:38 -04:00
|
|
|
|
(_ #f)))
|
|
|
|
|
|
2019-05-30 12:36:37 -04:00
|
|
|
|
(define (effective-compression requested-type compressions)
|
|
|
|
|
"Given the REQUESTED-TYPE for compression and the set of chosen COMPRESSION
|
|
|
|
|
methods, return the applicable compression."
|
|
|
|
|
(or (find (match-lambda
|
|
|
|
|
(($ <compression> type)
|
|
|
|
|
(and (eq? type requested-type)
|
|
|
|
|
compression)))
|
|
|
|
|
compressions)
|
|
|
|
|
(default-compression requested-type)))
|
|
|
|
|
|
2021-05-21 04:19:20 -04:00
|
|
|
|
(define (preserve-connection-headers request response)
|
|
|
|
|
"Add REQUEST's 'connection' header, if any, to HEADERS, a list of response
|
|
|
|
|
headers."
|
|
|
|
|
(if (pair? response)
|
|
|
|
|
(let ((connection
|
|
|
|
|
(assq 'connection (request-headers request))))
|
|
|
|
|
(append response
|
|
|
|
|
(if connection
|
|
|
|
|
(list connection)
|
|
|
|
|
'())))
|
|
|
|
|
response))
|
|
|
|
|
|
2016-07-18 17:58:34 -04:00
|
|
|
|
(define* (make-request-handler store
|
|
|
|
|
#:key
|
2017-04-17 17:13:40 -04:00
|
|
|
|
cache pool
|
2021-05-11 09:01:00 -04:00
|
|
|
|
narinfo-ttl narinfo-negative-ttl
|
2017-03-22 08:31:54 -04:00
|
|
|
|
(nar-path "nar")
|
2019-05-30 12:36:37 -04:00
|
|
|
|
(compressions (list %no-compression)))
|
2019-05-24 02:26:38 -04:00
|
|
|
|
(define compression-type?
|
|
|
|
|
string->compression-type)
|
|
|
|
|
|
2017-03-22 08:31:54 -04:00
|
|
|
|
(define nar-path?
|
|
|
|
|
(let ((expected (split-and-decode-uri-path nar-path)))
|
|
|
|
|
(cut equal? expected <>)))
|
|
|
|
|
|
2021-05-21 04:19:20 -04:00
|
|
|
|
(define (handle request body)
|
2015-03-17 10:21:31 -04:00
|
|
|
|
(format #t "~a ~a~%"
|
|
|
|
|
(request-method request)
|
|
|
|
|
(uri-path (request-uri request)))
|
2016-07-20 10:54:31 -04:00
|
|
|
|
(if (get-request? request) ;reject POST, PUT, etc.
|
2015-03-17 10:21:31 -04:00
|
|
|
|
(match (request-path-components request)
|
|
|
|
|
;; /nix-cache-info
|
|
|
|
|
(("nix-cache-info")
|
|
|
|
|
(render-nix-cache-info))
|
2017-04-19 17:39:27 -04:00
|
|
|
|
;; /
|
|
|
|
|
((or () ("index.html"))
|
|
|
|
|
(render-home-page request))
|
2020-10-20 16:32:02 -04:00
|
|
|
|
;; guix signing-key
|
|
|
|
|
(("signing-key.pub")
|
|
|
|
|
(render-signing-key))
|
2015-03-17 10:21:31 -04:00
|
|
|
|
;; /<hash>.narinfo
|
|
|
|
|
(((= extract-narinfo-hash (? string? hash)))
|
2017-04-17 17:13:40 -04:00
|
|
|
|
(if cache
|
|
|
|
|
(render-narinfo/cached store request hash
|
|
|
|
|
#:cache cache
|
|
|
|
|
#:pool pool
|
|
|
|
|
#:ttl narinfo-ttl
|
2021-05-11 09:01:00 -04:00
|
|
|
|
#:negative-ttl narinfo-negative-ttl
|
2017-04-17 17:13:40 -04:00
|
|
|
|
#:nar-path nar-path
|
2019-05-30 12:36:37 -04:00
|
|
|
|
#:compressions compressions)
|
2017-04-17 17:13:40 -04:00
|
|
|
|
(render-narinfo store request hash
|
|
|
|
|
#:ttl narinfo-ttl
|
2021-05-11 09:01:00 -04:00
|
|
|
|
#:negative-ttl narinfo-negative-ttl
|
2017-04-17 17:13:40 -04:00
|
|
|
|
#:nar-path nar-path
|
2019-05-30 12:36:37 -04:00
|
|
|
|
#:compressions compressions)))
|
2017-03-22 08:31:54 -04:00
|
|
|
|
;; /nar/file/NAME/sha256/HASH
|
|
|
|
|
(("file" name "sha256" hash)
|
|
|
|
|
(guard (c ((invalid-base32-character? c)
|
|
|
|
|
(not-found request)))
|
|
|
|
|
(let ((hash (nix-base32-string->bytevector hash)))
|
|
|
|
|
(render-content-addressed-file store request
|
|
|
|
|
name 'sha256 hash))))
|
2016-07-18 17:58:34 -04:00
|
|
|
|
|
2018-01-04 18:19:35 -05:00
|
|
|
|
;; /log/OUTPUT
|
|
|
|
|
(("log" name)
|
|
|
|
|
(render-log-file store request name))
|
|
|
|
|
|
2016-07-18 17:58:34 -04:00
|
|
|
|
;; Use different URLs depending on the compression type. This
|
|
|
|
|
;; guarantees that /nar URLs remain valid even when 'guix publish'
|
|
|
|
|
;; is restarted with different compression parameters.
|
|
|
|
|
|
|
|
|
|
;; /nar/gzip/<store-item>
|
2019-05-24 02:26:38 -04:00
|
|
|
|
((components ... (? compression-type? type) store-item)
|
|
|
|
|
(if (nar-path? components)
|
|
|
|
|
(let* ((compression-type (string->compression-type type))
|
2019-05-30 12:36:37 -04:00
|
|
|
|
(compression (effective-compression compression-type
|
|
|
|
|
compressions)))
|
2017-04-17 17:13:40 -04:00
|
|
|
|
(if cache
|
|
|
|
|
(render-nar/cached store cache request store-item
|
2018-12-17 17:01:51 -05:00
|
|
|
|
#:ttl narinfo-ttl
|
2017-04-17 17:13:40 -04:00
|
|
|
|
#:compression compression)
|
|
|
|
|
(render-nar store request store-item
|
|
|
|
|
#:compression compression)))
|
2016-07-18 17:58:34 -04:00
|
|
|
|
(not-found request)))
|
2016-07-20 10:54:31 -04:00
|
|
|
|
|
2017-03-22 08:31:54 -04:00
|
|
|
|
;; /nar/<store-item>
|
|
|
|
|
((components ... store-item)
|
|
|
|
|
(if (nar-path? components)
|
2017-10-05 16:15:19 -04:00
|
|
|
|
(if cache
|
|
|
|
|
(render-nar/cached store cache request store-item
|
2018-12-17 17:01:51 -05:00
|
|
|
|
#:ttl narinfo-ttl
|
2017-10-05 16:15:19 -04:00
|
|
|
|
#:compression %no-compression)
|
|
|
|
|
(render-nar store request store-item
|
|
|
|
|
#:compression %no-compression))
|
2017-03-22 08:31:54 -04:00
|
|
|
|
(not-found request)))
|
|
|
|
|
|
|
|
|
|
(x (not-found request)))
|
2021-05-21 04:19:20 -04:00
|
|
|
|
(not-found request)))
|
|
|
|
|
|
|
|
|
|
;; Preserve the request's 'connection' header in the response, so that the
|
|
|
|
|
;; server can close the connection if this is requested by the client.
|
|
|
|
|
(lambda (request body)
|
2022-04-06 05:20:21 -04:00
|
|
|
|
(let ((response response-body (handle request body)))
|
2021-05-21 04:19:20 -04:00
|
|
|
|
(values (preserve-connection-headers request response)
|
|
|
|
|
response-body))))
|
2015-03-17 10:21:31 -04:00
|
|
|
|
|
2020-11-22 09:15:17 -05:00
|
|
|
|
(define (service-name)
|
|
|
|
|
"Return the Avahi service name of the server."
|
|
|
|
|
(string-append "guix-publish-" (gethostname)))
|
|
|
|
|
|
|
|
|
|
(define publish-service-type
|
|
|
|
|
;; Return the Avahi service type of the server.
|
|
|
|
|
"_guix_publish._tcp")
|
|
|
|
|
|
2016-06-09 17:33:20 -04:00
|
|
|
|
(define* (run-publish-server socket store
|
2019-05-30 12:36:37 -04:00
|
|
|
|
#:key
|
2020-11-22 09:15:17 -05:00
|
|
|
|
advertise? port
|
2019-05-30 12:36:37 -04:00
|
|
|
|
(compressions (list %no-compression))
|
2021-05-11 09:01:00 -04:00
|
|
|
|
(nar-path "nar") narinfo-ttl narinfo-negative-ttl
|
2017-04-17 17:13:40 -04:00
|
|
|
|
cache pool)
|
2020-11-22 09:15:17 -05:00
|
|
|
|
(when advertise?
|
|
|
|
|
(let ((name (service-name)))
|
|
|
|
|
;; XXX: Use a callback from Guile-Avahi here, as Avahi can pick a
|
|
|
|
|
;; different name to avoid name clashes.
|
|
|
|
|
(info (G_ "Advertising ~a~%.") name)
|
|
|
|
|
(avahi-publish-service-thread name
|
|
|
|
|
#:type publish-service-type
|
|
|
|
|
#:port port)))
|
|
|
|
|
|
2016-07-18 17:58:34 -04:00
|
|
|
|
(run-server (make-request-handler store
|
2017-04-17 17:13:40 -04:00
|
|
|
|
#:cache cache
|
|
|
|
|
#:pool pool
|
2017-03-22 08:31:54 -04:00
|
|
|
|
#:nar-path nar-path
|
2016-07-18 17:58:34 -04:00
|
|
|
|
#:narinfo-ttl narinfo-ttl
|
2021-05-11 09:01:00 -04:00
|
|
|
|
#:narinfo-negative-ttl narinfo-negative-ttl
|
2019-05-30 12:36:37 -04:00
|
|
|
|
#:compressions compressions)
|
2015-07-19 17:58:37 -04:00
|
|
|
|
concurrent-http-server
|
2015-05-12 05:41:55 -04:00
|
|
|
|
`(#:socket ,socket)))
|
|
|
|
|
|
2015-05-12 15:20:19 -04:00
|
|
|
|
(define (open-server-socket address)
|
|
|
|
|
"Return a TCP socket bound to ADDRESS, a socket address."
|
|
|
|
|
(let ((sock (socket (sockaddr:fam address) SOCK_STREAM 0)))
|
2020-11-10 16:59:13 -05:00
|
|
|
|
(configure-socket sock #:options (cons (list SO_REUSEADDR 1)
|
|
|
|
|
%default-socket-options))
|
2015-05-12 15:20:19 -04:00
|
|
|
|
(bind sock address)
|
2015-05-12 05:41:55 -04:00
|
|
|
|
sock))
|
|
|
|
|
|
2022-04-06 16:37:33 -04:00
|
|
|
|
(define (systemd-socket)
|
|
|
|
|
"If this program is being spawned through systemd-style \"socket
|
|
|
|
|
activation\", whereby the listening socket is passed as file descriptor 3,
|
|
|
|
|
return the corresponding socket. Otherwise return #f."
|
|
|
|
|
(and (equal? (and=> (getenv "LISTEN_PID") string->number)
|
|
|
|
|
(getpid))
|
|
|
|
|
(match (getenv "LISTEN_FDS")
|
|
|
|
|
((= string->number 1)
|
|
|
|
|
(let ((sock (fdopen 3 "r+0")))
|
|
|
|
|
(configure-socket sock)
|
|
|
|
|
sock))
|
|
|
|
|
((= string->number (? integer? n))
|
|
|
|
|
(leave (G_ "~a: unexpected number of startup file descriptors")
|
|
|
|
|
n))
|
|
|
|
|
(_
|
|
|
|
|
#f))))
|
|
|
|
|
|
2015-05-12 05:41:55 -04:00
|
|
|
|
(define (gather-user-privileges user)
|
|
|
|
|
"Switch to the identity of USER, a user name."
|
|
|
|
|
(catch 'misc-error
|
|
|
|
|
(lambda ()
|
|
|
|
|
(let ((user (getpw user)))
|
|
|
|
|
(setgroups #())
|
|
|
|
|
(setgid (passwd:gid user))
|
|
|
|
|
(setuid (passwd:uid user))))
|
|
|
|
|
(lambda (key proc message args . rest)
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(leave (G_ "user '~a' not found: ~a~%")
|
2015-05-12 05:41:55 -04:00
|
|
|
|
user (apply format #f message args)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; Entry point.
|
|
|
|
|
;;;
|
2015-03-17 10:21:31 -04:00
|
|
|
|
|
2020-09-01 16:13:11 -04:00
|
|
|
|
(define-command (guix-publish . args)
|
|
|
|
|
(category packaging)
|
|
|
|
|
(synopsis "publish build results over HTTP")
|
|
|
|
|
|
2015-03-17 10:21:31 -04:00
|
|
|
|
(with-error-handling
|
2021-03-29 06:18:03 -04:00
|
|
|
|
(let* ((opts (parse-command-line args %options (list %default-options)
|
|
|
|
|
#:build-options? #f
|
|
|
|
|
#:argument-handler
|
|
|
|
|
(lambda (arg result)
|
|
|
|
|
(leave (G_ "~A: extraneous argument~%") arg))))
|
2020-11-22 09:15:17 -05:00
|
|
|
|
(advertise? (assoc-ref opts 'advertise?))
|
|
|
|
|
(user (assoc-ref opts 'user))
|
|
|
|
|
(port (assoc-ref opts 'port))
|
|
|
|
|
(ttl (assoc-ref opts 'narinfo-ttl))
|
2021-05-11 09:01:00 -04:00
|
|
|
|
(negative-ttl (assoc-ref opts 'narinfo-negative-ttl))
|
2019-05-30 12:36:37 -04:00
|
|
|
|
(compressions (match (filter-map (match-lambda
|
|
|
|
|
(('compression . compression)
|
|
|
|
|
compression)
|
|
|
|
|
(_ #f))
|
|
|
|
|
opts)
|
|
|
|
|
(()
|
|
|
|
|
;; Default to fast & low compression.
|
Use "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.
2020-07-27 10:36:39 -04:00
|
|
|
|
(list %default-gzip-compression))
|
2019-05-30 12:36:37 -04:00
|
|
|
|
(lst (reverse lst))))
|
2015-05-12 15:20:19 -04:00
|
|
|
|
(address (let ((addr (assoc-ref opts 'address)))
|
|
|
|
|
(make-socket-address (sockaddr:fam addr)
|
|
|
|
|
(sockaddr:addr addr)
|
|
|
|
|
port)))
|
2022-04-06 16:37:33 -04:00
|
|
|
|
(socket style (match (systemd-socket)
|
|
|
|
|
(#f
|
|
|
|
|
(values (open-server-socket address)
|
|
|
|
|
'normal))
|
|
|
|
|
(socket
|
|
|
|
|
(values socket 'systemd))))
|
2017-03-22 09:00:06 -04:00
|
|
|
|
(nar-path (assoc-ref opts 'nar-path))
|
2017-03-22 04:50:06 -04:00
|
|
|
|
(repl-port (assoc-ref opts 'repl))
|
2017-04-17 17:13:40 -04:00
|
|
|
|
(cache (assoc-ref opts 'cache))
|
|
|
|
|
(workers (assoc-ref opts 'workers))
|
2017-03-22 04:50:06 -04:00
|
|
|
|
|
|
|
|
|
;; Read the key right away so that (1) we fail early on if we can't
|
|
|
|
|
;; access them, and (2) we can then drop privileges.
|
|
|
|
|
(public-key (read-file-sexp (assoc-ref opts 'public-key-file)))
|
|
|
|
|
(private-key (read-file-sexp (assoc-ref opts 'private-key-file))))
|
2015-05-12 05:41:55 -04:00
|
|
|
|
|
|
|
|
|
(when user
|
|
|
|
|
;; Now that we've read the key material and opened the socket, we can
|
|
|
|
|
;; drop privileges.
|
|
|
|
|
(gather-user-privileges user))
|
|
|
|
|
|
|
|
|
|
(when (zero? (getuid))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(warning (G_ "server running as root; \
|
2015-05-12 05:41:55 -04:00
|
|
|
|
consider using the '--user' option!~%")))
|
2017-03-22 04:50:06 -04:00
|
|
|
|
|
|
|
|
|
(parameterize ((%public-key public-key)
|
2020-10-24 10:31:18 -04:00
|
|
|
|
(%private-key private-key)
|
|
|
|
|
(cache-bypass-threshold
|
|
|
|
|
(or (assoc-ref opts 'cache-bypass-threshold)
|
|
|
|
|
(cache-bypass-threshold))))
|
2022-04-06 16:37:33 -04:00
|
|
|
|
(if (eq? style 'systemd)
|
|
|
|
|
(info (G_ "publishing (started via socket activation)~%"))
|
|
|
|
|
(info (G_ "publishing ~a on ~a, port ~d~%")
|
|
|
|
|
%store-directory
|
|
|
|
|
(inet-ntop (sockaddr:fam address) (sockaddr:addr address))
|
|
|
|
|
(sockaddr:port address)))
|
2019-05-27 16:38:15 -04:00
|
|
|
|
|
2019-05-30 12:36:37 -04:00
|
|
|
|
(for-each (lambda (compression)
|
|
|
|
|
(info (G_ "using '~a' compression method, level ~a~%")
|
|
|
|
|
(compression-type compression)
|
|
|
|
|
(compression-level compression)))
|
|
|
|
|
compressions)
|
2019-05-27 16:38:15 -04:00
|
|
|
|
|
2017-03-22 04:50:06 -04:00
|
|
|
|
(when repl-port
|
|
|
|
|
(repl:spawn-server (repl:make-tcp-server-socket #:port repl-port)))
|
2017-05-28 10:09:32 -04:00
|
|
|
|
|
|
|
|
|
;; Set the name of the main thread.
|
|
|
|
|
(set-thread-name "guix publish")
|
|
|
|
|
|
2017-03-22 04:50:06 -04:00
|
|
|
|
(with-store store
|
|
|
|
|
(run-publish-server socket store
|
2020-11-22 09:15:17 -05:00
|
|
|
|
#:advertise? advertise?
|
|
|
|
|
#:port port
|
2017-04-17 17:13:40 -04:00
|
|
|
|
#:cache cache
|
2017-05-28 10:09:32 -04:00
|
|
|
|
#:pool (and cache (make-pool workers
|
|
|
|
|
#:thread-name
|
|
|
|
|
"publish worker"))
|
2017-03-22 09:00:06 -04:00
|
|
|
|
#:nar-path nar-path
|
2019-05-30 12:36:37 -04:00
|
|
|
|
#:compressions compressions
|
2021-05-11 09:01:00 -04:00
|
|
|
|
#:narinfo-negative-ttl negative-ttl
|
2017-03-22 04:50:06 -04:00
|
|
|
|
#:narinfo-ttl ttl))))))
|
2017-04-17 17:13:40 -04:00
|
|
|
|
|
|
|
|
|
;;; Local Variables:
|
|
|
|
|
;;; eval: (put 'single-baker 'scheme-indent-function 1)
|
|
|
|
|
;;; End:
|