unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#49418: Importing haskell packages from hackage doesn't apply metadata revisions
@ 2021-07-05 14:09 Philip Munksgaard
  2021-07-05 15:32 ` John Kehayias via Bug reports for GNU Guix
  0 siblings, 1 reply; 6+ messages in thread
From: Philip Munksgaard @ 2021-07-05 14:09 UTC (permalink / raw)
  To: 49418

[-- Attachment #1: Type: text/plain, Size: 2016 bytes --]

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.

0: https://hackage.haskell.org/package/integer-logarithms-1.0.3
1: https://hackage.haskell.org/package/integer-logarithms-1.0.3/revisions/

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: integer-logarithms.scm --]
[-- Type: text/x-scheme; name="integer-logarithms.scm", Size: 2356 bytes --]

(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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#49418: Importing haskell packages from hackage doesn't apply metadata revisions
  2021-07-05 14:09 bug#49418: Importing haskell packages from hackage doesn't apply metadata revisions Philip Munksgaard
@ 2021-07-05 15:32 ` John Kehayias via Bug reports for GNU Guix
  2021-07-07  3:26   ` John Kehayias via Bug reports for GNU Guix
  0 siblings, 1 reply; 6+ messages in thread
From: John Kehayias via Bug reports for GNU Guix @ 2021-07-05 15:32 UTC (permalink / raw)
  To: 49418@debbugs.gnu.org

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.)




^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#49418: Importing haskell packages from hackage doesn't apply metadata revisions
  2021-07-05 15:32 ` John Kehayias via Bug reports for GNU Guix
@ 2021-07-07  3:26   ` John Kehayias via Bug reports for GNU Guix
  2021-07-07  5:58     ` Philip Munksgaard
  0 siblings, 1 reply; 6+ messages in thread
From: John Kehayias via Bug reports for GNU Guix @ 2021-07-07  3:26 UTC (permalink / raw)
  To: 49418@debbugs.gnu.org

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)




^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#49418: Importing haskell packages from hackage doesn't apply metadata revisions
  2021-07-07  3:26   ` John Kehayias via Bug reports for GNU Guix
@ 2021-07-07  5:58     ` Philip Munksgaard
  2021-07-07  9:52       ` Philip Munksgaard
  0 siblings, 1 reply; 6+ messages in thread
From: Philip Munksgaard @ 2021-07-07  5:58 UTC (permalink / raw)
  To: John Kehayias, 49418@debbugs.gnu.org

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.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#49418: Importing haskell packages from hackage doesn't apply metadata revisions
  2021-07-07  5:58     ` Philip Munksgaard
@ 2021-07-07  9:52       ` Philip Munksgaard
  2021-07-07 14:37         ` John Kehayias via Bug reports for GNU Guix
  0 siblings, 1 reply; 6+ messages in thread
From: Philip Munksgaard @ 2021-07-07  9:52 UTC (permalink / raw)
  To: John Kehayias, 49418-done@debbugs.gnu.org

On Wed, 7 Jul 2021, at 07:58, Philip Munksgaard wrote:
> 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.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#49418: Importing haskell packages from hackage doesn't apply metadata revisions
  2021-07-07  9:52       ` Philip Munksgaard
@ 2021-07-07 14:37         ` John Kehayias via Bug reports for GNU Guix
  0 siblings, 0 replies; 6+ messages in thread
From: John Kehayias via Bug reports for GNU Guix @ 2021-07-07 14:37 UTC (permalink / raw)
  To: Philip Munksgaard; +Cc: 49418-done@debbugs.gnu.org

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.




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-07-07 14:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-05 14:09 bug#49418: Importing haskell packages from hackage doesn't apply metadata revisions Philip Munksgaard
2021-07-05 15:32 ` John Kehayias via Bug reports for GNU Guix
2021-07-07  3:26   ` John Kehayias via Bug reports for GNU Guix
2021-07-07  5:58     ` Philip Munksgaard
2021-07-07  9:52       ` Philip Munksgaard
2021-07-07 14:37         ` John Kehayias via Bug reports for GNU Guix

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).