From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56390) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1W5U-0007Vl-Hl for guix-patches@gnu.org; Mon, 09 Oct 2017 07:19:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e1W5O-0004fS-Rm for guix-patches@gnu.org; Mon, 09 Oct 2017 07:19:08 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:48521) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e1W5O-0004f7-O9 for guix-patches@gnu.org; Mon, 09 Oct 2017 07:19:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e1W5O-0003yg-Ga for guix-patches@gnu.org; Mon, 09 Oct 2017 07:19:02 -0400 Subject: bug#27596: [PATCH] guix: lint: Add checker for new upstream versions. Resent-To: guix-patches@gnu.org Resent-Message-ID: Date: Mon, 9 Oct 2017 14:17:54 +0300 From: Efraim Flashner Message-ID: <20171009111754.GE2547@macbook42.flashner.co.il> 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> <87d15wbx17.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="BQPnanjtCNWHyqYD" Content-Disposition: inline In-Reply-To: <87d15wbx17.fsf@gnu.org> 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: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 27596-done@debbugs.gnu.org --BQPnanjtCNWHyqYD Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 09, 2017 at 09:28:04AM +0200, Ludovic Court=C3=A8s wrote: > Hello! >=20 > Efraim Flashner skribis: >=20 > > On Sat, Oct 07, 2017 at 10:50:21PM +0200, Ludovic Court=C3=A8s wrote: >=20 > [...] >=20 > >> >> +(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 wh= ich 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-r= elease 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, >=20 >=20 > AFAICS =E2=80=98package-latest-release*=E2=80=99 returns #f or an : >=20 > --8<---------------cut here---------------start------------->8--- > scheme@(guile-user)> (package-latest-release* binutils (force %updaters)) > $4 =3D #< package: "binutils" version: "2.29.1" urls: ("= mirror://gnu/binutils/binutils-2.29.1.tar.gz" "mirror://gnu/binutils/binuti= ls-2.29.1.tar.lz" "mirror://gnu/binutils/binutils-2.29.1.tar.bz2" "mirror:/= /gnu/binutils/binutils-2.29.1.tar.xz") signature-urls: ("mirror://gnu/binut= ils/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/b= inutils/binutils-2.29.1.tar.xz.sig")> > --8<---------------cut here---------------end--------------->8--- >=20 > So you can write: >=20 > (match (package-latest-release* package (force %updaters)) > ((? upstream-source? source) > =E2=80=A6) > (#f ;cannot determine latest release > #f)) >=20 > HTH! >=20 > Ludo=E2=80=99. I looked at the final diff between my earlier patch and my final version, it pretty much added up to the lines you wrote above ;) I should get myself a rubber duck, should help my debugging and reading skills. --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --BQPnanjtCNWHyqYD Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAlnbWtcACgkQQarn3Mo9 g1Foig/+O4e7OdLsssOSh7LlUwU4xoUEO88lTEH1mgcZgIorGtte8eOCz72zxmE7 cNYTITsNKmAZR+dcLq23/8ztZFvN+R/ovnhjsMM9Xa20QJeKkA71yXDtr9slqdSZ B7i5K5zooW9erUUwVlMj2MK520U7trtGpfGD+kdroHzRGw0KAN3zMd8DSnbn/KjO M5qdIiBy9YHigf1weAttPA9/C09/2reBerj9JSm68vlirIe2u+ce6AoiLKVLi1hU I43K1PCIyyGFqrKGEm9NIl+fjb55Dk4YZgsdcPo153caN8fipA1jM+w7HrImIUEj tZNNTpvZrRheC6uYmAc4FquE7dJLJfgqSP87Uqm6d37x5NzFN705qkMRWpE4p/iC 1zFi0B9m4StCA0ClcuHp/c1ozX2QL6/JAeHzfwJ382bKTKxgB8KjCL/gxmEoDJ2W 2n3qe4Bz/Yvwu/loC4SUVJ6IlFbc/k3BJTgQFOD9BrDniSNdN9aOTzyb1esKJyS+ Vv17Fj5sMLlhRDZm8s6fr1Sz/li91IuEJccRNpjh2L5FzLwFUCqCwdb0bGgoMHJs qlUXxKWOR5HhEa5TQjmqUUg7gaPMncX7AOKdUbtB7R9/c7ig97qg+PpGbJlEMJKu 2K1nDyR+tglDS4oXbyb+DKxOVDLQ+htiGOFDdetOJnNVfI2ZFW4= =ZRZQ -----END PGP SIGNATURE----- --BQPnanjtCNWHyqYD--