unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Efraim Flashner <efraim@flashner.co.il>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 27596-done@debbugs.gnu.org
Subject: bug#27596: [PATCH] guix: lint: Add checker for new upstream versions.
Date: Mon, 9 Oct 2017 14:17:54 +0300	[thread overview]
Message-ID: <20171009111754.GE2547@macbook42.flashner.co.il> (raw)
In-Reply-To: <87d15wbx17.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 3245 bytes --]

On Mon, Oct 09, 2017 at 09:28:04AM +0200, Ludovic Courtès wrote:
> Hello!
> 
> Efraim Flashner <efraim@flashner.co.il> 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’.

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.


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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2017-10-09 11:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-06 10:17 [bug#27596] [PATCH] guix: lint: Add checker for new upstream versions Efraim Flashner
2017-07-06 14:35 ` Ludovic Courtès
2017-08-01 11:20   ` Efraim Flashner
2017-08-22 13:17     ` Ludovic Courtès
2017-10-07 20:50       ` Ludovic Courtès
2017-10-08 19:49         ` Efraim Flashner
2017-10-09  7:28           ` Ludovic Courtès
2017-10-09 11:17             ` Efraim Flashner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171009111754.GE2547@macbook42.flashner.co.il \
    --to=efraim@flashner.co.il \
    --cc=27596-done@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).