import: utils: End package descriptions with period.

* guix/import/utils.scm (beautify-description): Append period to last
words which do not end with one.
* tests/crate.scm: Append period to descriptions.
* tests/elm.scm: Append period to descriptions.
* tests/gem.scm: Append period to descriptions.
* tests/hexpm.scm: Append period to descriptions.
* tests/minetest.scm: Append period to descriptions.
* tests/pypi.scm: Append period to descriptions.
* tests/import-utils.scm ("beautify-description: transform fragment into
sentence"): Likewise.

Change-Id: I0b12c4d94cb26cf62fab5b7cbf7885e66ff6c10f
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Herman Rimm 2024-05-12 21:08:32 +02:00 committed by Ludovic Courtès
parent e62fd9004b
commit 510ad5d93c
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
8 changed files with 44 additions and 35 deletions

View file

@ -370,6 +370,15 @@ (define* (beautify-description description #:optional (length 80))
(cons* "This" "package" (cons* "This" "package"
(string-downcase first) rest)) (string-downcase first) rest))
(_ words))) (_ words)))
(new-words
(match new-words
((rest ... last)
(reverse (cons (if (or (string-suffix? "." last)
(string-suffix? "!" last)
(string-suffix? "?" last))
last
(string-append last "."))
(reverse rest))))))
(cleaned (cleaned
(string-join (map fix-word new-words)))) (string-join (map fix-word new-words))))
;; Use double spacing between sentences ;; Use double spacing between sentences

View file

