guix-devel
[Top][All Lists]
Advanced

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

Re: `guix lint' warn of GitHub autogenerated source tarballs


From: Ludovic Courtès
Subject: Re: `guix lint' warn of GitHub autogenerated source tarballs
Date: Sat, 05 Jan 2019 18:39:53 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Hello!

Efraim Flashner <address@hidden> skribis:

> From dcd8b207f932289cb3b35720af45f49f849b7c27 Mon Sep 17 00:00:00 2001
> From: Efraim Flashner <address@hidden>
> Date: Tue, 25 Dec 2018 16:29:12 +0200
> Subject: [PATCH] lint: Add checker for unstable tarballs.
>
> * guix/scripts/lint.scm (check-source-unstable-tarball): New procedure.
> (%checkers): Add it.
> * tests/lint.scm ("source-unstable-tarball", "source-unstable-tarball:
> source #f", "source-unstable-tarball: valid", "source-unstable-tarball:
> package named archive", "source-unstable-tarball: not-github",
> "source-unstable-tarball: git-fetch"): New tests.

One last thing:

> +(define (check-source-unstable-tarball package)
> +  "Emit a warning if PACKAGE's source is an autogenerated tarball."
> +  (define (check-source-uri uri)
> +    (when (and (string=? (uri-host (string->uri uri)) "github.com")
> +               (string=? (third (split-and-decode-uri-path
> +                                   (uri-path (string->uri uri))))
> +                     "archive"))

‘third’ could fail badly if the list has fewer elements, so I’d suggest
writing it something like:

  (when (and …
             (match (split-and-decode-uri-path …)
               ((_ _ "archive" _ ...) #t)
               (_ #f)))
     …)

Otherwise LGTM, thank you!

Ludo’.



reply via email to

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