guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#27596] [PATCH] guix: lint: Add checker for new upstream versions.


From: Efraim Flashner
Subject: [bug#27596] [PATCH] guix: lint: Add checker for new upstream versions.
Date: Sun, 8 Oct 2017 22:49:04 +0300
User-agent: Mutt/1.8.3 (2017-05-23)

On Sat, Oct 07, 2017 at 10:50:21PM +0200, Ludovic Courtès wrote:
> Ping!  :-)
> 
> address@hidden (Ludovic Courtès) skribis:
> 
> > Hi Efraim,
> >
> > Sorry for the delay.
> >
> > Efraim Flashner <address@hidden> skribis:
> >
> >> From 136841864c883338381764ef09a6f4ec967949e7 Mon Sep 17 00:00:00 2001
> >> From: Efraim Flashner <address@hidden>
> >> Date: Thu, 6 Jul 2017 09:13:31 +0300
> >> Subject: [PATCH] guix: lint: Add checker for new upstream versions.
> >>
> >> * guix/scripts/lint.scm (check-for-updates): New procedure.
> >> (%checkers): Add it.
> >> * guix/scripts/refresh.scm (importer-modules, %updaters): Move
> >> from here ...
> >> * guix/upstream.scm: ... to here.
> >
> > [...]
> >
> >> +(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 ‘package-latest-release*’ which ensures that the
> > returned version is newer, and (2) add a case for #f since
> > ‘package-latest-release*’ can return #f.
> >
> > Apart from that it LGTM, thank you!
> >
> > Ludo’.

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-release 
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,
so if I want to print the version to upgrade to I need to check it a
second time. package-latest-release returns an <upstream-source> which
is more easily queried for the latest upstream version.

-- 
Efraim Flashner   <address@hidden>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]