@ -503,7 +503,7 @@ (define have-guile-semver?
(("rust-leaf-alice" ('unquote 'rust-leaf-alice-0.7)))))) (("rust-leaf-alice" ('unquote 'rust-leaf-alice-0.7))))))
(home-page "http://example.com") (home-page "http://example.com")
(synopsis "summary") (synopsis "summary")
(description "This package provides summary") (description "This package provides summary.")
(license (list license:expat license:asl2.0)))) (license (list license:expat license:asl2.0))))
(string=? test-source-hash hash)) (string=? test-source-hash hash))
@ -592,7 +592,7 @@ (define have-guile-semver?
('quasiquote (#:skip-build? #t))) ('quasiquote (#:skip-build? #t)))
(home-page "http://example.com") (home-page "http://example.com")
(synopsis "summary") (synopsis "summary")
(description "This package provides summary") (description "This package provides summary.")
(license (list license:expat license:asl2.0)))) (license (list license:expat license:asl2.0))))
(define-public 'rust-leaf-alice-0.7 (define-public 'rust-leaf-alice-0.7
(package (package
@ -611,7 +611,7 @@ (define-public 'rust-leaf-alice-0.7
(arguments ('quasiquote (#:skip-build? #t))) (arguments ('quasiquote (#:skip-build? #t)))
(home-page "http://example.com") (home-page "http://example.com")
(synopsis "summary") (synopsis "summary")
(description "This package provides summary") (description "This package provides summary.")
(license (list license:expat license:asl2.0)))) (license (list license:expat license:asl2.0))))
(define-public 'rust-leaf-bob-3 (define-public 'rust-leaf-bob-3
(package (package
@ -630,7 +630,7 @@ (define-public 'rust-leaf-bob-3
(arguments ('quasiquote (#:skip-build? #t))) (arguments ('quasiquote (#:skip-build? #t)))
(home-page "http://example.com") (home-page "http://example.com")
(synopsis "summary") (synopsis "summary")
(description "This package provides summary") (description "This package provides summary.")
(license (list license:expat license:asl2.0)))) (license (list license:expat license:asl2.0))))
(define-public 'rust-intermediate-b-1 (define-public 'rust-intermediate-b-1
(package (package
@ -653,7 +653,7 @@ (define-public 'rust-intermediate-b-1
('unquote rust-leaf-bob-3)))))) ('unquote rust-leaf-bob-3))))))
(home-page "http://example.com") (home-page "http://example.com")
(synopsis "summary") (synopsis "summary")
(description "This package provides summary") (description "This package provides summary.")
(license (list license:expat license:asl2.0)))) (license (list license:expat license:asl2.0))))
(define-public 'rust-intermediate-a-1 (define-public 'rust-intermediate-a-1
(package (package
@ -680,7 +680,7 @@ (define-public 'rust-intermediate-a-1
('unquote rust-leaf-bob-3)))))) ('unquote rust-leaf-bob-3))))))
(home-page "http://example.com") (home-page "http://example.com")
(synopsis "summary") (synopsis "summary")
(description "This package provides summary") (description "This package provides summary.")
(license (list license:expat license:asl2.0)))) (license (list license:expat license:asl2.0))))
(define-public 'rust-root-1 (define-public 'rust-root-1
(package (package
@ -711,7 +711,7 @@ (define-public 'rust-root-1
('unquote rust-intermediate-c-1)))))) ('unquote rust-intermediate-c-1))))))
(home-page "http://example.com") (home-page "http://example.com")
(synopsis "summary") (synopsis "summary")
(description "This package provides summary") (description "This package provides summary.")
(license (list license:expat license:asl2.0))))) (license (list license:expat license:asl2.0)))))
#t) #t)
(x (x
@ -740,7 +740,7 @@ (define-public 'rust-root-1
('unquote rust-leaf-alice-0.7)))))) ('unquote rust-leaf-alice-0.7))))))
(home-page "http://example.com") (home-page "http://example.com")
(synopsis "summary") (synopsis "summary")
(description "This package provides summary") (description "This package provides summary.")
(license (list license:expat license:asl2.0)))) (license (list license:expat license:asl2.0))))
(define-public 'rust-leaf-alice-0.7 (define-public 'rust-leaf-alice-0.7
(package (package
@ -758,7 +758,7 @@ (define-public 'rust-leaf-alice-0.7
(build-system cargo-build-system) (build-system cargo-build-system)
(home-page "http://example.com") (home-page "http://example.com")
(synopsis "summary") (synopsis "summary")
(description "This package provides summary") (description "This package provides summary.")
(license (list license:expat license:asl2.0)))) (license (list license:expat license:asl2.0))))
(define-public 'rust-leaf-bob-3 (define-public 'rust-leaf-bob-3
(package (package
@ -776,7 +776,7 @@ (define-public 'rust-leaf-bob-3
(build-system cargo-build-system) (build-system cargo-build-system)
(home-page "http://example.com") (home-page "http://example.com")
(synopsis "summary") (synopsis "summary")
(description "This package provides summary") (description "This package provides summary.")
(license (list license:expat license:asl2.0)))) (license (list license:expat license:asl2.0))))
(define-public 'rust-intermediate-b-1 (define-public 'rust-intermediate-b-1
(package (package
@ -798,7 +798,7 @@ (define-public 'rust-intermediate-b-1
('unquote rust-leaf-bob-3)))))) ('unquote rust-leaf-bob-3))))))
(home-page "http://example.com") (home-page "http://example.com")
(synopsis "summary") (synopsis "summary")
(description "This package provides summary") (description "This package provides summary.")
(license (list license:expat license:asl2.0)))) (license (list license:expat license:asl2.0))))
(define-public 'rust-intermediate-a-1 (define-public 'rust-intermediate-a-1
(package (package
@ -824,7 +824,7 @@ (define-public 'rust-intermediate-a-1
('unquote rust-leaf-bob-3)))))) ('unquote rust-leaf-bob-3))))))
(home-page "http://example.com") (home-page "http://example.com")
(synopsis "summary") (synopsis "summary")
(description "This package provides summary") (description "This package provides summary.")
(license (list license:expat license:asl2.0)))) (license (list license:expat license:asl2.0))))
(define-public 'rust-root-1 (define-public 'rust-root-1
(package (package
@ -855,7 +855,7 @@ (define-public 'rust-root-1
('unquote rust-intermediate-c-1)))))) ('unquote rust-intermediate-c-1))))))
(home-page "http://example.com") (home-page "http://example.com")
(synopsis "summary") (synopsis "summary")
(description "This package provides summary") (description "This package provides summary.")
(license (list license:expat license:asl2.0))))) (license (list license:expat license:asl2.0)))))
#t) #t)
(x (x
@ -972,7 +972,7 @@ (define rust-leaf-bob-3.0.2-yanked
('unquote 'rust-leaf-bob-4.0.0-yanked)))))) ('unquote 'rust-leaf-bob-4.0.0-yanked))))))
(home-page "http://example.com") (home-page "http://example.com")
(synopsis "summary") (synopsis "summary")
(description "This package provides summary") (description "This package provides summary.")
(license (list license:expat license:asl2.0))))) (license (list license:expat license:asl2.0)))))
#t) #t)
(x (x
@ -1038,7 +1038,7 @@ (define rust-leaf-bob-3.0.2-yanked
(build-system cargo-build-system) (build-system cargo-build-system)
(home-page "http://example.com") (home-page "http://example.com")
(synopsis "summary") (synopsis "summary")
(description "This package provides summary") (description "This package provides summary.")
(license (list license:expat license:asl2.0)))) (license (list license:expat license:asl2.0))))
(define-public 'rust-leaf-bob-3.0.2-yanked (define-public 'rust-leaf-bob-3.0.2-yanked
(package (package
@ -1058,7 +1058,7 @@ (define-public 'rust-leaf-bob-3.0.2-yanked
(build-system cargo-build-system) (build-system cargo-build-system)
(home-page "http://example.com") (home-page "http://example.com")
(synopsis "summary") (synopsis "summary")
(description "This package provides summary") (description "This package provides summary.")
(license (list license:expat license:asl2.0)))) (license (list license:expat license:asl2.0))))
(define-public 'rust-leaf-bob-3 (define-public 'rust-leaf-bob-3
(package (package
@ -1076,7 +1076,7 @@ (define-public 'rust-leaf-bob-3
(build-system cargo-build-system) (build-system cargo-build-system)
(home-page "http://example.com") (home-page "http://example.com")
(synopsis "summary") (synopsis "summary")
(description "This package provides summary") (description "This package provides summary.")
(license (list license:expat license:asl2.0)))) (license (list license:expat license:asl2.0))))
(define-public 'rust-bar-1 (define-public 'rust-bar-1
(package (package
@ -1103,7 +1103,7 @@ (define-public 'rust-bar-1
('unquote 'rust-leaf-bob-4.0.0-yanked)))))) ('unquote 'rust-leaf-bob-4.0.0-yanked))))))
(home-page "http://example.com") (home-page "http://example.com")
(synopsis "summary") (synopsis "summary")
(description "This package provides summary") (description "This package provides summary.")
(license (list license:expat license:asl2.0))))) (license (list license:expat license:asl2.0)))))
#t) #t)
(x (x

View file

@ -257,7 +257,7 @@ (define elm-guix-demo-dir
"https://package.elm-lang.org/packages/elm-guix/demo/3.0.0") "https://package.elm-lang.org/packages/elm-guix/demo/3.0.0")
(synopsis "A test for `(guix import elm)`") (synopsis "A test for `(guix import elm)`")
(description (description
"This package provides a test for `(guix import elm)`") "This package provides a test for `(guix import elm)`.")
(properties '((upstream-name . "elm-guix/demo"))) (properties '((upstream-name . "elm-guix/demo")))
(license license:gpl3+))) (license license:gpl3+)))
(equal? (directory-sha256 elm-guix-demo-dir) (equal? (directory-sha256 elm-guix-demo-dir)

View file

@ -117,7 +117,7 @@ (define test-bundler-json
(build-system ruby-build-system) (build-system ruby-build-system)
(propagated-inputs (list bundler ruby-bar)) (propagated-inputs (list bundler ruby-bar))
(synopsis "A cool gem") (synopsis "A cool gem")
(description "This package provides a cool gem") (description "This package provides a cool gem.")
(home-page "https://example.com") (home-page "https://example.com")
(license (list license:expat license:asl2.0))) (license (list license:expat license:asl2.0)))
#t) #t)
@ -146,7 +146,7 @@ (define test-bundler-json
(build-system ruby-build-system) (build-system ruby-build-system)
(propagated-inputs (list bundler ruby-bar)) (propagated-inputs (list bundler ruby-bar))
(synopsis "A cool gem") (synopsis "A cool gem")
(description "This package provides a cool gem") (description "This package provides a cool gem.")
(home-page "https://example.com") (home-page "https://example.com")
(license (list license:expat license:asl2.0))) (license (list license:expat license:asl2.0)))
#t) #t)
@ -182,7 +182,7 @@ (define test-bundler-json
(build-system ruby-build-system) (build-system ruby-build-system)
(propagated-inputs (list bundler)) (propagated-inputs (list bundler))
(synopsis "Another cool gem") (synopsis "Another cool gem")
(description "Another cool gem") (description "Another cool gem.")
(home-page "https://example.com") (home-page "https://example.com")
(license #f)) ;no licensing info (license #f)) ;no licensing info
(package (package
@ -198,7 +198,7 @@ (define test-bundler-json
(build-system ruby-build-system) (build-system ruby-build-system)
(propagated-inputs (list bundler ruby-bar)) (propagated-inputs (list bundler ruby-bar))
(synopsis "A cool gem") (synopsis "A cool gem")
(description "This package provides a cool gem") (description "This package provides a cool gem.")
(home-page "https://example.com") (home-page "https://example.com")
(license (list license:expat license:asl2.0)))) (license (list license:expat license:asl2.0))))
#t) #t)
@ -234,7 +234,7 @@ (define test-bundler-json
(build-system ruby-build-system) (build-system ruby-build-system)
(propagated-inputs (list bundler)) (propagated-inputs (list bundler))
(synopsis "Another cool gem") (synopsis "Another cool gem")
(description "Another cool gem") (description "Another cool gem.")
(home-page "https://example.com") (home-page "https://example.com")
(license #f)) ;no licensing info (license #f)) ;no licensing info
(package (package
@ -250,7 +250,7 @@ (define test-bundler-json
(build-system ruby-build-system) (build-system ruby-build-system)
(propagated-inputs (list bundler ruby-bar)) (propagated-inputs (list bundler ruby-bar))
(synopsis "A cool gem") (synopsis "A cool gem")
(description "This package provides a cool gem") (description "This package provides a cool gem.")
(home-page "https://example.com") (home-page "https://example.com")
(license (list license:expat license:asl2.0)))) (license (list license:expat license:asl2.0))))
#t) #t)

View file

@ -152,7 +152,7 @@ (define test-fasel-release
(build-system rebar-build-system) (build-system rebar-build-system)
(inputs (list erlang-blubb erlang-fasel)) (inputs (list erlang-blubb erlang-fasel))
(synopsis "A cool package") (synopsis "A cool package")
(description "This package provides a cool package") (description "This package provides a cool package.")
(home-page "https://hex.pm/packages/bla") (home-page "https://hex.pm/packages/bla")
(license (list license:expat license:asl2.0))) (license (list license:expat license:asl2.0)))
#t) #t)
@ -212,7 +212,7 @@ (define test-fasel-release
(build-system mix-build-system) (build-system mix-build-system)
(inputs (list erlang-fasel)) (inputs (list erlang-fasel))
(synopsis "Another cool package") (synopsis "Another cool package")
(description "Another cool package") (description "Another cool package.")
(home-page "https://hex.pm/packages/blubb") (home-page "https://hex.pm/packages/blubb")
(license license:expat)) (license license:expat))
(package (package
@ -227,7 +227,7 @@ (define test-fasel-release
"1k6d70mxwqgq78jrbr7yqnw187yki74jnagybi7nacrj4a67qjha")))) "1k6d70mxwqgq78jrbr7yqnw187yki74jnagybi7nacrj4a67qjha"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(synopsis "Yet another cool package") (synopsis "Yet another cool package")
(description "Yet another cool package") (description "Yet another cool package.")
(home-page "https://hex.pm/packages/fasel") (home-page "https://hex.pm/packages/fasel")
(license "GPL")) (license "GPL"))
(package (package
@ -243,7 +243,7 @@ (define test-fasel-release
(build-system rebar-build-system) (build-system rebar-build-system)
(inputs (list erlang-blubb erlang-fasel)) (inputs (list erlang-blubb erlang-fasel))
(synopsis "A cool package") (synopsis "A cool package")
(description "This package provides a cool package") (description "This package provides a cool package.")
(home-page "https://hex.pm/packages/bla") (home-page "https://hex.pm/packages/bla")
(license (list license:expat license:asl2.0)))) (license (list license:expat license:asl2.0))))
#t) #t)

