aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
;;;
;;; 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 (test-cran)
  #:use-module (gnu packages statistics)
  #:use-module (guix import cran)
  #:use-module (guix tests)
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-64)
  #:use-module (srfi srfi-26)
  #:use-module (ice-9 match))

(define description "
Package: My-Example
Type: Package
Title: Example package
Version: 1.2.3
Date: 2015-12-10
Author: Ricardo Wurmus
Maintainer: Guix Schmeeks <guix@gnu.org>
URL: http://gnu.org/s/my-example
Description: This is a long description
spanning multiple lines: and it could confuse the parser that this line is very long or perhaps the fact that
there is a colon : on the lines.
  And: this line continues the description.
biocViews: 0
SystemRequirements: Cairo (>= 0)
Depends: A C++11 compiler. Version 4.6.* of g++ (as
	currently in Rtools) is insufficient; versions 4.8.*, 4.9.* or
	later will be fine.
License: GPL (>= 3)
Imports: Rcpp (>= 0.11.5), proto, Scales
LinkingTo: Rcpp, BH
NeedsCompilation: yes
Repository: CRAN
Date/Publication: 2015-07-14 14:15:16
")

(define description-alist
  (description->alist description))

(define simple-alist
  '(("Key"        . "Value")
    ("SimpleList" . "R, Rcpp, something, whatever")
    ("BadList"    . "This is not a real list, you know?")
    ("List"       . "R (>= 2.2), BH (for no reason), GenomicRanges")))

(test-begin "cran")

(test-assert "description->alist: contains all valid keys"
  (let ((keys '("Package" "Type" "Title" "Version" "Date"
                "Author" "Maintainer" "URL" "Description"
                "SystemRequirements" "Depends" "License"
                "Imports" "biocViews" "LinkingTo"
                "NeedsCompilation" "Repository"
                "Date/Publication")))
    (lset= string=? keys (map car description-alist))))

(test-equal "listifyx: return empty list if key cannot be found"
  '()
  ((@@ (guix import cran) listify) simple-alist "Letters"))

(test-equal "listify: split comma-separated value into elements"
  '("R" "Rcpp" "something" "whatever")
  ((@@ (guix import cran) listify) simple-alist "SimpleList"))

(test-equal "listify: strip off parentheses"
  '("R" "BH" "GenomicRanges")
  ((@@ (guix import cran) listify) simple-alist "List"))

(test-equal "listify: ignore values that are no lists"
  '()
  ((@@ (guix import cran) listify) simple-alist "BadList"))

(test-equal "r-mininal is not a cran package"
  #f
  ((@@ (guix import cran) cran-package?) r-minimal))

