aboutsummaryrefslogtreecommitdiff
path: root/guix/scripts/lint.scm
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2018-12-25 16:29:12 +0200
committerEfraim Flashner <efraim@flashner.co.il>2018-12-27 14:55:54 +0200
commitc180017b6f7e9b6d23238c1fbaac986c435cd35e (patch)
tree007efa1dacf0ac8f979285d16023eadb2dc2acc9 /guix/scripts/lint.scm
parent039ccc7118b0a6d0cb09e9cab5caf9f629197d03 (diff)
downloadgnu-guix-c180017b6f7e9b6d23238c1fbaac986c435cd35e.tar
gnu-guix-c180017b6f7e9b6d23238c1fbaac986c435cd35e.tar.gz
lint: Check 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. * doc/guix.texi (Invoking guix lint): Document it.
Diffstat (limited to 'guix/scripts/lint.scm')
-rw-r--r--guix/scripts/lint.scm23
1 files changed, 22 insertions, 1 deletions
diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index 354f6f7031..2c1c7ec669 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -7,7 +7,7 @@
;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;; Copyright © 2017 Alex Kost <alezost@gmail.com>
;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
-;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This file is part of GNU Guix.
@@ -76,6 +76,7 @@
check-home-page
check-source
check-source-file-name
+ check-source-unstable-tarball
check-mirror-url
check-github-url
check-license
@@ -752,6 +753,22 @@ descriptions maintained upstream."
(G_ "the source file name should contain the package name")
'source))))
+(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"))
+ (emit-warning package
+ (G_ "the source URI should not be an autogenerated tarball")
+ 'source)))
+ (let ((origin (package-source package)))
+ (when (and (origin? origin)
+ (eqv? (origin-method origin) url-fetch))
+ (let ((uris (origin-uris origin)))
+ (for-each check-source-uri uris)))))
+
(define (check-mirror-url package)
"Check whether PACKAGE uses source URLs that should be 'mirror://'."
(define (check-mirror-uri uri) ;XXX: could be optimized
@@ -1099,6 +1116,10 @@ or a list thereof")
(description "Validate file names of sources")
(check check-source-file-name))
(lint-checker
+ (name 'source-unstable-tarball)
+ (description "Check for autogenerated tarballs")
+ (check check-source-unstable-tarball))
+ (lint-checker
(name 'derivation)
(description "Report failure to compile a package to a derivation")
(check check-derivation))