Subject: Re: [bug#48999] [PATCH] import: hackage: Accept local source for package.

From: zimoun <[email-masked]>
Date: Wed, 30 Jun 2021 16:10:51 +0200

Hi,

On Wed, 30 Jun 2021 at 11:17, Ludovic Courtès <[email-masked]> wrote:
>>> Xinglu Chen <[email-masked]> skribis:

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

[...]

>>> 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?
>
>> 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?

>From my understanding, there are 2 levels:

 1. simplify the Scheme snippet for developing local “foreign” package,
 i.e., “guix build -f guix.scm” with a simpler ’guix.scm’ file.

 2. an option to import local package,
 e.g., “guix import hackage --path=.”

and this for (almost) all the importers.

Cheers,
simon