From: Simon Tournier <zimon.toutoune@gmail.com>
To: 62036@debbugs.gnu.org
Cc: Josselin Poiret <dev@jpoiret.xyz>,
Tobias Geerinckx-Rice <me@tobias.gr>,
Simon Tournier <zimon.toutoune@gmail.com>,
Mathieu Othacehe <othacehe@gnu.org>,
ludo@gnu.org, Christopher Baines <mail@cbaines.net>,
Ricardo Wurmus <rekado@elephly.net>
Subject: [bug#62036] [PATCH v2] guix: packages: Consider 'patches' by 'package-direct-sources'.
Date: Sat, 11 Mar 2023 17:51:10 +0100 [thread overview]
Message-ID: <20230311165110.726639-1-zimon.toutoune@gmail.com> (raw)
In-Reply-To: <20230307171833.4170067-1-zimon.toutoune@gmail.com>
* guix/packages.scm (package-direct-sources): Return 'origin' from 'patches'.
* tests/packages.scm: Test it.
---
guix/packages.scm | 10 ++++++++--
tests/packages.scm | 17 ++++++++++++++++-
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/guix/packages.scm b/guix/packages.scm
index 041a872f9d..7b098e21f0 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -9,6 +9,7 @@
;;; Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
;;; Copyright © 2022 Maxime Devos <maximedevos@telenet.be>
;;; Copyright © 2022 jgart <jgart@dismail.de>
+;;; Copyright © 2023 Simon Tournier <zimon.toutoune@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1239,8 +1240,13 @@ (define-syntax modify-inputs
(define (package-direct-sources package)
"Return all source origins associated with PACKAGE; including origins in
-PACKAGE's inputs."
- `(,@(or (and=> (package-source package) list) '())
+PACKAGE's inputs and patches."
+ (define (expand source)
+ (cons
+ source
+ (filter origin? (origin-patches source))))
+
+ `(,@(or (and=> (package-source package) expand) '())
,@(filter-map (match-lambda
((_ (? origin? orig) _ ...)
orig)
diff --git a/tests/packages.scm b/tests/packages.scm
index f58c47817b..27fb918f90 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2023 Simon Tournier <zimon.toutoune@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -418,12 +419,15 @@ (define read-at
(let* ((o (dummy-origin))
(u (dummy-origin))
(i (dummy-origin))
+ (j (dummy-origin (patches (list o))))
(a (dummy-package "a"))
(b (dummy-package "b" (inputs (list a i))))
(c (package (inherit b) (source o)))
(d (dummy-package "d"
(build-system trivial-build-system)
- (source u) (inputs (list c)))))
+ (source u) (inputs (list c))))
+ (e (dummy-package "e" (source j)))
+ (f (package (inherit e) (inputs (list u)))))
(test-assert "package-direct-sources, no source"
(null? (package-direct-sources a)))
(test-equal "package-direct-sources, #f source"
@@ -437,6 +441,17 @@ (define read-at
(and (= (length (pk 's-sources s)) 2)
(member o s)
(member i s))))
+ (test-assert "package-direct-sources, with patches"
+ (let ((s (package-direct-sources e)))
+ (and (= (length (pk 's-sources s)) 2)
+ (member o s)
+ (member j s))))
+ (test-assert "package-direct-sources, with patches and inputs"
+ (let ((s (package-direct-sources f)))
+ (and (= (length (pk 's-sources s)) 3)
+ (member o s)
+ (member j s)
+ (member u s))))
(test-assert "package-transitive-sources"
(let ((s (package-transitive-sources d)))
(and (= (length (pk 'd-sources s)) 3)
base-commit: 7376424844e0dc1103a9d86799c2fb9bd4aa35eb
--
2.38.1
next prev parent reply other threads:[~2023-03-11 16:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-07 17:18 [bug#62036] [PATCH] guix: packages: Consider 'patches' by 'package-direct-sources' Simon Tournier
2023-03-09 19:43 ` Josselin Poiret via Guix-patches via
2023-03-10 11:33 ` Simon Tournier
2023-03-10 12:12 ` Josselin Poiret via Guix-patches via
2023-03-11 16:51 ` Simon Tournier [this message]
2023-03-13 11:14 ` bug#62036: [PATCH v2] " 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230311165110.726639-1-zimon.toutoune@gmail.com \
--to=zimon.toutoune@gmail.com \
--cc=62036@debbugs.gnu.org \
--cc=dev@jpoiret.xyz \
--cc=ludo@gnu.org \
--cc=mail@cbaines.net \
--cc=me@tobias.gr \
--cc=othacehe@gnu.org \
--cc=rekado@elephly.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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.