[bug#70923,v4,04/11] import: utils: Add 'maybe-upstream-inputs' procedure.

Message ID 7fd481409247d1124171d1f8a5a549f6e4d92f46.1733774143.git.herman@rimm.ee
State New
Headers
Series [bug#70923,v4,01/11] build-system: cargo: Accept unlabeled #:cargo-inputs. |

Commit Message

Herman Rimm Dec. 9, 2024, 7:58 p.m. UTC
  * guix/import/utils.scm (maybe-upstream-inputs): Add procedure.

Change-Id: Ib8a80216d512c0373e55e4f27e1ef2a7c1fb854a
---
 guix/import/utils.scm | 9 +++++++++
 1 file changed, 9 insertions(+)
  

Patch

diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index 4eab790645..9544fbf00f 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -45,6 +45,7 @@  (define-module (guix import utils)
   #:use-module (guix download)
   #:use-module (guix sets)
   #:use-module ((guix ui) #:select (fill-paragraph))
+  #:use-module (guix upstream)
   #:use-module (gnu packages)
   #:autoload   (ice-9 control) (let/ec)
   #:use-module (ice-9 match)
@@ -71,6 +72,7 @@  (define-module (guix import utils)
             maybe-inputs
             maybe-native-inputs
             maybe-propagated-inputs
+            maybe-upstream-inputs
             package->definition
 
             spdx-string->license
@@ -467,6 +469,13 @@  (define* (maybe-propagated-inputs package-names #:optional (output #f))
   "MAYBE-PACKAGES-FIELD for propagated inputs."
   (maybe-packages-field 'propagated-inputs package-names output))
 
+(define* (maybe-upstream-inputs type upstream-inputs)
+  "Given a list of UPSTREAM-NAMES, tries to generate the TYPE field of a
+package definition."
+  (maybe-list-field type
+    (map (compose string->symbol upstream-input-downstream-name)
+         upstream-inputs)))
+
 (define* (package->definition guix-package #:optional append-version?/string)
   "If APPEND-VERSION?/STRING is #t, append the package's major+minor version.
 If it is the symbol 'full, append the package's complete version.  If