Importing haskell packages from hackage doesn't apply metadata revisions

  • Done
  • quality assurance status badge
Details
2 participants
  • John Kehayias
  • Philip Munksgaard
Owner
unassigned
Submitted by
Philip Munksgaard
Severity
normal
P
P
Philip Munksgaard wrote on 5 Jul 2021 16:09
Importing haskell packages from hackage doesn't apply metadata revisions
(address . bug-guix@gnu.org)
a7ce979b-2fff-4012-86ba-c709fe32c3bb@www.fastmail.com
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
J
J
John Kehayias wrote on 5 Jul 2021 17:32
Importing haskell packages from hackage doesn't apply metadata revisions
(name . 49418@debbugs.gnu.org)(address . 49418@debbugs.gnu.org)
7gQWTFf7eWu8oWGdLqBx5AQvigc0jqMCf4z5tgknt2x-IWXD70-mrdBaj6hxbi5JxysNrdlu5wArAbQv8_EU3kG4opMzoRYepCwkoOpAOjY=@protonmail.com
I've run into the same problem, seems like fetching the revised cabal file would be the best bet. (In the meantime I've modified package definitions to make the metadata changes, but that is manual and certainly should be automated by import.)
J
J
John Kehayias wrote on 7 Jul 2021 05:26
(name . 49418@debbugs.gnu.org)(address . 49418@debbugs.gnu.org)
nFexZOcsGfDBaknNp-n3bzoE5pnw8j7BB2-r3uI0jMK-p61Me80CtvH929lkiaJHiuJBkND1gQps0IgqGm_NdsDkpsqO-8OHB6Qjd6HGTm8=@protonmail.com
Actually, this does exist in the Haskell build system in Guix, but seems to be undocumented and not used by the importer. You can add the following to the arguments (in the bootstrap package in this case) to use a metadata revision:

#:cabal-revision ("2" "0a6j3313vz7n7dn8abddyib4jggblaq89f87ib4imdwjxjajbm33")

The hash is from running guix hash file (where file = 2.cabal in this case, downloaded from Hackage). This should be part of the importer, to specify a revision or by default grab the latest, I would say.

(and I'm guessing you know this is packaged in guix as integer-logarithms, without the "ghc-" prefix for some reason; not the only package like that I've noticed)
P
P
Philip Munksgaard wrote on 7 Jul 2021 07:58
Re: bug#49418: Importing haskell packages from hackage doesn't apply metadata revisions
1d5f0af1-ed89-4b03-b845-207fd8731a62@www.fastmail.com
On Wed, 7 Jul 2021, at 05:26, John Kehayias via Bug reports for GNU Guix wrote:
Toggle quote (16 lines)
> Actually, this does exist in the Haskell build system in Guix, but
> seems to be undocumented and not used by the importer. You can add the
> following to the arguments (in the bootstrap package in this case) to
> use a metadata revision:
>
> #:cabal-revision ("2" "0a6j3313vz7n7dn8abddyib4jggblaq89f87ib4imdwjxjajbm33")
>
> The hash is from running guix hash file (where file = 2.cabal in this
> case, downloaded from Hackage). This should be part of the importer, to
> specify a revision or by default grab the latest, I would say.
>
> (and I'm guessing you know this is packaged in guix as
> integer-logarithms, without the "ghc-" prefix for some reason; not the
> only package like that I've noticed)
>

Ah yes, good catch! I agree that the fix should be to amend the importer, such that it finds out about these revisions and automatically uses the latest one.
P
P
Philip Munksgaard wrote on 7 Jul 2021 11:52
affbe2ca-9725-448a-8e2d-943dfd851196@www.fastmail.com
On Wed, 7 Jul 2021, at 07:58, Philip Munksgaard wrote:
Toggle quote (21 lines)
> On Wed, 7 Jul 2021, at 05:26, John Kehayias via Bug reports for GNU Guix wrote:
> > Actually, this does exist in the Haskell build system in Guix, but
> > seems to be undocumented and not used by the importer. You can add the
> > following to the arguments (in the bootstrap package in this case) to
> > use a metadata revision:
> >
> > #:cabal-revision ("2" "0a6j3313vz7n7dn8abddyib4jggblaq89f87ib4imdwjxjajbm33")
> >
> > The hash is from running guix hash file (where file = 2.cabal in this
> > case, downloaded from Hackage). This should be part of the importer, to
> > specify a revision or by default grab the latest, I would say.
> >
> > (and I'm guessing you know this is packaged in guix as
> > integer-logarithms, without the "ghc-" prefix for some reason; not the
> > only package like that I've noticed)
> >
>
> Ah yes, good catch! I agree that the fix should be to amend the
> importer, such that it finds out about these revisions and
> automatically uses the latest one.

Actually, upon closer inspection, that's exactly what it does! Instead of actually using the importer in my original example (as I claimed), I had actually just modified the code from gnu/packages/haskell-xyz.scm. Doing a fresh import correctly picks up that there is a new revision of the cabal file and produces the right derivation. I'll close this issue.
Closed
J
J
John Kehayias wrote on 7 Jul 2021 16:37
Re: bug#49418: Importing haskell packages from hackage doesn't apply metadata revisions
(name . Philip Munksgaard)(address . philip@munksgaard.me)(name . 49418-done@debbugs.gnu.org)(address . 49418-done@debbugs.gnu.org)
ywJLmJQ2nuNogQoUt2XFakt3jjafObfRvKic26GkOr_uWGNsNeipSykr61ywJiO_FmHlVvKp9awnmBp2c-iVGOaPJNop5h9IgXXtKCpZA5U=@protonmail.com
Yes, I noticed that later too on some packages I'm working on. Glad you got it sorted out.

Still should be documented somewhere, I guess under the build systems.
Closed
?