View file

@ -43,7 +43,7 @@ (define-module (test-import-utils)
(test-equal "beautify-description: transform fragment into sentence" (test-equal "beautify-description: transform fragment into sentence"
"This package provides a function to establish world peace" "This package provides a function to establish world peace"
(beautify-description "A function to establish world peace")) (beautify-description "A function to establish world peace."))
(test-equal "beautify-description: remove single quotes" (test-equal "beautify-description: remove single quotes"
"CRAN likes to quote acronyms and function names." "CRAN likes to quote acronyms and function names."

View file

@ -48,7 +48,7 @@ (define* (make-package-sexp #:key
(home-page "https://example.org/foo") (home-page "https://example.org/foo")
(repo "https://example.org/foo.git") (repo "https://example.org/foo.git")
(synopsis "synopsis") (synopsis "synopsis")
(guix-description "description") (guix-description "description.")
(guix-license (guix-license
'(list license:cc-by-sa4.0 license:lgpl3+)) '(list license:cc-by-sa4.0 license:lgpl3+))
(inputs '()) (inputs '())

View file

@ -315,7 +315,7 @@ (define-syntax-rule (with-pypi responses body ...)
(native-inputs (list python-pytest)) (native-inputs (list python-pytest))
(home-page "http://example.com") (home-page "http://example.com")
(synopsis "summary") (synopsis "summary")
(description "summary") (description "summary.")
(license license:lgpl2.0)) (license license:lgpl2.0))
(and (string=? default-sha256/base32 hash) (and (string=? default-sha256/base32 hash)
(equal? (pypi->guix-package "foo" #:version "1.0.0") (equal? (pypi->guix-package "foo" #:version "1.0.0")
@ -356,7 +356,7 @@ (define-syntax-rule (with-pypi responses body ...)
(native-inputs (list python-pytest)) (native-inputs (list python-pytest))
(home-page "http://example.com") (home-page "http://example.com")
(synopsis "summary") (synopsis "summary")
(description "summary") (description "summary.")
(license license:lgpl2.0)) (license license:lgpl2.0))
(string=? default-sha256/base32 hash)) (string=? default-sha256/base32 hash))
(x (x
@ -384,7 +384,7 @@ (define-syntax-rule (with-pypi responses body ...)
(build-system pyproject-build-system) (build-system pyproject-build-system)
(home-page "http://example.com") (home-page "http://example.com")
(synopsis "summary") (synopsis "summary")
(description "summary") (description "summary.")
(license license:lgpl2.0)) (license license:lgpl2.0))
(string=? default-sha256/base32 hash)) (string=? default-sha256/base32 hash))
(x (x
@ -414,7 +414,7 @@ (define-syntax-rule (with-pypi responses body ...)
(native-inputs (list python-pytest)) (native-inputs (list python-pytest))
(home-page "http://example.com") (home-page "http://example.com")
(synopsis "summary") (synopsis "summary")
(description "summary") (description "summary.")
(license license:lgpl2.0)) (license license:lgpl2.0))
(string=? default-sha256/base32 hash)) (string=? default-sha256/base32 hash))
(x (x