~ruther/guix-local

9ff667ea05d0807b4e6512c92914ae517b9ec755 — John Soo 6 years ago b725090
gnu: Add dhall.

* gnu/packages/dhall.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
(dist_patch_DATA): Add new patch.
* gnu/packages/patches/dhall-remove-network-tests.patch: Add patch to remove
dhall network tests.

Signed-off-by: Leo Famulari <leo@famulari.name>
3 files changed, 232 insertions(+), 0 deletions(-)

M gnu/local.mk
A gnu/packages/dhall.scm
A gnu/packages/patches/dhall-remove-network-tests.patch
M gnu/local.mk => gnu/local.mk +2 -0
@@ 157,6 157,7 @@ GNU_SYSTEM_MODULES =				\
  %D%/packages/debian.scm			\
  %D%/packages/debug.scm			\
  %D%/packages/dejagnu.scm			\
  %D%/packages/dhall.scm			\
  %D%/packages/dico.scm				\
  %D%/packages/dictionaries.scm			\
  %D%/packages/diffoscope.scm			\


@@ 862,6 863,7 @@ dist_patch_DATA =						\
  %D%/packages/patches/desmume-gcc6-fixes.patch			\
  %D%/packages/patches/desmume-gcc7-fixes.patch			\
  %D%/packages/patches/dfu-programmer-fix-libusb.patch		\
  %D%/packages/patches/dhall-remove-network-tests.patch		\
  %D%/packages/patches/diffutils-gets-undeclared.patch		\
  %D%/packages/patches/dkimproxy-add-ipv6-support.patch		\
  %D%/packages/patches/docbook-xsl-nonrecursive-string-subst.patch	\

A gnu/packages/dhall.scm => gnu/packages/dhall.scm +133 -0
@@ 0,0 1,133 @@
;;; Copyright © 2020 John Soo <jsoo1@asu.edu>
;;;
;;; 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 (gnu packages dhall)
  #:use-module (gnu packages)
  #:use-module (gnu packages haskell-xyz)
  #:use-module (gnu packages haskell-check)
  #:use-module (gnu packages haskell-crypto)
  #:use-module (gnu packages haskell-web)
  #:use-module (guix download)
  #:use-module (guix build-system haskell)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages))

