unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 63571@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>,
	"Christopher Baines" <mail@cbaines.net>,
	"Josselin Poiret" <dev@jpoiret.xyz>,
	"Ludovic Courtès" <ludo@gnu.org>,
	"Mathieu Othacehe" <othacehe@gnu.org>,
	"Ricardo Wurmus" <rekado@elephly.net>,
	"Simon Tournier" <zimon.toutoune@gmail.com>,
	"Tobias Geerinckx-Rice" <me@tobias.gr>
Subject: [bug#63571] [PATCH 09/14] upstream: Remove <upstream-input-change> and related code.
Date: Thu, 18 May 2023 17:16:17 +0200	[thread overview]
Message-ID: <efeca305bb3cbe990c159a27c495929143bbfe8e.1684421460.git.ludo@gnu.org> (raw)
In-Reply-To: <cover.1684421459.git.ludo@gnu.org>

* guix/upstream.scm (<upstream-input-change>): Remove.
(changed-inputs): Remove.
* tests/upstream.scm (test-package, test-new-package)
("changed-inputs returns no changes")
("changed-inputs returns changes to plain input list")
("changed-inputs returns changes to all plain input lists"): Remove.
---
 guix/upstream.scm  |  64 ------------------------
 tests/upstream.scm | 120 ---------------------------------------------
 2 files changed, 184 deletions(-)

diff --git a/guix/upstream.scm b/guix/upstream.scm
index 1a90a342ff..54e6c3b89c 100644
--- a/guix/upstream.scm
+++ b/guix/upstream.scm
@@ -82,12 +82,6 @@ (define-module (guix upstream)
             upstream-updater-predicate
             upstream-updater-import
 
-            upstream-input-change?
-            upstream-input-change-name
-            upstream-input-change-type
-            upstream-input-change-action
-            changed-inputs
-
             %updaters
             lookup-updater
 
@@ -151,64 +145,6 @@ (define upstream-source-regular-inputs (input-type-filter 'regular))
 (define upstream-source-native-inputs (input-type-filter 'native))
 (define upstream-source-propagated-inputs (input-type-filter 'propagated))
 
-;; Representation of an upstream input change.
-(define-record-type* <upstream-input-change>
-  upstream-input-change make-upstream-input-change
-  upstream-input-change?
-  (name    upstream-input-change-name)    ;string
-  (type    upstream-input-change-type)    ;symbol: regular | native | propagated
-  (action  upstream-input-change-action)) ;symbol: add | remove
-
-(define (changed-inputs package source)
-  "Return a list of input changes for PACKAGE compared to the 'inputs' field
-of SOURCE, an <upstream-source> record."
-  (define input->name
-    (match-lambda
-      ((label (? package? pkg) . out) (package-name pkg))
-      (_ #f)))
-
-  (if (upstream-source-inputs source)
-      (let* ((new-regular (map upstream-input-downstream-name
-                               (upstream-source-regular-inputs source)))
-             (new-native (map upstream-input-downstream-name
-                              (upstream-source-native-inputs source)))
-             (new-propagated (map upstream-input-downstream-name
-                                  (upstream-source-propagated-inputs source)))
-             (current-regular
-              (filter-map input->name (package-inputs package)))
-             (current-native
-              (filter-map input->name (package-native-inputs package)))
-             (current-propagated
-              (filter-map input->name (package-propagated-inputs package))))
-        (append-map
-         (match-lambda
-           ((action type names)
-            (map (lambda (name)
-                   (upstream-input-change
-                    (name name)
-                    (type type)
-                    (action action)))
-                 names)))
-         `((add regular
-                ,(lset-difference equal?
-                                  new-regular current-regular))
-           (remove regular
-                   ,(lset-difference equal?
-                                     current-regular new-regular))
-           (add native
-                ,(lset-difference equal?
-                                  new-native current-native))
-           (remove native
-                   ,(lset-difference equal?
-                                     current-native new-native))
-           (add propagated
-                ,(lset-difference equal?
-                                  new-propagated current-propagated))
-           (remove propagated
-                   ,(lset-difference equal?
-                                     current-propagated new-propagated)))))
-      '()))
-
 (define* (url-predicate matching-url?)
   "Return a predicate that returns true when passed a package whose source is
 an <origin> with the URL-FETCH method, and one of its URLs passes
diff --git a/tests/upstream.scm b/tests/upstream.scm
index 0792ebd5d0..b82579228a 100644
--- a/tests/upstream.scm
+++ b/tests/upstream.scm
@@ -54,124 +54,4 @@ (define-module (test-upstream)
                            (signature-urls
                             '("ftp://example.org/foo-1.tar.xz.sig"))))))
 
-(define test-package
-  (package
-    (name "test")
-    (version "2.10")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "mirror://gnu/hello/hello-" version
-                                  ".tar.gz"))
-              (sha256
-               (base32
-                "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))
-    (build-system gnu-build-system)
-    (inputs
-     `(("hello" ,hello)))
-    (native-inputs
-     `(("sed" ,sed)
-       ("tar" ,tar)))
-    (propagated-inputs
-     `(("grep" ,grep)))
-    (home-page "http://localhost")
-    (synopsis "test")
-    (description "test")
-    (license license:gpl3+)))
-
-(test-equal "changed-inputs returns no changes"
-  '()
-  (changed-inputs test-package
-                  (upstream-source
-                   (package "test")
-                   (version "1")
-                   (urls '())
-                   (inputs
-                    (let ((->input
-                           (lambda (type)
-                             (match-lambda
-                               ((label _)
-                                (upstream-input
-                                 (name label)
-                                 (downstream-name label)
-                                 (type type)))))))
-                      (append (map (->input 'regular)
-                                   (package-inputs test-package))
-                              (map (->input 'native)
-                                   (package-native-inputs test-package))
-                              (map (->input 'propagated)
-                                   (package-propagated-inputs
-                                    test-package))))))))
-
-(define test-new-package
-  (package
-    (inherit test-package)
-    (inputs
-     (list hello))
-    (native-inputs
-     (list sed tar))
-    (propagated-inputs
-     (list grep))))
-
-(test-assert "changed-inputs returns changes to plain input list"
-  (let ((changes (changed-inputs
-                  (package
-                    (inherit test-new-package)
-                    (inputs (list hello sed))
-                    (native-inputs '())
-                    (propagated-inputs '()))
-                  (upstream-source
-                   (package "test")
-                   (version "1")
-                   (urls '())
-                   (inputs (list (upstream-input
-                                  (name "hello")
-                                  (downstream-name name))))))))
-    (match changes
-      ;; Exactly one change
-      (((? upstream-input-change? item))
-       (and (equal? (upstream-input-change-type item)
-                    'regular)
-            (equal? (upstream-input-change-action item)
-                    'remove)
-            (string=? (upstream-input-change-name item)
-                      "sed")))
-      (else (pk else #false)))))
-
-(test-assert "changed-inputs returns changes to all plain input lists"
-  (let ((changes (changed-inputs
-                  (package
-                    (inherit test-new-package)
-                    (inputs '())
-                    (native-inputs '())
-                    (propagated-inputs '()))
-                  (upstream-source
-                   (package "test")
-                   (version "1")
-                   (urls '())
-                   (inputs (list (upstream-input
-                                  (name "hello")
-                                  (downstream-name name)
-                                  (type 'regular))
-                                 (upstream-input
-                                  (name "sed")
-                                  (downstream-name name)
-                                  (type 'native))
-                                 (upstream-input
-                                  (name "tar")
-                                  (downstream-name name)
-                                  (type 'native))
-                                 (upstream-input
-                                  (name "grep")
-                                  (downstream-name name)
-                                  (type 'propagated))))))))
-    (match changes
-      (((? upstream-input-change? items) ...)
-       (and (equal? (map upstream-input-change-type items)
-                    '(regular native native propagated))
-            (equal? (map upstream-input-change-action items)
-                    '(add add add add))
-            (equal? (map upstream-input-change-name items)
-                    '("hello" "sed" "tar" "grep"))))
-      (else (pk else #false)))))
-
 (test-end)
-- 
2.40.1





  parent reply	other threads:[~2023-05-18 15:18 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-18 15:11 [bug#63571] [PATCH 00/14] 'guix refresh -u' updates input fields Ludovic Courtès
2023-05-18 15:16 ` [bug#63571] [PATCH 01/14] tests: pypi: Factorize tarball and wheel file creation Ludovic Courtès
2023-05-18 15:16 ` [bug#63571] [PATCH 02/14] tests: http: Allow responses to specify a path Ludovic Courtès
2023-05-18 15:16 ` [bug#63571] [PATCH 03/14] tests: pypi: Rewrite tests using a local HTTP server Ludovic Courtès
2023-05-18 15:16 ` [bug#63571] [PATCH 04/14] import: utils: 'call-with-networking-exception-handler' doesn't unwind Ludovic Courtès
2023-05-18 15:16 ` [bug#63571] [PATCH 05/14] import: json: Add #:timeout to 'json-fetch' Ludovic Courtès
2023-05-18 15:16 ` [bug#63571] [PATCH 06/14] upstream: Replace 'input-changes' field by 'inputs' Ludovic Courtès
2023-05-18 15:16 ` [bug#63571] [PATCH 07/14] diagnostics: Factorize 'absolute-location' Ludovic Courtès
2023-05-18 15:16 ` [bug#63571] [PATCH 08/14] upstream: 'update-package-source' edits input fields Ludovic Courtès
2023-05-18 15:16 ` Ludovic Courtès [this message]
2023-05-18 15:16 ` [bug#63571] [PATCH 10/14] tests: upstream: Restore test that was skipped Ludovic Courtès
2023-05-18 15:16 ` [bug#63571] [PATCH 11/14] import: cpan: Remove unary 'string-append' call Ludovic Courtès
2023-05-18 15:16 ` [bug#63571] [PATCH 12/14] import: cpan: Represent dependencies as <upstream-input> records Ludovic Courtès
2023-05-18 15:16 ` [bug#63571] [PATCH 13/14] import: cpan: Updater provides input list Ludovic Courtès
2023-05-18 15:16 ` [bug#63571] [PATCH 14/14] import: elpa: " Ludovic Courtès
2023-05-18 16:01 ` [bug#63571] [PATCH 00/14] 'guix refresh -u' updates input fields Liliana Marie Prikler
2023-05-18 17:02   ` Ludovic Courtès
2023-05-29 14:44 ` Ludovic Courtès
2023-05-29 14:45   ` [bug#63571] [PATCH v2 01/19] tests: pypi: Factorize tarball and wheel file creation Ludovic Courtès
2023-05-29 14:45   ` [bug#63571] [PATCH v2 02/19] tests: http: Allow responses to specify a path Ludovic Courtès
2023-05-29 14:45   ` [bug#63571] [PATCH v2 03/19] tests: pypi: Rewrite tests using a local HTTP server Ludovic Courtès
2023-05-29 14:45   ` [bug#63571] [PATCH v2 04/19] import: utils: 'call-with-networking-exception-handler' doesn't unwind Ludovic Courtès
2023-05-29 14:45   ` [bug#63571] [PATCH v2 05/19] import: json: Add #:timeout to 'json-fetch' Ludovic Courtès
2023-05-29 14:45   ` [bug#63571] [PATCH v2 06/19] doc: Mention 'guix refresh -u' for third-party channels Ludovic Courtès
2023-05-29 14:45   ` [bug#63571] [PATCH v2 07/19] upstream: Replace 'input-changes' field by 'inputs' Ludovic Courtès
2023-05-29 14:45   ` [bug#63571] [PATCH v2 08/19] diagnostics: Factorize 'absolute-location' Ludovic Courtès
2023-05-29 14:45   ` [bug#63571] [PATCH v2 09/19] upstream: 'update-package-source' edits input fields Ludovic Courtès
2023-05-29 14:45   ` [bug#63571] [PATCH v2 10/19] upstream: Remove <upstream-input-change> and related code Ludovic Courtès
2023-05-29 14:45   ` [bug#63571] [PATCH v2 11/19] tests: upstream: Restore test that was skipped Ludovic Courtès
2023-05-29 14:45   ` [bug#63571] [PATCH v2 12/19] import: cpan: Remove unary 'string-append' call Ludovic Courtès
2023-05-29 14:45   ` [bug#63571] [PATCH v2 13/19] import: cpan: Represent dependencies as <upstream-input> records Ludovic Courtès
2023-05-29 14:45   ` [bug#63571] [PATCH v2 14/19] import: cpan: Updater provides input list Ludovic Courtès
2023-05-29 14:45   ` [bug#63571] [PATCH v2 15/19] import: elpa: " Ludovic Courtès
2023-05-29 14:45   ` [bug#63571] [PATCH v2 16/19] import: gem: Factorize "bundler" special case for name mapping Ludovic Courtès
2023-05-29 14:45   ` [bug#63571] [PATCH v2 17/19] import: gem: Updater provides input list Ludovic Courtès
2023-05-29 14:45   ` [bug#63571] [PATCH v2 18/19] upstream: Honor package properties for ignored and extra inputs Ludovic Courtès
2023-05-29 14:45   ` [bug#63571] [PATCH v2 19/19] gnu: Add updater input properties for R and Python packages Ludovic Courtès
2023-05-31 21:54   ` bug#63571: [PATCH 00/14] 'guix refresh -u' updates input fields Ludovic Courtès

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=efeca305bb3cbe990c159a27c495929143bbfe8e.1684421460.git.ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=63571@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    --cc=mail@cbaines.net \
    --cc=me@tobias.gr \
    --cc=othacehe@gnu.org \
    --cc=rekado@elephly.net \
    --cc=zimon.toutoune@gmail.com \
    /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).