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: Ludovic Courtès
Subject: [bug#27596] [PATCH] guix: lint: Add checker for new upstream versions.
Date: Mon, 09 Oct 2017 09:28:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Hello!

Efraim Flashner <address@hidden> skribis:

> On Sat, Oct 07, 2017 at 10:50:21PM +0200, Ludovic Courtès 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 ‘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,


AFAICS ‘package-latest-release*’ returns #f or an <upstream-source>:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (package-latest-release* binutils (force %updaters))
$4 = #<<upstream-source> package: "binutils" version: "2.29.1" urls: 
("mirror://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://gnu/binutils/binutils-2.29.1.tar.xz") signature-urls: 
("mirror://gnu/binutils/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/binutils/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)
     …)
    (#f   ;cannot determine latest release
     #f))

HTH!

Ludo’.





reply via email to

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