Subject: [PATCH 11/13] import: cpan: Use 'maybe-upstream-inputs' procedure.

From: Herman Rimm <[email-masked]>
Date: Mon, 13 May 2024 22:08:08 +0200

* guix/import/cpan.scm (maybe-inputs): Delete procedure.
(cpan-module->sexp): Use 'maybe-upstream-inputs' procedure.

Change-Id: I4fa99da62d81f02c2998ad96f5ea81e27df071cd
---
 guix/import/cpan.scm | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm
index b87736eef6..55c616314b 100644
--- a/guix/import/cpan.scm
+++ b/guix/import/cpan.scm
@@ -37,7 +37,8 @@ (define-module (guix import cpan)
   #:use-module (guix utils)
   #:use-module (guix base32)
   #:use-module ((guix download) #:select (download-to-store url-fetch))
-  #:use-module ((guix import utils) #:select (factorize-uri))
+  #:use-module ((guix import utils) #:select (factorize-uri
+                                              maybe-upstream-inputs))
   #:use-module (guix import json)
   #:use-module (guix packages)
   #:use-module (guix upstream)
@@ -275,15 +276,6 @@ (define (cpan-module->sexp release)
   (define version (cpan-release-version release))
   (define source-url (cpan-source-url release))
 
-  (define (maybe-inputs input-type inputs)
-    (match inputs
-      (()
-       '())
-      ((inputs ...)
-       `((,input-type (list ,@(map (compose string->symbol
-                                            upstream-input-downstream-name)
-                                   inputs)))))))
-
   (let ((tarball (with-store store
                    (download-to-store store source-url)))
         (inputs (cpan-module-inputs release)))
@@ -297,12 +289,10 @@ (define (cpan-module->sexp release)
                   (base32
                    ,(bytevector->nix-base32-string (file-sha256 tarball))))))
        (build-system perl-build-system)
-       ,@(maybe-inputs 'native-inputs
-                       (filter (upstream-input-type-predicate 'native)
-                               inputs))
-       ,@(maybe-inputs 'propagated-inputs
-                       (filter (upstream-input-type-predicate 'propagated)
-                               inputs))
+       ,@(maybe-upstream-inputs 'native-inputs
+           (filter (upstream-input-type-predicate 'native) inputs))
+       ,@(maybe-upstream-inputs 'propagated-inputs
+           (filter (upstream-input-type-predicate 'propagated) inputs))
        (home-page ,(cpan-home name))
        (synopsis ,(cpan-release-abstract release))
        (description fill-in-yourself!)
-- 
2.41.0