;;; 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") gnu/packages/elixir.scm, gnu/packages/emacs-xyz.scm, gnu/packages/emacs.scm, gnu/packages/enlightenment.scm, gnu/packages/erlang.scm, gnu/packages/fonts.scm, gnu/packages/fontutils.scm, gnu/packages/forth.scm, gnu/packages/fvwm.scm, gnu/packages/games.scm, gnu/packages/gl.scm, gnu/packages/gnome.scm, gnu/packages/gnunet.scm, gnu/packages/gnupg.scm, gnu/packages/gtk.scm, gnu/packages/guile-wm.scm, gnu/packages/guile-xyz.scm, gnu/packages/haskell-apps.scm, gnu/packages/haskell-check.scm, gnu/packages/haskell-crypto.scm, gnu/packages/haskell-xyz.scm, gnu/packages/haskell.scm, gnu/packages/image-viewers.scm, gnu/packages/image.scm, gnu/packages/irc.scm, gnu/packages/language.scm, gnu/packages/libcanberra.scm, gnu/packages/linux.scm, gnu/packages/lisp-xyz.scm, gnu/packages/lisp.scm, gnu/packages/lolcode.scm, gnu/packages/lxde.scm, gnu/packages/lxqt.scm, gnu/packages/mail.scm, gnu/packages/markup.scm, gnu/packages/mate.scm, gnu/packages/maths.scm, gnu/packages/mc.scm, gnu/packages/messaging.scm, gnu/packages/music.scm, gnu/packages/ncurses.scm, gnu/packages/networking.scm, gnu/packages/nickle.scm, gnu/packages/openbox.scm, gnu/packages/pdf.scm, gnu/packages/perl-check.scm, gnu/packages/perl.scm, gnu/packages/python-compression.scm, gnu/packages/python-crypto.scm, gnu/packages/python-web.scm, gnu/packages/python-xyz.scm, gnu/packages/python.scm, gnu/packages/qt.scm, gnu/packages/ruby.scm, gnu/packages/rust.scm, gnu/packages/scheme.scm, gnu/packages/serialization.scm, gnu/packages/shells.scm, gnu/packages/ssh.scm, gnu/packages/suckless.scm, gnu/packages/tbb.scm, gnu/packages/telephony.scm, gnu/packages/text-editors.scm, gnu/packages/textutils.scm, gnu/packages/time.scm, gnu/packages/tls.scm, gnu/packages/tor.scm, gnu/packages/version-control.scm, gnu/packages/video.scm, gnu/packages/vim.scm, gnu/packages/web.scm, gnu/packages/wm.scm, gnu/packages/xdisorg.scm, gnu/packages/xfce.scm, gnu/packages/xml.scm, gnu/packages/xorg.scm, gnu/services/certbot.scm, gnu/services/desktop.scm, gnu/services/version-control.scm, gnu/services/web.scm, guix/import/hackage.scm, guix/licenses.scm: Likewise. Signed-off-by: Efraim Flashner <efraim@flashner.co.il> nikita 2020-03-28Update email address and Savannah handle for Amin Bandali....* .mailmap, gnu/local.mk, gnu/packages/emacs-xyz.scm, gnu/packages/emacs.scm, gnu/packages/fonts.scm, gnu/packages/fpga.scm, gnu/packages/lean.scm, gnu/packages/maths.scm, gnu/packages/pulseaudio.scm: Update my email address. * build-aux/git-authenticate.scm: Update my Savannah handle. Amin Bandali 2020-02-09Update e-mail address for Jakob L. Kreuze....As requested here: <https://lists.gnu.org/archive/html/guix-devel/2020-02/msg00128.html>. * .mailmap: Add an entry for Jakob. * gnu/machine.scm, gnu/machine/digital-ocean.scm, gnu/machine/ssh.scm, gnu/packages/admin.scm, gnu/packages/i2p.scm, gnu/packages/music.scm, gnu/packages/web.scm, gnu/tests/reconfigure.scm, guix/scripts/deploy.scm, guix/scripts/system/reconfigure.scm: Update their e-mail address. Tobias Geerinckx-Rice