summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
Diffstat (limited to 'guix')
-rw-r--r--guix/scripts/lint.scm22
-rw-r--r--guix/ui.scm17
2 files changed, 32 insertions, 7 deletions
diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index 66c82f0409..811f167067 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -5,6 +5,7 @@
;;; Copyright © 2015, 2016 Mathieu Lirzin <mthl@gnu.org>
;;; Copyright © 2016 Danny Milosavljevic <dannym+a@scratchpost.org>
;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2017 Alex Kost <alezost@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -347,10 +348,25 @@ the synopsis")
(_ "synopsis should not start with the package name")
'synopsis)))
+ (define (check-texinfo-markup synopsis)
+ "Check that SYNOPSIS can be parsed as a Texinfo fragment. If the
+markup is valid return a plain-text version of SYNOPSIS, otherwise #f."
+ (catch #t
+ (lambda () (texi->plain-text synopsis))
+ (lambda (keys . args)
+ (emit-warning package
+ (_ "Texinfo markup in synopsis is invalid")
+ 'synopsis)
+ #f)))
+
(define checks
- (list check-not-empty check-proper-start check-final-period
- check-start-article check-start-with-package-name
- check-synopsis-length))
+ (list check-not-empty
+ check-proper-start
+ check-final-period
+ check-start-article
+ check-start-with-package-name
+ check-synopsis-length
+ check-texinfo-markup))
(match (package-synopsis package)
((? string? synopsis)
diff --git a/guix/ui.scm b/guix/ui.scm
index 3a0a6501d1..345bf490b2 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -4,7 +4,7 @@
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2014 Cyril Roelandt <tipecaml@gmail.com>
;;; Copyright © 2014 Cyrill Schenkel <cyrill.schenkel@gmail.com>
-;;; Copyright © 2014, 2015 Alex Kost <alezost@gmail.com>
+;;; Copyright © 2014, 2015, 2017 Alex Kost <alezost@gmail.com>
;;; Copyright © 2015 David Thompson <davet@gnu.org>
;;; Copyright © 2015, 2016 Mathieu Lirzin <mthl@gnu.org>
;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
@@ -81,6 +81,7 @@
fill-paragraph
texi->plain-text
package-description-string
+ package-synopsis-string
string->recutils
package->recutils
package-specification->name+version+output
@@ -848,10 +849,18 @@ converted to a space; sequences of more than one line break are preserved."
(with-fluids ((%default-port-encoding "UTF-8"))
(stexi->plain-text (texi-fragment->stexi str))))
+(define (package-field-string package field-accessor)
+ "Return a plain-text representation of PACKAGE field."
+ (and=> (field-accessor package)
+ (compose texi->plain-text P_)))
+
(define (package-description-string package)
"Return a plain-text representation of PACKAGE description field."
- (and=> (package-description package)
- (compose texi->plain-text P_)))
+ (package-field-string package package-description))
+
+(define (package-synopsis-string package)
+ "Return a plain-text representation of PACKAGE synopsis field."
+ (package-field-string package package-synopsis))
(define (string->recutils str)
"Return a version of STR where newlines have been replaced by newlines
@@ -914,7 +923,7 @@ WIDTH columns."
(string-map (match-lambda
(#\newline #\space)
(chr chr))
- (or (and=> (package-synopsis p) P_)
+ (or (and=> (package-synopsis-string p) P_)
"")))
(format port "~a~2%"
(string->recutils