From 1e47148f46e31eb99ce8ec7bc12232cf50d0ebec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 10 Nov 2023 21:37:28 +0100 Subject: =?UTF-8?q?daemon:=20Implement=20=E2=80=98substitute-urls=E2=80=99?= =?UTF-8?q?=20RPC.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * nix/libstore/worker-protocol.hh (PROTOCOL_VERSION): Bump. (WorkerOp): Add ‘wopSubstituteURLs’. * nix/nix-daemon/nix-daemon.cc (performOp): Implement it. * guix/store.scm (%protocol-version): Bump. (operation-id): Add ‘substitute-urls’. (substitute-urls): New procedure. * tests/store.scm ("substitute-urls, default") ("substitute-urls, client-specified URLs") ("substitute-urls, disabled"): New tests. Change-Id: I2c0119500c3a1eecfa5ebf32463ffb0f173161de --- tests/store.scm | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/store.scm b/tests/store.scm index 5df28adf0d..45948f4f43 100644 --- a/tests/store.scm +++ b/tests/store.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès +;;; Copyright © 2012-2021, 2023 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -105,7 +105,28 @@ "/283gqy39v3g9dxjy26rynl0zls82fmcg-guile-2.0.7/bin/guile"))) (not (direct-store-path? (%store-prefix))))) -(test-skip (if %store 0 15)) +(test-skip (if %store 0 18)) + +(test-equal "substitute-urls, default" + (list (getenv "GUIX_BINARY_SUBSTITUTE_URL")) + (with-store store + (set-build-options store #:use-substitutes? #t) + (substitute-urls store))) + +(test-equal "substitute-urls, client-specified URLs" + '("http://substitutes.example.org" + "http://other.example.org") + (with-store store + (set-build-options store #:use-substitutes? #t + #:substitute-urls '("http://substitutes.example.org" + "http://other.example.org")) + (substitute-urls store))) + +(test-equal "substitute-urls, disabled" + '() + (with-store store + (set-build-options store #:use-substitutes? #f) + (substitute-urls store))) (test-equal "profiles/per-user exists and is not writable" #o755 -- cgit v1.2.3