From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Bavier Subject: Re: [PATCH 3/3] import: Add Hackage updater. Date: Tue, 29 Mar 2016 20:53:16 -0500 Message-ID: <20160329205316.16c56ba1@openmailbox.org> References: <1458705269-31766-1-git-send-email-ericbavier@openmailbox.org> <1458705269-31766-3-git-send-email-ericbavier@openmailbox.org> <87oa9ysht6.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39469) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1al5KI-0006Rd-PC for guix-devel@gnu.org; Tue, 29 Mar 2016 21:53:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1al5KE-0008Nb-M6 for guix-devel@gnu.org; Tue, 29 Mar 2016 21:53:42 -0400 Received: from smtp11.openmailbox.org ([62.4.1.45]:33709) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1al5KE-0008N7-GK for guix-devel@gnu.org; Tue, 29 Mar 2016 21:53:38 -0400 In-Reply-To: <87oa9ysht6.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Ludovic =?UTF-8?B?Q291cnTDqHM=?= Cc: guix-devel@gnu.org On Mon, 28 Mar 2016 18:12:05 +0200 ludo@gnu.org (Ludovic Court=C3=A8s) wrote: > ericbavier@openmailbox.org skribis: >=20 > > From: Eric Bavier > > > > * 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. =20 >=20 > [...] >=20 > > +(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 nam= e." > > + (let* ((source-url (and=3D> (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))))))) =20 >=20 > It might be useful to honor a =E2=80=98cabal-package-name=E2=80=99 proper= ty in cases > where guessing doesn=E2=80=99t work. That can always be added later, tho= ugh. 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. >=20 > [...] >=20 > > %elpa-updater > > %cran-updater > > %bioconductor-updater > > + %hackage-updater =20 >=20 > Make it: >=20 > ((guix import hackage) =3D> %hackage-importer) >=20 > 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 =E2=80=98guix refresh -t hackage=E2=80=99 doesn=E2=80= =99t 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