From bb6419f3745911aec87ad79c55bb953b36f246dd Mon Sep 17 00:00:00 2001 From: Timothy Sample Date: Thu, 30 Aug 2018 22:08:59 -0400 Subject: build-system: haskell: Add #:cabal-revision argument. Add a #:cabal-revision argument for specifying which Cabal file revision from Hackage should be used. * guix/build-system/haskell.scm (source-url->revision-url): New function. (lower): Accept a cabal-revision keyword argument, convert it to an origin record, and add it to the resulting bag's host-inputs. (haskell-build): Pass the cabal-revision input to the builder as an argument. * guix/build/haskell-build-system.scm (patch-cabal-file): New phase. (%standard-phases): Add it. --- guix/build/haskell-build-system.scm | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'guix/build/haskell-build-system.scm') diff --git a/guix/build/haskell-build-system.scm b/guix/build/haskell-build-system.scm index 26519ce5a6..be4f5b583b 100644 --- a/guix/build/haskell-build-system.scm +++ b/guix/build/haskell-build-system.scm @@ -27,6 +27,7 @@ #:use-module (ice-9 regex) #:use-module (ice-9 match) #:use-module (ice-9 vlist) + #:use-module (ice-9 ftw) #:export (%standard-phases haskell-build)) @@ -265,8 +266,19 @@ given Haskell package." (run-setuphs "haddock" haddock-flags) #t)) +(define* (patch-cabal-file #:key cabal-revision #:allow-other-keys) + (when cabal-revision + ;; Cabal requires there to be a single file with the suffix ".cabal". + (match (scandir "." (cut string-suffix? ".cabal" <>)) + ((original) + (format #t "replacing ~s with ~s~%" original cabal-revision) + (copy-file cabal-revision original)) + (_ (error "Could not find a Cabal file to patch.")))) + #t) + (define %standard-phases (modify-phases gnu:%standard-phases + (add-after 'unpack 'patch-cabal-file patch-cabal-file) (delete 'bootstrap) (add-before 'configure 'setup-compiler setup-compiler) (add-before 'install 'haddock haddock) -- cgit v1.2.3