From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ben Woodcroft Subject: Re: [PATCH] draft addition of github updater Date: Fri, 26 Feb 2016 22:14:50 -0500 Message-ID: <56D114AA.2090802@uq.edu.au> References: <5647D2A8.8040603@uq.edu.au> <87h9kmb8zs.fsf@gnu.org> <5675F96E.4090609@uq.edu.au> <87ziwmqtle.fsf@gnu.org> <56C92B77.3050601@uq.edu.au> <87vb5fk1de.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55882) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZVLc-0002qR-T5 for guix-devel@gnu.org; Fri, 26 Feb 2016 22:15:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZVLY-0004qd-HZ for guix-devel@gnu.org; Fri, 26 Feb 2016 22:15:12 -0500 In-Reply-To: <87vb5fk1de.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: =?UTF-8?Q?Ludovic_Court=c3=a8s?= Cc: "guix-devel@gnu.org" On 23/02/16 08:22, Ludovic Court=C3=A8s wrote: [ ... ] >> On 04/01/16 06:46, Ludovic Court=C3=A8s wrote: >>> Ben Woodcroft skribis: >>> >>>> It seems I miscounted before, but now it is 129 of 146 github >>>> "release" packages recognised with 28 suggesting an update - see the >>>> end of email for details. There is one false positive: >>>> >>>> gnu/packages/ocaml.scm:202:13: camlp4 would be upgraded from 4.02+6 = to >>>> 4.02.0+1 >>>> >>>> This happens because the newer versions were not made as official >>>> releases just tags, so the newer versions are omitted from the API >>>> response, plus there's the odd version numbering scheme. Guix is up = to >>>> date. >>> I guess we could filter out such downgrades by adding a call to >>> =E2=80=98version>?=E2=80=99, no? >> My impression is that code elsewhere (yours?) already does this, but >> version>? does not work as intended for this corner case. > Indeed: > > --8<---------------cut here---------------start------------->8--- > scheme@(guile-user)> (version>? "4.02+6" "4.02.0+1") > $2 =3D #f > --8<---------------cut here---------------end--------------->8--- > > I would argue that upstream chose a confusing numbering scheme is > 4.02.0+1 is supposed to be older=E2=80=A6 Indeed, I think it is OK to leave this. >>> Rather use (guix http-client) and something like: >>> >>> (let ((port (http-fetch url))) >>> (dynamic-wind >>> (const #t) >>> (lambda () >>> (json->scm port)) >>> (lambda () >>> (close-port port)))) >>> >>> This avoids the temporary file creation etc. >> This sounds preferable but did not work as I kept getting 403 >> forbidden. Displaying the URI for instance with (string-append uri >> "\n") gives the below. I understand the error is trivial, but just >> wanted to communicate the URI object. >> >> ERROR: In procedure string-append: >> ERROR: In procedure string-append: Wrong type (expecting string): >> #< scheme: https userinfo: #f host: "api.github.com" port: #f >> path: "/repos/torognes/vsearch/releases" query: >> "access_token=3D27907952ef87f3691d592b9dcd93cd4b6f20625f" fragment: #f= > > That=E2=80=99s because this is a URI object, not a string. I had a fresh crack at this, trying among other things: (define (json-fetch* url) "Return a list/hash representation of the JSON resource URL, or #f on failure." (display (string-append url "\n")) (let ((port (http-fetch url))) (dynamic-wind (const #t) (lambda () (json->scm port)) (lambda () (close-port port))))) and got $ ./pre-inst-env guix refresh -t github vsearch https://api.github.com/repos/torognes/vsearch/releases?access_token=3D279= 07952ef87f3691d592b9dcd93cd4b6f20625f guix refresh: error: download failed >> From 29dc5a809e6d8796279911a993ef1b2237c810ca Mon Sep 17 00:00:00 200= 1 >> From: Ben Woodcroft >> Date: Sun, 15 Nov 2015 10:18:05 +1000 >> Subject: [PATCH] import: Add github-updater. >> >> * guix/import/github.scm: New file. >> * guix/scripts/refresh.scm (%updaters): Add %GITHUB-UPDATER. >> * doc/guix.texi (Invoking guix refresh): Mention it. > Make sure to add github.scm in Makefile.am. Otherwise LGTM! > > Once this is in, I=E2=80=99ll see if I can make that =E2=80=98http-fetc= h=E2=80=99 change I was > suggesting. > > Thank you! No problem at all, thanks for babying me through this. Pushed as 917a2a58. ben