;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2021 Sarah Morgensen ;;; ;;; 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 . (define-module (test-eggs) #:use-module (guix import egg) #:use-module (guix gexp) #:use-module (guix base32) #:use-module (gcrypt hash) #:use-module (guix tests) #:use-module ((guix build syscalls) #:select (mkdtemp!)) #:use-module ((guix build utils) #:select (delete-file-recursively mkdir-p which)) #:use-module ((guix utils) #:select (call-with-temporary-output-file)) #:use-module (srfi srfi-1) #:use-module (srfi srfi-64) #:use-module (web uri) #:use-module (ice-9 match)) (define test-egg-1 '((synopsis "Example egg") (license "GPL-3/MIT") (version "1.0.0") (test-dependencies test srfi-1) (foreign-dependencies libgit2) (build-dependencies begin-syntax) (dependencies datatype) (author "John Doe"))) (define test-egg-2 '((synopsis "Example egg") (license "GPL-3+") (version "0.3") (test-dependencies test) (foreign-dependencies libgit2) (build-dependencies begin-syntax) (dependencies datatype) (author "Alice Bobson"))) (define test-egg-1-file "/tmp/guix-egg-1") (define test-egg-2-file "/tmp/guix-egg-2") (test-begin "egg") (test-equal "guix-package->egg-name" "bar" (guix-package->egg-name (dummy-package "dummy" (name "chicken-bar")))) ;; Copied from tests/hackage.scm (define-syntax-rule (define-package-matcher name pattern) (define* (name obj) (match obj (pattern #t) (x (pk 'fail x #f))))) (define (eval-test-with-egg-file egg-name egg-test egg-file matcher) (call-with-output-file egg-file (lambda (port) (write egg-test port))) (matcher (egg->guix-package egg-name #f #:file egg-file #:source (plain-file (string-append egg-name "-egg") "content")))) (define-package-matcher match-chicken-foo ('package ('name "chicken-foo") ('version "1.0.0") ('source (? file-like? source)) ('build-system 'chicken-build-system) ('arguments ('quasiquote ('#:egg-name "foo"))) ('native-inputs ('list 'chicken-test 'chicken-srfi-1 'chicken-begin-syntax)) ('inputs ('list 'libgit2)) ('propagated-inputs ('list 'chicken-datatype)) ('home-page "https://wiki.call-cc.org/egg/foo") ('synopsis "Example egg") ('description #f) ('license '(list license:gpl3 license:expat)))) (define-package-matcher match-chicken-bar ('package ('name "chicken-bar") ('version "0.3") ('source (? file-like? source)) ('build-system 'chicken-build-system) ('arguments ('quasiquote ('#:egg-name "bar"))) ('native-inputs ('list 'chicken-test 'chicken-begin-syntax)) ('inputs ('list 'libgit2)) ('propagated-inputs ('list 'chicken-datatype)) ('home-page "https://wiki.call-cc.org/egg/bar") ('synopsis "Example egg") ('description #f) ('license 'license:gpl3+))) (test-assert "egg->guix-package local file, multiple licenses" (eval-test-with-egg-file "foo" test-egg-1 test-egg-1-file match-chicken-foo)) (test-assert "egg->guix-package local file, single license" (eval-test-with-egg-file "bar" test-egg-2 test-egg-2-file match-chicken-bar)) (test-end "egg") '>* nix/libstore/build.cc (DerivationGoal::runChild): Maximise our OOM score adjustment. Change-Id: I418c763b499ca16e1ffe3c6033319112b9744f51 Tobias Geerinckx-Rice 2023-12-11daemon: Implement ‘substitute-urls’ RPC....* 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 Ludovic Courtès 2023-12-04daemon: Simplify “empty status” substitute error message....* nix/libstore/build.cc (SubstitutionGoal::finished): Don’t show what the empty status looks like. Change-Id: Ie898432aeb047aff3d59024de6ed6d18f68903c4 Ludovic Courtès 2023-09-26daemon: Add “git-download” built-in builder....The new builder makes it possible to break cycles that occurs when the fixed-output derivation for the source of a dependency of ‘git’ would itself depend on ‘git’. * guix/scripts/perform-download.scm (perform-git-download): New procedure. (perform-download): Move fixed-output derivation check to… (guix-perform-download): … here. Invoke ‘perform-download’ or ‘perform-git-download’ depending on what ‘derivation-builder’ returns. * nix/libstore/builtins.cc (builtins): Add “git-download”. * tests/derivations.scm ("built-in-builders"): Update. ("'git-download' built-in builder") ("'git-download' built-in builder, invalid hash") ("'git-download' built-in builder, invalid commit") ("'git-download' built-in builder, not found"): New tests. Ludovic Courtès