Importing haskell packages from hackage doesn't apply metadata revisions
(address . bug-guix@gnu.org)
The hackage store of haskell packages allows maintainers to update package metadata directly on hackage without updating the associated archive of a package. For instance, the cabal file of the integer-logarithms package version 1.0.3 [0] has been updated since 1.0.3 was published, relaxing the constraints on some dependencies[1]. This means that, if I try to build the attached integer-logarithms.scm (created from guix import hackage integer-logarithms and modified to use ghc-8.8) I get the following error:
```
Setup.hs: Encountered missing or private dependencies:
base >=4.3 && <4.13
command "runhaskell" "Setup.hs" "configure" "--prefix=/gnu/store/lssajarfg1vr6xbhi5dfvnn3xs01v3bz-ghc-integer-logarithms-bootstrap-1.0.3" "--libdir=/gnu/store/lssajarfg1vr6xbhi5dfvnn3xs01v3bz-ghc-integer-logarithms-bootstrap-1.0.3/lib" "--docdir=/gnu/store/lssajarfg1vr6xbhi5dfvnn3xs01v3bz-ghc-integer-logarithms-bootstrap-1.0.3/share/doc/ghc-integer-logarithms-bootstrap-1.0.3" "--libsubdir=$compiler/$pkg-$version" "--package-db=/tmp/guix-build-ghc-integer-logarithms-bootstrap-1.0.3.drv-0/package.conf.d" "--global" "--enable-shared" "--enable-executable-dynamic" "--ghc-option=-fPIC" "--ghc-option=-optl=-Wl,-rpath=/gnu/store/lssajarfg1vr6xbhi5dfvnn3xs01v3bz-ghc-integer-logarithms-bootstrap-1.0.3/lib/$compiler/$pkg-$version" failed with status 1
builder for `/gnu/store/pwdhhwp6d6b5g5pgik9y6ml5g1d8fxf5-ghc-integer-logarithms-bootstrap-1.0.3.drv' failed with exit code 1
build of /gnu/store/pwdhhwp6d6b5g5pgik9y6ml5g1d8fxf5-ghc-integer-logarithms-bootstrap-1.0.3.drv failed
```
In ghc 8.8 the base version is 4.13, and the updated cabal file for integer-logarithms amends the constrants to allow that version.
The solution might be to use `cabal get` to download the archive instead of downloading the .tar.gz directly, or manually amending the cabal file after downloading.
(define-module (gnu packages futhark)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix build-system haskell)
#:use-module (guix licenses)
#:use-module (guix git-download)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (gnu packages)
#:use-module (gnu packages haskell)
#:use-module (gnu packages haskell)
#:use-module (gnu packages haskell-web)
#:use-module (gnu packages haskell-xyz)
#:use-module (gnu packages haskell-check)
#:use-module (gnu packages haskell-crypto))
(define-public ghc-integer-logarithms
(package
(name "ghc-integer-logarithms")
(version "1.0.3")
(source
(origin
(method url-fetch)
(uri (string-append "https://hackage.haskell.org/package/"
"integer-logarithms/integer-logarithms-"
version ".tar.gz"))
(sha256
(base32
"05pc5hws66csvcvfswlwcr2fplwn1lbssvwifjxkbbwqhq0n5qjs"))))
(build-system haskell-build-system)
(arguments
`(#:phases
(modify-phases %standard-phases
(add-before 'configure 'update-constraints
(lambda _
(substitute* "integer-logarithms.cabal"
(("tasty >= 0\\.10 && < 1\\.1")
"tasty >= 0.10 && < 1.2")))))))
(native-inputs
`(("ghc-quickcheck" ,ghc-quickcheck)
("ghc-smallcheck" ,ghc-smallcheck)
("ghc-tasty" ,ghc-tasty)
("ghc-tasty-hunit" ,ghc-tasty-hunit)
("ghc-tasty-quickcheck" ,ghc-tasty-quickcheck)
("ghc-tasty-smallcheck" ,ghc-tasty-smallcheck)))
(home-page "https://github.com/Bodigrim/integer-logarithms")
(synopsis "Integer logarithms")
(description
"This package provides the following modules:
@code{Math.NumberTheory.Logarithms} and
@code{Math.NumberTheory.Powers.Integer} from the @code{arithmoi} package,
@code{GHC.Integer.Logarithms.Compat} and
@code{Math.NumberTheory.Power.Natural}, as well as some additional functions
in migrated modules.")
(license license:expat)))
(define-public ghc-integer-logarithms-bootstrap
(package
(inherit ghc-integer-logarithms)
(name "ghc-integer-logarithms-bootstrap")
(arguments `(#:tests? #f
#:haskell ,ghc-8.8))
(native-inputs '())
(properties '((hidden? #t)))))
ghc-integer-logarithms-bootstrap