;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2021-2022 Ludovic Courtès ;;; ;;; 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 (tests-style) #:use-module (guix packages) #:use-module (guix scripts style) #:use-module ((guix utils) #:select (call-with-temporary-directory)) #:use-module ((guix build utils) #:select (substitute*)) #:use-module (guix gexp) ;for the reader extension #:use-module (guix diagnostics) #:use-module (gnu packages acl) #:use-module (gnu packages multiprecision) #:use-module (srfi srfi-1) #:use-module (srfi srfi-64) #:use-module (ice-9 match) #:use-module (ice-9 rdelim) #:use-module (ice-9 pretty-print)) (define (call-with-test-package inputs proc) (call-with-temporary-directory (lambda (directory) (call-with-output-file (string-append directory "/my-packages.scm") (lambda (port) (pretty-print `(begin (define-module (my-packages) #:use-module (guix) #:use-module (guix licenses) #:use-module (gnu packages acl) #:use-module (gnu packages base) #:use-module (gnu packages multiprecision) #:use-module (srfi srfi-1)) (define base (package (inherit coreutils) (inputs '()) (native-inputs '()) (propagated-inputs '()))) (define (sdl-union . lst) (package (inherit base) (name "sdl-union"))) (define-public my-coreutils (package (inherit base) ,@inputs (name "my-coreutils")))) port))) (proc directory)))) (define test-directory ;; Directory where the package definition lives. (make-parameter #f)) (define-syntax-rule (with-test-package fields exp ...) (call-with-test-package fields (lambda (directory) (define file (string-append directory "/my-packages.scm")) ;; Run as a separate process to make sure FILE is reloaded. (system* "guix" "style" "-L" directory "-S" "inputs" "my-coreutils") (system* "cat" file) (load file) (parameterize ((test-directory directory)) exp ...)))) (define* (read-lines port line #:optional (count 1)) "Read COUNT lines from PORT, starting from LINE." (let loop ((lines '()) (count count)) (cond ((< (port-line port) (- line 1)) (read-char port) (loop lines count)) ((zero? count) (string-concatenate-reverse lines)) (else (match (read-line port 'concat) ((? eof-object?) (loop lines 0)) (line (loop (cons line lines) (- count 1)))))))) (define* (read-package-field package field #:optional (count 1)) (let* ((location (package-field-location package field)) (file (location-file location)) (line (location-line location))) (call-with-input-file (if (string-prefix? "/" file) file (string-append (test-directory) "/" file)) (lambda (port) (read-lines port line count))))) (test-begin "style") (test-equal "nothing to rewrite" '() (with-test-package '() (package-direct-inputs (@ (my-packages) my-coreutils)))) (test-equal "input labels, mismatch" (list `(("foo" ,gmp) ("bar" ,acl)) " (inputs `((\"foo\" ,gmp) (\"bar\" ,acl)))\n") (with-test-package '((inputs `(("foo" ,gmp) ("bar" ,acl)))) (list (package-direct-inputs (@ (my-packages) my-coreutils)) (read-package-field (@ (my-packages) my-coreutils) 'inputs)))) (test-equal "input labels, simple" (list `(("gmp" ,gmp) ("acl" ,acl)) " (inputs (list gmp acl))\n") (with-test-package '((inputs `(("gmp" ,gmp) ("acl" ,acl)))) (list (package-direct-inputs (@ (my-packages) my-coreutils)) (read-package-field (@ (my-packages) my-coreutils) 'inputs)))) (test-equal "input labels, long list with one item per line" (list (concatenate (make-list 4 `(("gmp" ,gmp) ("acl" ,acl)))) "\ (list gmp acl gmp acl gmp acl gmp acl))\n") (with-test-package '((inputs `(("gmp" ,gmp) ("acl" ,acl) ("gmp" ,gmp) ("acl" ,acl) ("gmp" ,gmp) ("acl" ,acl) ("gmp" ,gmp) ("acl" ,acl)))) (list (package-direct-inputs (@ (my-packages) my-coreutils)) (read-package-field (@ (my-packages) my-coreutils) 'inputs 8)))) (test-equal "input labels, sdl-union" "\ (list gmp acl (sdl-union 1 2 3 4)))\n" (with-test-package '((inputs `(("gmp" ,gmp) ("acl" ,acl) ("sdl-union" ,(sdl-union 1 2 3 4))))) (read-package-field (@ (my-packages) my-coreutils) 'inputs 2))) (test-equal "input labels, output" (list `(("gmp" ,gmp "debug") ("acl" ,acl)) " (inputs (list `(,gmp \"debug\") acl))\n")
index 86e0598344..4c08679bc8 100644
--- a/gnu/packages/aspell.scm
+++ b/gnu/packages/aspell.scm
@@ -130,6 +130,14 @@ dictionaries, including personal ones.")
(base32
"01p92qj66cqb346gk7hjfynaap5sbcn85xz07kjfdq623ghr8v5s")))
+(define-public aspell-dict-el
+ (aspell-dictionary "el" "Greek"
+ #:version "0.08-0"
+ #:prefix "aspell6-"
+ #:sha256
+ (base32
+ "1ljcc30zg2v2h3w5h5jr5im41mw8jbsgvvhdd2cii2yzi8d0zxja")))
+
(define-public aspell-dict-en
(aspell-dictionary "en" "English"
#:version "2017.01.22-0"
@@ -159,12 +167,19 @@ dictionaries, including personal ones.")
(base32
"14ffy9mn5jqqpp437kannc3559bfdrpk7r36ljkzjalxa53i0hpr")))
-(define-public aspell-dict-ru
- (aspell-dictionary "ru" "Russian"
- #:version "0.99f7-1"
+(define-public aspell-dict-grc
+ (aspell-dictionary "grc" "Ancient Greek"
+ #:version "0.02-0"
#:sha256
(base32
- "0ip6nq43hcr7vvzbv4lwwmlwgfa60hrhsldh9xy3zg2prv6bcaaw")))
+ "1zxr8958v37v260fkqd4pg37ns5h5kyqm54hn1hg70wq5cz8h512")))
+
+(define-public aspell-dict-he
+ (aspell-dictionary "he" "Hebrew"
+ #:version "1.0-0"
+ #:sha256
+ (base32
+ "13bhbghx5b8g0119g3wxd4n8mlf707y41vlf59irxjj0kynankfn")))
(define-public aspell-dict-it
(aspell-dictionary "it" "Italian"
@@ -181,12 +196,20 @@ dictionaries, including personal ones.")
(base32
"0ffb87yjsh211hllpc4b9khqqrblial4pzi1h9r3v465z1yhn3j4")))
-(define-public aspell-dict-he
- (aspell-dictionary "he" "Hebrew"
- #:version "1.0-0"
+(define-public aspell-dict-pt-br
+ (aspell-dictionary "pt-br" "Brazilian Portuguese"
+ #:version "20090702-0"
+ #:prefix "aspell6-"
#:sha256
(base32
- "13bhbghx5b8g0119g3wxd4n8mlf707y41vlf59irxjj0kynankfn")))
+ "1y09lx9zf2rnp55r16b2vgj953l3538z1vaqgflg9mdvm555bz3p")))
+
+(define-public aspell-dict-ru
+ (aspell-dictionary "ru" "Russian"
+ #:version "0.99f7-1"
+ #:sha256
+ (base32
+ "0ip6nq43hcr7vvzbv4lwwmlwgfa60hrhsldh9xy3zg2prv6bcaaw")))
(define-public aspell-dict-sv
(aspell-dictionary "sv" "Swedish"
@@ -196,29 +219,6 @@ dictionaries, including personal ones.")
(base32
"02jwkjhr32kvyibnyzgx3smbnm576jwdzg3avdf6zxwckhy5fw4v")))
-(define-public aspell-dict-el
- (aspell-dictionary "el" "Greek"
- #:version "0.08-0"
- #:prefix "aspell6-"
- #:sha256
- (base32
- "1ljcc30zg2v2h3w5h5jr5im41mw8jbsgvvhdd2cii2yzi8d0zxja")))
-
-(define-public aspell-dict-grc
- (aspell-dictionary "grc" "Ancient Greek"
- #:version "0.02-0"
- #:sha256
- (base32
- "1zxr8958v37v260fkqd4pg37ns5h5kyqm54hn1hg70wq5cz8h512")))
-
-(define-public aspell-dict-pt-br
- (aspell-dictionary "pt-br" "Brazilian Portuguese"
- #:version "20090702-0"
- #:prefix "aspell6-"
- #:sha256
- (base32
- "1y09lx9zf2rnp55r16b2vgj953l3538z1vaqgflg9mdvm555bz3p")))
-
;;;
;;; Hunspell packages made from the Aspell word lists.
,acl)) "\ (inputs (list gmp ;; line comment! acl))\n") (call-with-test-package '((inputs `(("gmp" ,gmp) ("acl" ,acl)))) (lambda (directory) (define file (string-append directory "/my-packages.scm")) (substitute* file ((",gmp\\)(.*)$" _ rest) (string-append ",gmp)\n ;; line comment!\n" rest))) (system* "guix" "style" "-L" directory "-S" "inputs" "my-coreutils") (load file) (list (package-inputs (@ (my-packages) my-coreutils)) (read-package-field (@ (my-packages) my-coreutils) 'inputs 3))))) (test-equal "input labels, modify-inputs and margin comment" (list `(("gmp" ,gmp) ("acl" ,acl) ("mpfr" ,mpfr)) "\ (modify-inputs (package-propagated-inputs coreutils) (prepend gmp ;margin comment acl ;another one mpfr)))\n") (call-with-test-package '((inputs `(("gmp" ,gmp) ("acl" ,acl) ("mpfr" ,mpfr) ,@(package-propagated-inputs coreutils)))) (lambda (directory) (define file (string-append directory "/my-packages.scm")) (substitute* file ((",gmp\\)(.*)$" _ rest) (string-append ",gmp) ;margin comment" rest)) ((",acl\\)(.*)$" _ rest) (string-append ",acl) ;another one" rest))) (system* "guix" "style" "-L" directory "-S" "inputs" "my-coreutils") (load file) (list (package-inputs (@ (my-packages) my-coreutils)) (read-package-field (@ (my-packages) my-coreutils) 'inputs 4))))) (test-end) ;; Local Variables: ;; eval: (put 'with-test-package 'scheme-indent-function 1) ;; eval: (put 'call-with-test-package 'scheme-indent-function 1) ;; End: