Hello!

Efraim Flashner <[email protected]> skribis:

> From dcd8b207f932289cb3b35720af45f49f849b7c27 Mon Sep 17 00:00:00 2001
> From: Efraim Flashner <[email protected]>
> 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