emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#62036: closed ([PATCH] guix: packages: Consider 'patches' by 'packag


From: GNU bug Tracking System
Subject: bug#62036: closed ([PATCH] guix: packages: Consider 'patches' by 'package-direct-sources'.)
Date: Mon, 13 Mar 2023 11:16:02 +0000

Your message dated Mon, 13 Mar 2023 12:14:51 +0100
with message-id <87o7ow52dw.fsf@gnu.org>
and subject line Re: [PATCH v2] guix: packages: Consider 'patches' by 
'package-direct-sources'.
has caused the debbugs.gnu.org bug report #62036,
regarding [PATCH] guix: packages: Consider 'patches' by 
'package-direct-sources'.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
62036: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62036
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: [PATCH] guix: packages: Consider 'patches' by 'package-direct-sources'. Date: Tue, 7 Mar 2023 18:18:33 +0100
* 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(-)

Hi,

This patch improves some coverage when listing all the origins (fixed outputs)
of some packages.  The procedure 'packages-direct-sources' already lists the
'origin' as inputs but is missing the 'origin' as 'patches'.  For an instance
of such, see the package 'ntp'.

Note that it is not recursive.  If an 'origin' is listed in 'patches' or
'inputs' and that origin also contains 'patches' which is another 'origin'
then it will be missed.  For now, it is not covered because it somehow adds
complexity without an instance (yet) of such case.

Cheers,
simon




diff --git a/guix/packages.scm b/guix/packages.scm
index 041a872f9d..0f88564ab4 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)
+    (append
+     (list 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: 723fc5df3e964fcecb09c7c6fd48f00f97e2e806
-- 
2.38.1




--- End Message ---
--- Begin Message --- Subject: Re: [PATCH v2] guix: packages: Consider 'patches' by 'package-direct-sources'. Date: Mon, 13 Mar 2023 12:14:51 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Hello,

Simon Tournier <zimon.toutoune@gmail.com> skribis:

> * guix/packages.scm (package-direct-sources): Return 'origin' from 'patches'.
> * tests/packages.scm: Test it.

Applied, thanks!

Ludo’.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]