unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Herman Rimm via Guix-patches via <guix-patches@gnu.org>
To: 70923@debbugs.gnu.org
Cc: Lars-Dominik Braun <lars@6xq.net>
Subject: [bug#70923] [PATCH 09/13] import: hackage: Use 'maybe-list-field' procedure.
Date: Mon, 13 May 2024 22:08:06 +0200	[thread overview]
Message-ID: <42bfac7c486b9dd94633eddb348cb97c3a47bd43.1715627497.git.herman@rimm.ee> (raw)
In-Reply-To: <cover.1715627497.git.herman@rimm.ee>

* guix/import/hackage.scm (maybe-inputs, maybe-arguments): Delete
procedures.
(hackage-module->sexp): Use 'maybe-list-field' and
'maybe-upstream-inputs' procedures.
* tests/hackage.scm: Fix whitespace and replace 'quasiquote' with
'list'.

Change-Id: I4fe39ff84c9f6a677f810d9e4fe751d762973757
---
 guix/import/hackage.scm | 38 +++++++++++---------------------------
 tests/hackage.scm       | 13 +++++++------
 2 files changed, 18 insertions(+), 33 deletions(-)

diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm
index 79a51d3300..e90f3c932f 100644
--- a/guix/import/hackage.scm
+++ b/guix/import/hackage.scm
@@ -288,26 +288,6 @@ (define* (hackage-module->sexp cabal cabal-hash
                           #:include-test-dependencies?
                           include-test-dependencies?))
 
-  (define (maybe-inputs input-type inputs)
-    (match inputs
-      (()
-       '())
-      ((inputs ...)
-       (list (list input-type
-                   `(list ,@(map (compose string->symbol
-                                          upstream-input-downstream-name)
-                                 inputs)))))))
-
-  (define (maybe-arguments)
-    (match (append (if (not include-test-dependencies?)
-                       '(#:tests? #f)
-                       '())
-                   (if (not (string-null? revision))
-                       `(#:cabal-revision (,revision ,cabal-hash))
-                       '()))
-      (() '())
-      (args `((arguments (,'quasiquote ,args))))))
-
   (let ((tarball (with-store store
                    (download-to-store store source-url))))
     (values
@@ -324,13 +304,17 @@ (define* (hackage-module->sexp cabal cabal-hash
                          "failed to download tar archive")))))
         (build-system haskell-build-system)
         (properties '((upstream-name . ,name)))
-        ,@(maybe-inputs 'inputs
-                        (filter (upstream-input-type-predicate 'regular)
-                                inputs))
-        ,@(maybe-inputs 'native-inputs
-                        (filter (upstream-input-type-predicate 'native)
-                                inputs))
-        ,@(maybe-arguments)
+        ,@(maybe-upstream-inputs 'inputs
+            (filter (upstream-input-type-predicate 'regular) inputs))
+        ,@(maybe-upstream-inputs 'native-inputs
+            (filter (upstream-input-type-predicate 'native) inputs))
+        ,@(maybe-list-field 'arguments
+            (append (if (not include-test-dependencies?)
+                        '(#:tests? #f)
+                        '())
+                    (if (not (string-null? revision))
+                        `(#:cabal-revision '(,revision ,cabal-hash))
+                        '())))
         (home-page ,(cabal-package-home-page cabal))
         (synopsis ,(cabal-package-synopsis cabal))
         (description ,(beautify-description (cabal-package-description cabal)))
diff --git a/tests/hackage.scm b/tests/hackage.scm
index 403f587c41..f6d91515e2 100644
--- a/tests/hackage.scm
+++ b/tests/hackage.scm
@@ -67,7 +67,7 @@ (define test-cabal-3
   if impl(ghc>=7.2&&<7.6)
     Build-depends: ghc-b
   if impl(ghc == 7.8)
-    Build-depends: 
+    Build-depends:
       HTTP       >= 4000.2.5 && < 4000.3,
       mtl        >= 2.0      && < 3
 ")
@@ -86,7 +86,7 @@ (define test-cabal-4
   if impl(ghc>=7.2&&<7.6)
     Build-depends: ghc-b
   if impl(ghc == 7.8)
-    Build-depends: 
+    Build-depends:
       HTTP       >= 4000.2.5 && < 4000.3,
       mtl        >= 2.0      && < 3
 ")
@@ -101,7 +101,7 @@ (define test-cabal-5
 license: BSD3
 library
   if impl(ghc == 7.8)
-    Build-depends: 
+    Build-depends:
       HTTP       >= 4000.2.5 && < 4000.3,
   if impl(ghc -any)
     Build-depends: mtl        >= 2.0      && < 3
@@ -126,7 +126,7 @@ (define test-cabal-6
   if impl(ghc>=7.2&&<7.6)
     Build-depends: ghc-b
   if impl(ghc == 7.8)
-    Build-depends: 
+    Build-depends:
       HTTP       >= 4000.2.5 && < 4000.3,
       mtl        >= 2.0      && < 3
 ")
@@ -524,8 +524,9 @@ (define-package-matcher match-ghc-foo-revision
     ('properties '(quote ((upstream-name . "foo"))))
     ('inputs ('list 'ghc-http))
     ('arguments
-     ('quasiquote
-      ('#:cabal-revision
+     ('list
+      '#:cabal-revision
+      ('quote
        ("2" "0xxd88fb659f0krljidbvvmkh9ppjnx83j0nqzx8whcg4n5qbyng"))))
     ('home-page "http://test.org")
     ('synopsis (? string?))
-- 
2.41.0





  parent reply	other threads:[~2024-05-13 20:09 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-13 19:59 [bug#70923] [PATCH 00/13] Add (guix import utils) procedures Herman Rimm via Guix-patches via
2024-05-13 20:07 ` [bug#70923] [PATCH 01/13] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
2024-05-13 20:07 ` [bug#70923] [PATCH 02/13] import: utils: Emit new-style package inputs Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 03/13] tests: go: Adjust to " Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 04/13] tests: elm: " Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 05/13] import: crate: Emit " Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 06/13] import: utils: Add 'maybe-upstream-inputs' procedure Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 07/13] import: pypi: Use 'maybe-list-field' procedure Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 08/13] import: elpa: Use maybe-propagated-inputs procedure Herman Rimm via Guix-patches via
2024-05-13 20:08 ` Herman Rimm via Guix-patches via [this message]
2024-05-13 20:08 ` [bug#70923] [PATCH 10/13] import: cran: Use 'maybe-list-field' procedure Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 11/13] import: cpan: Use 'maybe-upstream-inputs' procedure Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 12/13] import: egg: Use maybe-*inputs procedures Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 13/13] import: hexpm: Use (guix import utils) 'maybe-inputs' procedure Herman Rimm via Guix-patches via
2024-09-04 20:32 ` [bug#70923] [PATCH v2 01/12] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
2024-09-04 20:32   ` [bug#70923] [PATCH v2 02/12] import: utils: Emit new-style inputs from maybe-*inputs procedures Herman Rimm via Guix-patches via
2024-09-04 20:32   ` [bug#70923] [PATCH v2 03/12] tests: elm: Adjust to new-style package inputs Herman Rimm via Guix-patches via
2024-09-04 20:32   ` [bug#70923] [PATCH v2 04/12] import: crate: Use (guix import utils) procedures Herman Rimm via Guix-patches via
2024-09-04 20:32   ` [bug#70923] [PATCH v2 05/12] import: utils: Add maybe-upstream-inputs Herman Rimm via Guix-patches via
2024-09-04 20:33   ` [bug#70923] [PATCH v2 06/12] import: pypi: Use maybe-upstream-inputs Herman Rimm via Guix-patches via
2024-09-04 20:33   ` [bug#70923] [PATCH v2 07/12] import: elpa: Use maybe-propagated-inputse Herman Rimm via Guix-patches via
2024-09-04 20:33   ` [bug#70923] [PATCH v2 08/12] import: hackage: Use maybe-list-field Herman Rimm via Guix-patches via
2024-09-04 20:33   ` [bug#70923] [PATCH v2 09/12] import: cran: Refactor format-inputs and use maybe-list-field Herman Rimm via Guix-patches via
2024-09-04 20:33   ` [bug#70923] [PATCH v2 10/12] import: cpan: Use maybe-upstream-inputs Herman Rimm via Guix-patches via
2024-09-04 20:33   ` [bug#70923] [PATCH v2 11/12] import: egg: Use maybe-*inputs procedures Herman Rimm via Guix-patches via
2024-09-04 20:33   ` [bug#70923] [PATCH v2 12/12] import: hexpm: Use maybe-inputs Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 00/11] Add (guix import utils) procedures Herman Rimm via Guix-patches via
2024-09-24 20:13   ` [bug#70923] [PATCH v3 01/11] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
2024-09-24 20:13   ` [bug#70923] [PATCH v3 02/11] import: utils: Emit new-style package inputs Herman Rimm via Guix-patches via
2024-09-24 20:13   ` [bug#70923] [PATCH v3 03/11] import: crate: " Herman Rimm via Guix-patches via
2024-09-24 20:13   ` [bug#70923] [PATCH v3 04/11] import: utils: Add 'maybe-upstream-inputs' procedure Herman Rimm via Guix-patches via
2024-09-24 20:13   ` [bug#70923] [PATCH v3 05/11] import: pypi: Use 'maybe-list-field' procedure Herman Rimm via Guix-patches via
2024-09-24 20:13   ` [bug#70923] [PATCH v3 06/11] import: elpa: Use maybe-propagated-inputs procedure Herman Rimm via Guix-patches via
2024-09-24 20:13   ` [bug#70923] [PATCH v3 07/11] import: hackage: Use 'maybe-list-field' procedure Herman Rimm via Guix-patches via
2024-09-24 20:13   ` [bug#70923] [PATCH v3 08/11] import: cran: " Herman Rimm via Guix-patches via
2024-09-24 20:13   ` [bug#70923] [PATCH v3 09/11] import: cpan: Use 'maybe-upstream-inputs' procedure Herman Rimm via Guix-patches via
2024-09-24 20:13   ` [bug#70923] [PATCH v3 10/11] import: egg: Use maybe-*inputs procedures Herman Rimm via Guix-patches via
2024-09-24 20:13   ` [bug#70923] [PATCH v3 11/11] import: hexpm: Use (guix import utils) 'maybe-inputs' procedure Herman Rimm via Guix-patches via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42bfac7c486b9dd94633eddb348cb97c3a47bd43.1715627497.git.herman@rimm.ee \
    --to=guix-patches@gnu.org \
    --cc=70923@debbugs.gnu.org \
    --cc=herman@rimm.ee \
    --cc=lars@6xq.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).