(define-public dhall
  (package
    (name "dhall")
    (version "1.31.1")
    (source
     (origin
       (method url-fetch)
       (uri (string-append
             "https://hackage.haskell.org/package/dhall/dhall-"
             version
             ".tar.gz"))
       (sha256
        (base32
         "18v7vvcbcm9s7slh6h43rj9yakkkxwnwgj6kv84i6qzd2j7d80mc"))
       (patches (search-patches "dhall-remove-network-tests.patch"))))
    (build-system haskell-build-system)
    (inputs
     `(("ghc-aeson" ,ghc-aeson)
       ("ghc-aeson-pretty" ,ghc-aeson-pretty)
       ("ghc-ansi-terminal" ,ghc-ansi-terminal)
       ("ghc-atomic-write" ,ghc-atomic-write-0.2.0.7)
       ("ghc-case-insensitive" ,ghc-case-insensitive)
       ("ghc-cborg" ,ghc-cborg)
       ("ghc-cborg-json" ,ghc-cborg-json)
       ("ghc-contravariant" ,ghc-contravariant)
       ("ghc-data-fix" ,ghc-data-fix)
       ("ghc-diff" ,ghc-diff)
       ("ghc-dotgen" ,ghc-dotgen)
       ("ghc-either" ,ghc-either)
       ("ghc-exceptions" ,ghc-exceptions)
       ("ghc-hashable" ,ghc-hashable)
       ("ghc-lens-family-core" ,ghc-lens-family-core)
       ("ghc-megaparsec" ,ghc-megaparsec)
       ("ghc-memory" ,ghc-memory)
       ("ghc-network-uri" ,ghc-network-uri)
       ("ghc-optparse-applicative" ,ghc-optparse-applicative)
       ("ghc-parsers" ,ghc-parsers)
       ("ghc-parser-combinators" ,ghc-parser-combinators)
       ("ghc-prettyprinter" ,ghc-prettyprinter-1.6)
       ("ghc-prettyprinter-ansi-terminal" ,ghc-prettyprinter-ansi-terminal)
       ("ghc-pretty-simple" ,ghc-pretty-simple)
       ("ghc-profunctors" ,ghc-profunctors)
       ("ghc-repline" ,ghc-repline-0.3)
       ("ghc-serialise" ,ghc-serialise)
       ("ghc-scientific" ,ghc-scientific)
       ("ghc-text-manipulate" ,ghc-text-manipulate)
       ("ghc-th-lift-instances" ,ghc-th-lift-instances)
       ("ghc-transformers-compat" ,ghc-transformers-compat)
       ("ghc-unordered-containers" ,ghc-unordered-containers)
       ("ghc-uri-encode" ,ghc-uri-encode)
       ("ghc-vector" ,ghc-vector)
       ("ghc-cryptonite" ,ghc-cryptonite)
       ("ghc-http-types" ,ghc-http-types)
       ("ghc-http-client" ,ghc-http-client)
       ("ghc-http-client-tls" ,ghc-http-client-tls)))
    (native-inputs
     `(("ghc-foldl" ,ghc-foldl)
       ("ghc-generic-random" ,ghc-generic-random-1.3.0.1)
       ("ghc-quickcheck" ,ghc-quickcheck)
       ("ghc-quickcheck-instances" ,ghc-quickcheck-instances)
       ("ghc-semigroups" ,ghc-semigroups)
       ("ghc-special-values" ,ghc-special-values)
       ("ghc-spoon" ,ghc-spoon)
       ("ghc-tasty" ,ghc-tasty)
       ("ghc-tasty-expected-failure" ,ghc-tasty-expected-failure)
       ("ghc-tasty-hunit" ,ghc-tasty-hunit)
       ("ghc-tasty-quickcheck" ,ghc-tasty-quickcheck)
       ("ghc-turtle" ,ghc-turtle)
       ("ghc-mockery" ,ghc-mockery)
       ("ghc-doctest" ,ghc-doctest)))
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         ;; Remove tests that require network
         (add-after 'unpack 'remove-more-tests
           (lambda _
             (substitute* "src/Dhall/Tutorial.hs"
               (((string-append
                  "-- >>> input auto "
                  "\"https://raw.githubusercontent.com/dhall-lang"
                  "/dhall-haskell/18e4e9a18dc53271146df3ccf5b4177c3552236b/"
                  "examples/True\" :: IO Bool"))
                "")
               (((string-append
                  "-- >>> input auto "
                  "\"False == "
                  "https://raw.githubusercontent.com/dhall-lang"
                  "/dhall-haskell/18e4e9a18dc53271146df3ccf5b4177c3552236b/"
                  "examples/True\" :: IO Bool"))
                ""))
             #t)))))
    (home-page
     "https://dhall-lang.org/")
    (synopsis
     "Configuration language guaranteed to terminate")
    (description
     "Dhall is an explicitly typed configuration language that is not Turing
complete.  Despite being Turing incomplete, Dhall is a real programming
language with a type-checker and evaluator.

Use this library to parse, type-check, evaluate, and pretty-print the Dhall
configuration language.  This package also includes an executable which
type-checks a Dhall file and reduces the file to a fully evaluated normal
form.")
    (license license:bsd-3)))

A gnu/packages/patches/dhall-remove-network-tests.patch => gnu/packages/patches/dhall-remove-network-tests.patch +97 -0
@@ 0,0 1,97 @@
diff a/dhall-lang/tests/import/failure/referentiallyInsane.dhall b/dhall-lang/tests/import/failure/referentiallyInsane.dhall
--- a/dhall-lang/tests/import/failure/referentiallyInsane.dhall
+++ /dev/null
@@ -1,13 +0,0 @@
-{- The following remote import attempts to import an environment variable, which
-   must be disallowed by the referential sanity check
-
-   One reason for doing this is to protect against remote imports exfiltrating
-   environment variables (such as via custom headers).  Only referentially
-   opaque imports (i.e. local imports) have permission to refer to other
-   referentially opaque imports in order to protect against this attack.
-
-   The referential sanity check also ensures that remote imports are
-   referentially transparent.  Or in other words, any import that is globally
-   addressable must have a meaning that is not context-sensitive.
--}
-https://raw.githubusercontent.com/dhall-lang/dhall-lang/master/tests/import/data/referentiallyOpaque.dhall
diff a/dhall-lang/tests/import/success/customHeadersA.dhall b/dhall-lang/tests/import/success/customHeadersA.dhall
--- a/dhall-lang/tests/import/success/customHeadersA.dhall
+++ /dev/null
@@ -1,3 +0,0 @@
-https://httpbin.org/user-agent
-  using [ { mapKey = "User-Agent", mapValue = "Dhall" } ]
-  as Text
diff a/dhall-lang/tests/import/success/noHeaderForwardingA.dhall b/dhall-lang/tests/import/success/noHeaderForwardingA.dhall
--- a/dhall-lang/tests/import/success/noHeaderForwardingA.dhall
+++ /dev/null
@@ -1,6 +0,0 @@
-{- The purpose of this test is to verify that the custom headers supplied to
-   this import are not forwarded to the transitive import of
-   https://httpbin.org/user-agent
--}
-https://raw.githubusercontent.com/dhall-lang/dhall-lang/master/tests/import/success/customHeadersA.dhall
-  using [ { mapKey = "User-Agent", mapValue = "Secret" } ]
diff a/dhall-lang/tests/import/success/unit/RemoteAsTextA.dhall b/dhall-lang/tests/import/success/unit/RemoteAsTextA.dhall
--- a/dhall-lang/tests/import/success/unit/RemoteAsTextA.dhall
+++ /dev/null
@@ -1 +0,0 @@
-https://raw.githubusercontent.com/dhall-lang/dhall-lang/0b983b92aa2222dc3e292c20550ee37dea3f41df/tests/import/data/example.txt as Text
diff a/dhall-lang/tests/import/success/unit/SimpleRemoteA.dhall b/dhall-lang/tests/import/success/unit/SimpleRemoteA.dhall
--- a/dhall-lang/tests/import/success/unit/SimpleRemoteA.dhall
+++ /dev/null
@@ -1 +0,0 @@
-https://raw.githubusercontent.com/dhall-lang/dhall-lang/0b983b92aa2222dc3e292c20550ee37dea3f41df/tests/import/data/simple.dhall
diff a/dhall-lang/tests/import/success/unit/asLocation/RemoteChain1A.dhall b/dhall-lang/tests/import/success/unit/asLocation/RemoteChain1A.dhall
--- a/dhall-lang/tests/import/success/unit/asLocation/RemoteChain1A.dhall
+++ /dev/null
@@ -1 +0,0 @@
-https://raw.githubusercontent.com/dhall-lang/dhall-lang/0b983b92aa2222dc3e292c20550ee37dea3f41df/tests/import/data/simpleLocation.dhall
diff a/dhall-lang/tests/import/success/unit/asLocation/RemoteChain2A.dhall b/dhall-lang/tests/import/success/unit/asLocation/RemoteChain2A.dhall
--- a/dhall-lang/tests/import/success/unit/asLocation/RemoteChain2A.dhall
+++ /dev/null
@@ -1 +0,0 @@
-https://raw.githubusercontent.com/Nadrieril/dhall-rust/f7d8c64a9799f139ad65427c2518376adb9e2e2f/dhall/tests/import/success/unit/asLocation/Canonicalize3A.dhall
diff a/dhall-lang/tests/import/success/unit/asLocation/RemoteChain3A.dhall b/dhall-lang/tests/import/success/unit/asLocation/RemoteChain3A.dhall
--- a/dhall-lang/tests/import/success/unit/asLocation/RemoteChain3A.dhall
+++ /dev/null
@@ -1 +0,0 @@
-https://raw.githubusercontent.com/Nadrieril/dhall-rust/f7d8c64a9799f139ad65427c2518376adb9e2e2f/dhall/tests/import/success/unit/asLocation/Canonicalize5A.dhall
diff a/dhall-lang/tests/import/success/unit/asLocation/RemoteChainEnvA.dhall b/dhall-lang/tests/import/success/unit/asLocation/RemoteChainEnvA.dhall
--- a/dhall-lang/tests/import/success/unit/asLocation/RemoteChainEnvA.dhall
+++ /dev/null
@@ -1,5 +0,0 @@
-{-
-    This test verifies that `env:VAR as Location` isn't rejected as referentially opaque,
-    as `env:VAR` on its own would.
--}
-https://raw.githubusercontent.com/Nadrieril/dhall-rust/f7d8c64a9799f139ad65427c2518376adb9e2e2f/dhall/tests/import/success/unit/asLocation/EnvA.dhall
diff a/dhall-lang/tests/import/success/unit/asLocation/RemoteChainMissingA.dhall b/dhall-lang/tests/import/success/unit/asLocation/RemoteChainMissingA.dhall
--- a/dhall-lang/tests/import/success/unit/asLocation/RemoteChainMissingA.dhall
+++ /dev/null
@@ -1,6 +0,0 @@
-{- This test verifies that `missing as Location` succeeds when chained since:
-   * The `missing` is never actually resolved (due to the `as Location`)
-   * The `missing` should be treated as referentially transparent (and therefore
-     be a valid transitive dependency of a remote import)
--}
-https://raw.githubusercontent.com/Nadrieril/dhall-rust/f7d8c64a9799f139ad65427c2518376adb9e2e2f/dhall/tests/import/success/unit/asLocation/MissingA.dhall
diff a/dhall-lang/tests/type-inference/success/CacheImportsA.dhall b/dhall-lang/tests/type-inference/success/CacheImportsA.dhall
--- a/dhall-lang/tests/type-inference/success/CacheImportsA.dhall
+++ /dev/null
@@ -1,6 +0,0 @@
-{-
-    This URL returns (probably) a different result for each request. This test
-    ensures that import results for a given URL are correctly cached within an
-    execution of dhall.
--}
-let _ = assert : https://csrng.net/csrng/csrng.php?min=0&max=1000 as Text === https://csrng.net/csrng/csrng.php?min=0&max=1000 as Text in 0
diff a/dhall-lang/tests/type-inference/success/CacheImportsCanonicalizeA.dhall b/dhall-lang/tests/type-inference/success/CacheImportsCanonicalizeA.dhall
--- a/dhall-lang/tests/type-inference/success/CacheImportsCanonicalizeA.dhall
+++ /dev/null
@@ -1,5 +0,0 @@
-{-
-    This URL returns (probably) a different result for each request. This test
-    ensures that import locations are canonicalized before being cached.
--}
-let _ = assert : https://csrng.net/csrng/csrng.php?min=0&max=1000 as Text === https://csrng.net/csrng/../csrng/csrng.php?min=0&max=1000 as Text in 0