On Mon, 28 Mar 2016 18:12:05 +0200
l...@gnu.org (Ludovic Courtès) wrote:

> ericbav...@openmailbox.org skribis:
> 
> > From: Eric Bavier <bav...@member.fsf.org>
> >
> > * guix/import/hackage.scm (guix-package->hackage-name, hackage-package?)
> >   (latest-release): New procedures.
> >   (%hackage-updater): New variable.
> > * guix/scripts/refresh.scm (%updaters): Add it.
> > * doc/guix.texi (Invoking guix refresh): Mention it.  
> 
> [...]
> 
> > +(define guix-package->hackage-name
> > +  (let ((uri-rx (make-regexp 
> > "https?://hackage.haskell.org/package/([^/]+)/.*"))
> > +        (name-rx (make-regexp "(.*)-[0-9\\.]+")))
> > +    (lambda (package)
> > +      "Given a Guix package name, return the corresponding Hackage name."
> > +      (let* ((source-url (and=> (package-source package) origin-uri))
> > +             (name (match:substring (regexp-exec uri-rx source-url) 1)))
> > +        (match (regexp-exec name-rx name)
> > +          (#f name)
> > +          (m (match:substring m 1)))))))  
> 
> It might be useful to honor a ‘cabal-package-name’ property in cases
> where guessing doesn’t work.  That can always be added later, though.

Sure.  Let's save that for later.  This scheme works for all packages
that we have so far, and seems like it should work for most others on
Hackage that I've seen.

> 
> [...]
> 
> >                   %elpa-updater
> >                   %cran-updater
> >                   %bioconductor-updater
> > +                 %hackage-updater  
> 
> Make it:
> 
>   ((guix import hackage) => %hackage-importer)
> 
> to be on the safe side.

I considered that at first, but it seems like that syntax is for
updaters that rely on guile-json (or other modules which might be
missing).  I'd prefer not to unnecessarily confuse the situation.

> If you confirm that ‘guix refresh -t hackage’ doesn’t crash, go for it!

I have done so, and it seems to work quite well.  There are a few
packages whose .cabal file fail to parse, so I included the
warning output to incite some future bug-fixing.

`~Eric

Reply via email to