Subject: [bug#49169] [PATCH 00/11] Removing input labels from package definitions

From: Sarah Morgensen <[email-masked]>
Date: Fri, 09 Jul 2021 21:53:30 -0700

Hello :)

This is a wonderful direction! I am always happy to see boilerplate
evaporate.

Ludovic Courtès <[email-masked]> writes:

>   • I changed a few importers to emit simplified package inputs.
>     We’ll have to take care of the other importers eventually.

I found one more easy change to make in the importers. I just gave it a
quick smoke test with the Go importer, nothing exhaustive; and I'm not
sure which other importers use it. I've attached the patch below.

>  doc/guix.texi          | 208 ++++++++++++++--

In the manual, you added:

> Each element of these lists is either a package, origin, or other
> ``file-like object'' [...]

How should a file input like this be handled?

  ("some.patch" (search-patch "some.patch"))

If I had to guess, I'd try some gexp like...

  #$(local-file (search-patch "some.patch"))

But I really have no idea!

>  guix/scripts/style.scm | 527 +++++++++++++++++++++++++++++++++++++++++
>  tests/style.scm        | 366 ++++++++++++++++++++++++++++
>  23 files changed, 1643 insertions(+), 298 deletions(-)

The style script makes up fully half of the patch! Wow.

--
Sarah

diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index d817318a91..5075e5c491 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -237,12 +237,10 @@ into a proper sentence and by using two spaces between sentences."
 optional OUTPUT, tries to generate a quoted list of inputs, as suitable to
 use in an 'inputs' field of a package definition."
   (define (make-input input version)
-    (cons* input (list 'unquote (string->symbol
-                                 (if version
-                                     (string-append input "-" version)
-                                     input)))
-           (or (and output (list output))
-               '())))
+    (let ((name (if version (string-append input "-" version) input)))
+      (if output
+          (list (string->symbol name) output)
+          (string->symbol name))))
 
   (map (match-lambda
          ((input version) (make-input input version))
@@ -263,7 +261,7 @@ snippet generated is for regular inputs."
       (()
        '())
       ((package-inputs ...)
-       `((,field-name (,'quasiquote ,package-inputs)))))))
+       `((,field-name (list ,@package-inputs)))))))
 
 (define* (maybe-native-inputs package-names #:optional (output #f))
   "Same as MAYBE-INPUTS, but for native inputs."