summaryrefslogtreecommitdiff
path: root/guix/lint.scm
diff options
context:
space:
mode:
authorTimothy Sample <samplet@ngyro.com>2020-11-03 15:30:28 -0500
committerTimothy Sample <samplet@ngyro.com>2020-11-21 22:11:36 -0500
commit464b1fffb0f08a452b4ee67ba23c87730d73568e (patch)
treee56ff4c08670df996ced3242f4528519c7996c52 /guix/lint.scm
parenteeee65076e3199c778b177e06de3aae7696dbb9f (diff)
downloadguix-patches-464b1fffb0f08a452b4ee67ba23c87730d73568e.tar
guix-patches-464b1fffb0f08a452b4ee67ba23c87730d73568e.tar.gz
lint: Add 'check-haskell-stackage' checker.
* guix/lint.scm (check-haskell-stackage): New procedure. (%network-dependent-checkers): Add 'haskell-stackage' checker. * guix/import/hackage.scm (%hackage-url): New variable. (hackage-source-url, hackage-cabal-url): Use it in place of a hard-coded string. * guix/import/stackage.scm (%stackage-url): Make it a parameter. (stackage-lts-info-fetch): Update accordingly. * tests/lint.scm ("hackage-stackage"): New test.
Diffstat (limited to 'guix/lint.scm')
-rw-r--r--guix/lint.scm28
1 files changed, 27 insertions, 1 deletions
diff --git a/guix/lint.scm b/guix/lint.scm
index 0b38ca0d33..be6bb4eb01 100644
--- a/guix/lint.scm
+++ b/guix/lint.scm
@@ -10,6 +10,7 @@
;;; Copyright © 2017, 2018, 2020 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2018, 2019 Arun Isaac <arunisaac@systemreboot.net>
;;; Copyright © 2020 Chris Marusich <cmmarusich@gmail.com>
+;;; Copyright © 2020 Timothy Sample <samplet@ngyro.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -52,6 +53,7 @@
#:use-module ((guix swh) #:hide (origin?))
#:autoload (guix git-download) (git-reference?
git-reference-url git-reference-commit)
+ #:use-module (guix import stackage)
#:use-module (ice-9 match)
#:use-module (ice-9 regex)
#:use-module (ice-9 format)
@@ -90,6 +92,7 @@
check-formatting
check-archival
check-profile-collisions
+ check-haskell-stackage
lint-warning
lint-warning?
@@ -1285,6 +1288,25 @@ Heritage")
'()
(apply throw key args))))))))
+(define (check-haskell-stackage package)
+ "Check whether PACKAGE is a Haskell package ahead of the current
+Stackage LTS version."
+ (match (with-networking-fail-safe
+ (format #f (G_ "while retrieving upstream info for '~a'")
+ (package-name package))
+ #f
+ (package-latest-release package (list %stackage-updater)))
+ ((? upstream-source? source)
+ (if (version>? (package-version package)
+ (upstream-source-version source))
+ (list
+ (make-warning package
+ (G_ "ahead of Stackage LTS version ~a")
+ (list (upstream-source-version source))
+ #:field 'version))
+ '()))
+ (#f '())))
+
;;;
;;; Source code formatting.
@@ -1511,7 +1533,11 @@ or a list thereof")
(lint-checker
(name 'archival)
(description "Ensure source code archival on Software Heritage")
- (check check-archival))))
+ (check check-archival))
+ (lint-checker
+ (name 'haskell-stackage)
+ (description "Ensure Haskell packages use Stackage LTS versions")
+ (check check-haskell-stackage))))
(define %all-checkers
(append %local-checkers