;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2020 Giacomo Leidi ;;; ;;; 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 (gnu packages hunspell) #:use-module (guix build-system trivial) #:use-module (guix download) #:use-module (guix git-download) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (ice-9 match) #:use-module (gnu packages libreoffice)) (define* (hunspell-dictionary dict-name full-name #:key synopsis home-page license) (package (name (string-append "hunspell-dict-" ;; Downcase and replace underscore in package names ;; to follow Guix naming conventions. (string-map (match-lambda (#\_ #\-) (chr chr)) (string-downcase dict-name)))) (version (package-version libreoffice)) (source (origin (method git-fetch) (uri (git-reference (url (string-append "https://anongit.freedesktop.org/git/" "libreoffice/dictionaries.git/")) (commit (string-append "libreoffice-" version)))) (file-name (git-file-name "libreoffice-dictionaries" version)) (sha256 (base32 "0vvxnjpm1322ahf9q8bqs1yhkn7krglw8c6yazcf7a3jljykd9k9")))) (build-system trivial-build-system) (native-inputs `(("source" ,source))) (arguments `(#:modules ((guix build utils)) #:builder (begin (use-modules (guix build utils)) (let* ((dictionary (string-append (assoc-ref %build-inputs "source") "/" ,dict-name "/" ,dict-name)) (hunspell (string-append %output "/share/hunspell/")) (myspell (string-append %output "/share/myspell"))) (for-each (lambda (ext) (install-file (string-append dictionary ext) hunspell)) '(".aff" ".dic")) (symlink hunspell myspell) #t)))) (synopsis synopsis) (description "This package provides a dictionary for the Hunspell spell-checking library.") (license license) (home-page home-page))) (define-public hunspell-dict-it-it (let ((synopsis identity)) (hunspell-dictionary "it_IT" "Italian" #:synopsis (synopsis "Hunspell dictionary for Italian") #:home-page "https://www.libreitalia.org/" #:license license:gpl3))) .scm (%deduplication-minimum-size): New variable. (deduplicate)[loop]: Do not recurse when FILE's size is below %DEDUPLICATION-MINIMUM-SIZE. (dump-port): New procedure. (dump-file/deduplicate)[hash]: Turn into... [dump-and-compute-hash]: ... this thunk. Call 'deduplicate' only when SIZE is greater than %DEDUPLICATION-MINIMUM-SIZE; otherwise call 'dump-port'. * nix/libstore/gc.cc (LocalStore::removeUnusedLinks): Drop files where st.st_size < deduplicationMinSize. * nix/libstore/local-store.hh (deduplicationMinSize): New declaration. * nix/libstore/optimise-store.cc (deduplicationMinSize): New variable. (LocalStore::optimisePath_): Return when PATH is a symlink or smaller than 'deduplicationMinSize'. * tests/derivations.scm ("identical files are deduplicated"): Produce files bigger than %DEDUPLICATION-MINIMUM-SIZE. * tests/nar.scm ("restore-file-set with directories (signed, valid)"): Likewise. * tests/store-deduplication.scm ("deduplicate, below %deduplication-minimum-size"): New test. ("deduplicate", "deduplicate, ENOSPC"): Produce files bigger than %DEDUPLICATION-MINIMUM-SIZE. * tests/store.scm ("substitute, deduplication"): Likewise. Ludovic Courtès 2021-03-06tests: do not hard code HTTP ports...Previously, test cases could fail if some process was listening at a hard-coded port. This patch eliminates most of these potential failures, by automatically assigning an unbound port. This should allow for building multiple guix trees in parallel outside a build container, though this is currently untested. The test "home-page: Connection refused" in tests/lint.scm still hardcodes port 9999, however. * guix/tests/http.scm (http-server-can-listen?): remove now unused procedure. (%http-server-port): default to port 0, meaning the OS will automatically choose a port. (open-http-server-socket): remove the false statement claiming this procedure is exported and also return the allocated port number. (%local-url): raise an error if the port is obviously unbound. (call-with-http-server): set %http-server-port to the allocated port while the thunk is called. * tests/derivations.scm: adjust test cases to use automatically assign a port. As there is no risk of a port conflict now, do not make any tests conditional upon 'http-server-can-listen?' anymore. * tests/elpa.scm: likewise. * tests/lint.scm: likewise, and add a TODO comment about a port that is still hard-coded. * tests/texlive.scm: likewise. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Maxime Devos