From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59836) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1SUs-0005wK-8m for guix-patches@gnu.org; Mon, 09 Oct 2017 03:29:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e1SUo-0005uH-A8 for guix-patches@gnu.org; Mon, 09 Oct 2017 03:29:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:48353) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e1SUo-0005u8-6v for guix-patches@gnu.org; Mon, 09 Oct 2017 03:29:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e1SUn-0004g3-Uj for guix-patches@gnu.org; Mon, 09 Oct 2017 03:29:01 -0400 Subject: [bug#27596] [PATCH] guix: lint: Add checker for new upstream versions. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20170706101723.3349-1-efraim@flashner.co.il> <87h8ypocp1.fsf@gnu.org> <20170801112046.GG2406@macbook42.flashner.co.il> <87y3qb4u7t.fsf@gnu.org> <877ew6isxe.fsf@gnu.org> <20171008194904.GC2547@macbook42.flashner.co.il> Date: Mon, 09 Oct 2017 09:28:04 +0200 In-Reply-To: <20171008194904.GC2547@macbook42.flashner.co.il> (Efraim Flashner's message of "Sun, 8 Oct 2017 22:49:04 +0300") Message-ID: <87d15wbx17.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Efraim Flashner Cc: 27596@debbugs.gnu.org Hello! Efraim Flashner skribis: > On Sat, Oct 07, 2017 at 10:50:21PM +0200, Ludovic Court=C3=A8s wrote: [...] >> >> +(define (check-for-updates package) >> >> + "Check if there is an update available for PACKAGE." >> >> + (match (package-latest-release package (force %updaters)) >> >> + ((? upstream-source? source) >> >> + (when (version>? (upstream-source-version source) >> >> + (package-version package)) >> >> + (emit-warning package >> >> + (format #f (G_ "can be upgraded to ~a~%") >> >> + (upstream-source-version source))))))) >> > >> > I think you can (1) use =E2=80=98package-latest-release*=E2=80=99 whic= h ensures that the >> > returned version is newer, and (2) add a case for #f since >> > =E2=80=98package-latest-release*=E2=80=99 can return #f. >> > >> > Apart from that it LGTM, thank you! >> > >> > Ludo=E2=80=99. > > I've been working on it with package-latest-release*, and its nice not > having to reimplement the logic, but I can't get it to return the newest > version of the upstream-package. I got it to return a useful message > with: > > (define (check-for-updates package) > (if (package-latest-release* package (force %updaters)) > (emit-warning package > (format #f (G_ "can be upgraded to ~a~%") > (upstream-source-version (package-latest-rel= ease package (force %updaters))))) > #t)) > > but I've already checked if there's an upstream release, I shouldn't > need to check a second time. package-latest-release* returns true/false, AFAICS =E2=80=98package-latest-release*=E2=80=99 returns #f or an : --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (package-latest-release* binutils (force %updaters)) $4 =3D #< package: "binutils" version: "2.29.1" urls: ("mi= rror://gnu/binutils/binutils-2.29.1.tar.gz" "mirror://gnu/binutils/binutils= -2.29.1.tar.lz" "mirror://gnu/binutils/binutils-2.29.1.tar.bz2" "mirror://g= nu/binutils/binutils-2.29.1.tar.xz") signature-urls: ("mirror://gnu/binutil= s/binutils-2.29.1.tar.gz.sig" "mirror://gnu/binutils/binutils-2.29.1.tar.lz= .sig" "mirror://gnu/binutils/binutils-2.29.1.tar.bz2.sig" "mirror://gnu/bin= utils/binutils-2.29.1.tar.xz.sig")> --8<---------------cut here---------------end--------------->8--- So you can write: (match (package-latest-release* package (force %updaters)) ((? upstream-source? source) =E2=80=A6) (#f ;cannot determine latest release #f)) HTH! Ludo=E2=80=99.