guix-commits
[Top][All Lists]
Advanced

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

02/03: Add package/inherit.


From: Mark H. Weaver
Subject: 02/03: Add package/inherit.
Date: Tue, 2 May 2017 04:19:48 -0400 (EDT)

mhw pushed a commit to branch master
in repository guix.

commit bedba064267490f2d9f7ee44e5ec103aacc82611
Author: Mark H Weaver <address@hidden>
Date:   Tue May 2 03:39:23 2017 -0400

    Add package/inherit.
    
    * guix/packages.scm (package/inherit): New public macro.
---
 guix/packages.scm | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/guix/packages.scm b/guix/packages.scm
index 44f2c32..8ead950 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès 
<address@hidden>
-;;; Copyright © 2014, 2015 Mark H Weaver <address@hidden>
+;;; Copyright © 2014, 2015, 2017 Mark H Weaver <address@hidden>
 ;;; Copyright © 2015 Eric Bavier <address@hidden>
 ;;; Copyright © 2016 Alex Kost <address@hidden>
 ;;;
@@ -105,6 +105,7 @@
             package-cross-derivation
             package-output
             package-grafts
+            package/inherit
 
             transitive-input-references
 
@@ -789,6 +790,16 @@ package and returns its new name after rewrite."
 
   (package-mapping rewrite (cut assq <> replacements)))
 
+(define-syntax-rule (package/inherit p overrides ...)
+  "Like (package (inherit P) OVERRIDES ...), except that the same
+transformation is done to the package replacement, if any.  P must be a bare
+identifier, and will be bound to either P or its replacement when evaluating
+OVERRIDES."
+  (let loop ((p p))
+    (package (inherit p)
+      overrides ...
+      (replacement (and=> (package-replacement p) loop)))))
+
 
 ;;;
 ;;; Package derivations.



reply via email to

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