(test-assert "description->package"
  ;; Replace network resources with sample data.
  (mock ((guix build download) url-fetch
         (lambda* (url file-name
                       #:key
                       (mirrors '()) verify-certificate?)
           (with-output-to-file file-name
             (lambda ()
               (display
                (match url
                  ("mirror://cran/src/contrib/My-Example_1.2.3.tar.gz"
                   "source")
                  (_ (error "Unexpected URL: " url))))))))
    (match (description->package 'cran description-alist)
      (('package
         ('name "r-my-example")
         ('version "1.2.3")
         ('source ('origin
                    ('method 'url-fetch)
                    ('uri ('cran-uri "My-Example" 'version))
                    ('sha256
                     ('base32
                      (? string? hash)))))
         ('properties ('quasiquote (('upstream-name . "My-Example"))))
         ('build-system 'r-build-system)
         ('inputs ('list 'cairo))
         ('propagated-inputs
          ('list 'r-bh 'r-proto 'r-rcpp 'r-scales))
         ('home-page "http://gnu.org/s/my-example")
         ('synopsis "Example package")
         ('description
          "\
This is a long description spanning multiple lines: and it could confuse the
parser that this line is very long or perhaps the fact that there is a colon :
on the lines.  And: this line continues the description.")
         ('license 'gpl3+))
       #t)
      (x
       (begin
         (format #t "~s\n" x)
         (pk 'fail x #f))))))

(test-end "cran")
ng.scm, gnu/packages/synergy.scm, gnu/packages/telephony.scm, gnu/packages/terminals.scm, gnu/packages/tex.scm, gnu/packages/texinfo.scm, gnu/packages/text-editors.scm, gnu/packages/textutils.scm, gnu/packages/time.scm, gnu/packages/tmux.scm, gnu/packages/tor.scm, gnu/packages/toys.scm, gnu/packages/version-control.scm, gnu/packages/video.scm, gnu/packages/vim.scm, gnu/packages/virtualization.scm, gnu/packages/vlang.scm, gnu/packages/vnc.scm, gnu/packages/vpn.scm, gnu/packages/web-browsers.scm, gnu/packages/web.scm, gnu/packages/wireservice.scm, gnu/packages/wm.scm, gnu/packages/wxwidgets.scm, gnu/packages/xdisorg.scm, gnu/packages/xml.scm, gnu/packages/xorg.scm, tests/lint.scm: Remove trailing ".git" from 'git-reference' URL. Ludovic Courtès 2020-07-08gnu: ibus-rime: Fix license....* gnu/packages/ibus.scm (ibus-rime)[license]: Change license to GPLv3. Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr> Peng Mei Yu 2020-07-08gnu: rime-data: Fix license....* gnu/packages/ibus.scm (rime-data)[license]: Change license to LGPLv3. Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr> Peng Mei Yu 2020-07-08gnu: rime-data: Disable git operations and update comments....* gnu/packages/ibus.scm (rime-data)[arguments]: Disable git operations and update comments. Suppress warnings during build. Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr> Peng Mei Yu 2020-07-08gnu: rime-data: Iterate over inputs to find Rime schemas....* gnu/packages/ibus.scm (rime-data)[arguments]: Iterate over inputs to find Rime schemas rather than using a pre-loaded list. [native-inputs]: Move to ... [inputs]: ... here. Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr> Peng Mei Yu 2020-07-08gnu: rime-data: Update to 0.38.20200623....* gnu/packages/ibus.scm (rime-data): Update to 0.38.20200623. [native-inputs]: Add rime-cantonese. Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr> Peng Mei Yu 2020-04-04gnu: IBus: Build with 'gettext-minimal'....* gnu/packages/ibus.scm (ibus)[native-inputs]: Change from GNU-GETTEXT to GETTEXT-MINIMAL. Marius Bakke 2020-04-04gnu: ibus: Make some inputs native....* gnu/packages/ibus.scm (ibus)[inputs]: Move gettext from here... [native-inputs]: ...to here. Signed-off-by: Mathieu Othacehe <m.othacehe@gmail.com> Vincent Legoll 2020-03-04gnu: ibus: Update to 1.5.22....* gnu/packages/ibus.scm (ibus): Update to 1.5.22. Marius Bakke 2020-02-03gnu: ibus: Use new ucd package....* gnu/packages/ibus.scm (ibus)[native-inputs]: Add ucd; remove unicode-nameslist and unicode-blocks. [arguments]: Update configure flags and remove prepare-ucd-dir phase. Signed-off-by: Ricardo Wurmus <rekado@elephly.net> Leo Prikler 2020-02-03gnu: ibus: Disable parallel build....* gnu/packages/ibus.scm (ibus)[arguments]: Disable parallel build. Signed-off-by: Ricardo Wurmus <rekado@elephly.net> Leo Prikler 2020-02-03gnu: ibus: Build with emoji support....* gnu/packages/ibus.scm (ibus)[native-inputs]: Add unicode-emoji and unicode-cldr-common. [arguments]<configure-flags>: Use list instead of quote. Add flags for unicode-emoji-dir and emoji-annotation-dir. Signed-off-by: Ricardo Wurmus <rekado@elephly.net> Leo Prikler 2020-01-06gnu: ibus-rime: Record the right file name in "rime.xml"....* gnu/packages/ibus.scm (ibus-rime)[arguments]: Add 'fix-file-names' phase. Co-authored-by: Ludovic Courtès <ludo@gnu.org> kanichos@yandex.ru 2020-01-03gnu: Add ibus-libhangul....* gnu/packages/ibus.scm (ibus-libhangul): New variable. Signed-off-by: Ricardo Wurmus <rekado@elephly.net> kanichos@yandex.ru 2020-01-03gnu: Add libhangul....* gnu/packages/ibus.scm (libhangul): New variable. Signed-off-by: Ricardo Wurmus <rekado@elephly.net> kanichos@yandex.ru 2020-01-02gnu: ibus: Update to 1.5.21....* gnu/packages/ibus.scm (ibus): Update to 1.5.21. Ricardo Wurmus 2020-01-01gnu: ibus: Fix substitution....* gnu/packages/ibus.scm (ibus)[arguments]: Fix command substitution. Signed-off-by: Ricardo Wurmus <rekado@elephly.net> kanichos@yandex.ru 2019-11-11gnu: ibus-libpinyin: Update to 1.11.1....* gnu/packages/ibus.scm (ibus-libpinyin): Update to 1.11.1. Tobias Geerinckx-Rice 2019-07-31gnu: Remove workarounds for <https://bugs.gnu.org/36721>....These are no longer needed since 941ef1a1e54893ca917ebbaa4b8cc14b5ce9b75c. * gnu/packages/compression.scm (innoextract)[arguments]: Remove "-DBoost_NO_BOOST_CMAKE=ON" from <#:configure-flags>. * gnu/packages/game-development.scm (openmw)[arguments]: Likewise. * gnu/packages/games.scm (supertux, colobot, leela-zero)[arguments]: Likewise. * gnu/packages/graphics.scm (openimageio)[arguments]: Likewise. * gnu/packages/ibus.scm (librime)[arguments]: Likewise. Marius Bakke 2019-07-19gnu: librime: Update to 1.5.3....* gnu/packages/ibus.scm (librime): Update to 1.5.3. [arguments]: Add <#:configure-flags>. Marius Bakke 2019-06-20gnu: Replace uses of 'cmake' with 'cmake-minimal'....This follows up commit 2f33a7321e5e37d37f57c229c8079cb4ffd10834 which introduced a new CMAKE-MINIMAL variant for use in package inputs. * gnu/packages/databases.scm (python-pyarrow)[native-inputs]: Replace CMAKE with CMAKE-MINIMAL. * gnu/packages/emacs-xyz.scm (emacs-scel)[native-inputs]: Likewise. * gnu/packages/firmware.scm (ath9k-htc-firmware)[native-inputs]: Likewise. * gnu/packages/games.scm (0ad, the-butterfly-effect)[native-inputs]: Likewise. * gnu/packages/gnome.scm (deja-dup)[native-inputs]: Likewise. * gnu/packages/ibus.scm (ibus-rime)[native-inputs]: Likewise. * gnu/packages/rust.scm (rust-1.19)[native-inputs]: Likewise. * gnu/packages/simulation.scm (fenics)[native-inputs]: Likewise. * gnu/packages/squirrel.scm (squirrel)[native-inputs]: Likewise. * gnu/packages/video.scm (handbrake)[native-inputs]: Likewise. * gnu/packages/virtualization.scm (xen)[native-inputs]: Likewise. * gnu/packages/vulkan.scm (shaderc)[native-inputs]: Likewise. Marius Bakke 2019-04-20gnu: ibus-libpinyin: Add missing runtime input....* gnu/packages/ibus.scm (ibus-libpinyin)[inputs]: Add python-pygobject. Ricardo Wurmus 2019-04-20gnu: libpinyin: Update to 2.3.0....* gnu/packages/ibus.scm (libpinyin): Update to 2.3.0. Ricardo Wurmus 2019-04-20gnu: ibus-libpinyin: Update to 1.11.0....* gnu/packages/ibus.scm (ibus-libpinyin): Update to 1.11.0. Ricardo Wurmus 2019-04-20gnu: ibus: Update to 1.5.20....* gnu/packages/ibus.scm (ibus): Update to 1.5.20. [arguments]: Remove make-flags; remove "--disable-python2" from configure-flags; add build phase "patch-python-target-directories". [inputs]: Replace intltool with gnu-gettext. Ricardo Wurmus 2019-03-10gnu: ibus: Update Unicode data to 12.0.0....* gnu/packages/ibus.scm (ibus)[native-inputs]: Use versioned URLs for Unicode data and update hashes. Tobias Geerinckx-Rice