Subject: [PATCH 2/2] import: Beautify descriptions when appropriate.

From: Xinglu Chen <[email-masked]>
Date: Wed, 03 Nov 2021 11:19:25 +0100

* guix/import/elpa.scm (elpa-package->sexp)
* guix/import/gnu.scm (gnu-package->sexp)
* guix/import/hackage.scm (hackage-module->sexp)
* guix/import/minetest.scm (make-minetest-sexp)
* guix/import/opam.scm (opam->guix-package)
* guix/import/pypi.scm (make-pypi-sexp): Beautify descriptions.
---
 guix/import/elpa.scm     | 2 +-
 guix/import/gnu.scm      | 3 ++-
 guix/import/hackage.scm  | 4 ++--
 guix/import/minetest.scm | 2 +-
 guix/import/opam.scm     | 3 ++-
 guix/import/pypi.scm     | 2 +-
 6 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm
index 96ebc17af1..8daa77bfcd 100644
--- a/guix/import/elpa.scm
+++ b/guix/import/elpa.scm
@@ -390,7 +390,7 @@ (define melpa-source
             '())
       (home-page ,(elpa-package-home-page pkg))
       (synopsis ,(elpa-package-synopsis pkg))
-      (description ,(elpa-package-description pkg))
+      (description ,(beautify-description (elpa-package-description pkg)))
       (license ,license))
    dependencies-names))
 
diff --git a/guix/import/gnu.scm b/guix/import/gnu.scm
index 51d5b77d34..2b9b71feb0 100644
--- a/guix/import/gnu.scm
+++ b/guix/import/gnu.scm
@@ -100,7 +100,8 @@ (define sig-url
                         (file-sha256 tarball))))))
           (build-system gnu-build-system)
           (synopsis ,(gnu-package-doc-summary package))
-          (description ,(gnu-package-doc-description package))
+          (description ,(beautify-description
+                         (gnu-package-doc-description package)))
           (home-page ,(match (gnu-package-doc-urls package)
                         ((head . tail) (qualified-url head))))
           (license find-by-yourself!)))
diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm
index 03881f1a3d..95955e27a0 100644
--- a/guix/import/hackage.scm
+++ b/guix/import/hackage.scm
@@ -32,7 +32,7 @@ (define-module (guix import hackage)
   #:use-module ((guix utils) #:select (package-name->name+version
                                        canonical-newline-port))
   #:use-module (guix http-client)
-  #:use-module ((guix import utils) #:select (factorize-uri recursive-import))
+  #:use-module (guix import utils)
   #:use-module (guix import cabal)
   #:use-module (guix store)
   #:use-module (gcrypt hash)
@@ -315,7 +315,7 @@ (define (maybe-arguments)
         ,@(maybe-arguments)
         (home-page ,(cabal-package-home-page cabal))
         (synopsis ,(cabal-package-synopsis cabal))
-        (description ,(cabal-package-description cabal))
+        (description ,(beautify-description (cabal-package-description cabal)))
         (license ,(string->license (cabal-package-license cabal))))
      (append hackage-dependencies hackage-native-dependencies))))
 
diff --git a/guix/import/minetest.scm b/guix/import/minetest.scm
index 0f3ab473ca..abddd885ee 100644
--- a/guix/import/minetest.scm
+++ b/guix/import/minetest.scm
@@ -322,7 +322,7 @@ (define (make-minetest-sexp author/name version repository commit
      ,@(maybe-propagated-inputs (map contentdb->package-name inputs))
      (home-page ,home-page)
      (synopsis ,(delete-cr synopsis))
-     (description ,(delete-cr description))
+     (description ,(beautify-description (delete-cr description)))
      (license ,(if (eq? media-license license)
                    license
                    `(list ,media-license ,license)))
diff --git a/guix/import/opam.scm b/guix/import/opam.scm
index fe13d29f03..395019d758 100644
--- a/guix/import/opam.scm
+++ b/guix/import/opam.scm
@@ -371,7 +371,8 @@ (define* (opam->guix-package name #:key (repo '()) version)
                                ,(list 'quasiquote `((upstream-name . ,name))))))
                        (home-page ,(metadata-ref opam-content "homepage"))
                        (synopsis ,(metadata-ref opam-content "synopsis"))
-                       (description ,(metadata-ref opam-content "description"))
+                       (description ,(beautify-description
+                                      (metadata-ref opam-content "description")))
                        (license ,(spdx-string->license
                                   (metadata-ref opam-content "license"))))
                     (filter
diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
index f908136481..3d463a0775 100644
--- a/guix/import/pypi.scm
+++ b/guix/import/pypi.scm
@@ -474,7 +474,7 @@ (define (maybe-upstream-name name)
                    ,@(maybe-inputs native-inputs 'native-inputs)
                    (home-page ,home-page)
                    (synopsis ,synopsis)
-                   (description ,description)
+                   (description ,(beautify-description description))
                    (license ,(license->symbol license)))
                 upstream-dependencies))))))))
 
-- 
2.33.0