GNU bug report logs -
#48999
[PATCH] import: hackage: Accept local source for package.
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
On Wed, Jun 30 2021, Ludovic Courtès wrote:
> Hi,
>
> Xinglu Chen <public <at> yoctocell.xyz> skribis:
>
>> On Tue, Jun 29 2021, Ludovic Courtès wrote:
>>
>>> Hi,
>>>
>>> Xinglu Chen <public <at> yoctocell.xyz> skribis:
>>>
>>>> When developing a Haskell package it is often useful to have a Guix package
>>>> definition for that package, previously one would have to write that package
>>>> definition by hand, and if the .cabal file changed one would manually update
>>>> the Guix package definition.
>>>>
>>>> This commit allows one to specify a custom source for their package, meaning
>>>> that one could programatically generate a Guix package definition for their
>>>> local Haskell package. If the .cabal file changes, the generated package
>>>> definition will also change accordingly. One could for instance write the
>>>> following in a guix.scm file:
>>>>
>>>> (define-values (ghc-haskeme deps)
>>>> (call-with-input-file "haskeme.cabal"
>>>> (lambda (port)
>>>> (hackage->guix-package
>>>> "haskeme"
>>>> #:port port
>>>> #:source (local-file "." "haskeme-checkout"
>>>> #:recursive? #t
>>>> #:select? hg-predicate)))))
>>>>
>>>> ghc-haskeme
>>>>
>>>> Invoking ‘guix build -f guix.scm’ would then always build an up-to-date
>>>> version of the package.
>>>>
>>>> * guix/import/hackage.scm (hackage-module->sexp): Add optional keyword
>>>> argument ‘source’
>>>> (hackage->guix-package): Likewise.
>>>> * tests/hackage.scm (eval-test-with-cabal): Likewise.
>>>> ("hackage->guix-package local source"): New test.
>>>
>>> Looks like a nice improvement.
>>>
>>> What I don’t get is that this functionality doesn’t seem to be available
>>> from the CLI, which the patch doesn’t change. Or am I missing
>>> something?
>>
>> No, I don’t think this functionality is available from the CLI since
>> ‘hackage->guix-package’ is not called with the #:source keyword
>> argument.
>
> IOW, this functionality is not accessible, unless you use the Scheme API
> as in the example above, right?
Yes.
>> Once all the other importers (or those where it makes sense to do
>> this) get this functionality, it would be a good idea to add an option
>> for reading a .cabal/setup.py/whatever file and generating a package
>> definition from that.
>
> ‘guix import hackage’ could support it even if other importers don’t
> have equivalent functionality, no?
Sure, that could work too.
[signature.asc (application/pgp-signature, inline)]
This bug report was last modified 3 years and 345 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.