From addce19e2d38a197f5ea10eefb5f3cd25c3a52e7 Mon Sep 17 00:00:00 2001 From: Huang Ying Date: Sun, 12 Mar 2017 19:53:58 +0800 Subject: union: Add create-all-directories? parameter to 'union-build'. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * guix/build/union.scm (union-build): Add create-all-directories? keyword parameter. * tests/union.scm ("union-build #:create-all-directories? #t"): New test. Co-authored-by: Ludovic Courtès --- tests/union.scm | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/union.scm b/tests/union.scm index cccf397181..b63edc757b 100644 --- a/tests/union.scm +++ b/tests/union.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès +;;; Copyright © 2012, 2013, 2014, 2015, 2017 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -124,4 +124,24 @@ ;; new 'bin' sub-directory in the profile. (eq? 'directory (stat:type (lstat "bin")))))))) +(test-assert "union-build #:create-all-directories? #t" + (let* ((build `(begin + (use-modules (guix build union)) + (union-build (assoc-ref %outputs "out") + (map cdr %build-inputs) + #:create-all-directories? #t))) + (input (package-derivation %store %bootstrap-guile)) + (drv (build-expression->derivation %store "union-test-all-dirs" + build + #:modules '((guix build union)) + #:inputs `(("g" ,input))))) + (and (build-derivations %store (list drv)) + (with-directory-excursion (derivation->output-path drv) + ;; Even though there's only one input to the union, + ;; #:create-all-directories? #t must have created bin/ rather than + ;; making it a symlink to Guile's bin/. + (and (file-exists? "bin/guile") + (file-is-directory? "bin") + (eq? 'symlink (stat:type (lstat "bin/guile")))))))) + (test-end) -- cgit v1.2.3 From 689db38e3467f66725e8841eac72225110a75a17 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Mon, 20 Mar 2017 13:41:41 +0300 Subject: ui: Support Texinfo markup in package synopses. * guix/ui.scm (package-field-string): New procedure. (package-description-string): Use it. (package-synopsis-string): New procedure. (package->recutils): Use it. * guix/scripts/lint.scm (check-synopsis-style)[check-texinfo-markup]: New procedure. Use it in checks. * tests/lint.scm: Test it. * gnu/packages/perl.scm (perl-try-tiny)[synopsis]: Adjust for the Texinfo markup. --- gnu/packages/perl.scm | 2 +- guix/scripts/lint.scm | 22 +++++++++++++++++++--- guix/ui.scm | 17 +++++++++++++---- tests/lint.scm | 8 ++++++++ 4 files changed, 41 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/gnu/packages/perl.scm b/gnu/packages/perl.scm index 82c4ef5d17..3470121883 100644 --- a/gnu/packages/perl.scm +++ b/gnu/packages/perl.scm @@ -7684,7 +7684,7 @@ Tree::Simple::Visitor::* objects.") "068vdbpacfawc3lkfs0b82xxl27h3l0gj14iada3vlwk8rps9yv0")))) (build-system perl-build-system) (home-page "http://search.cpan.org/dist/Try-Tiny") - (synopsis "Minimal try/catch with proper preservation of $@") + (synopsis "Minimal try/catch with proper preservation of $@@") (description "This module provides bare bones try/catch/finally statements that are designed to minimize common mistakes with eval blocks, and nothing else.") 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 ;;; Copyright © 2016 Danny Milosavljevic ;;; Copyright © 2016 Hartmut Goebel +;;; Copyright © 2017 Alex Kost ;;; ;;; 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 ;;; Copyright © 2014 Cyril Roelandt ;;; Copyright © 2014 Cyrill Schenkel -;;; Copyright © 2014, 2015 Alex Kost +;;; Copyright © 2014, 2015, 2017 Alex Kost ;;; Copyright © 2015 David Thompson ;;; Copyright © 2015, 2016 Mathieu Lirzin ;;; Copyright © 2016 Roel Janssen @@ -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 diff --git a/tests/lint.scm b/tests/lint.scm index 3a9b89fe95..7610a91fd3 100644 --- a/tests/lint.scm +++ b/tests/lint.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2014, 2015, 2016 Ludovic Courtès ;;; Copyright © 2015, 2016 Mathieu Lirzin ;;; Copyright © 2016 Hartmut Goebel +;;; Copyright © 2017 Alex Kost ;;; ;;; This file is part of GNU Guix. ;;; @@ -167,6 +168,13 @@ (check-synopsis-style pkg))) "synopsis should not be empty"))) +(test-assert "synopsis: valid Texinfo markup" + (->bool + (string-contains + (with-warnings + (check-synopsis-style (dummy-package "x" (synopsis "Bad $@ texinfo")))) + "Texinfo markup in synopsis is invalid"))) + (test-assert "synopsis: does not start with an upper-case letter" (->bool (string-contains (with-warnings -- cgit v1.2.3