diff mbox

"move-phase-after"?

Message ID 20160906150620.2b896bc9@scratchpost.org
State New
Headers show

Commit Message

Danny Milosavljevic Sept. 6, 2016, 1:06 p.m. UTC
Maybe something like this (has NOT been tested):



I'm still not sure whether we should make something like this easy - it sounds hacky to move phases like this.
diff mbox

Patch

diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 2988193..c2cf25d 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -517,6 +517,7 @@  following forms:
   (replace <old-phase-name> <new-phase>)
   (add-before <old-phase-name> <new-phase-name> <new-phase>)
   (add-after <old-phase-name> <new-phase-name> <new-phase>)
+  (move-after <destination-phase-name> <source-phase-name>)
 
 Where every <*-phase-name> is an automatically quoted symbol, and <new-phase>
 an expression evaluating to a procedure."
@@ -526,7 +527,7 @@  an expression evaluating to a procedure."
     phases*))
 
 (define-syntax %modify-phases
-  (syntax-rules (delete replace add-before add-after)
+  (syntax-rules (delete replace add-before add-after move-after)
     ((_ phases (delete old-phase-name))
      (alist-delete old-phase-name phases))
     ((_ phases (replace old-phase-name new-phase))
@@ -534,7 +535,11 @@  an expression evaluating to a procedure."
     ((_ phases (add-before old-phase-name new-phase-name new-phase))
      (alist-cons-before old-phase-name new-phase-name new-phase phases))
     ((_ phases (add-after old-phase-name new-phase-name new-phase))
-     (alist-cons-after old-phase-name new-phase-name new-phase phases))))
+     (alist-cons-after old-phase-name new-phase-name new-phase phases))
+    ((_ phases (move-after a-phase-name source-phase-name))
+     (let ((source-phase (assoc-ref phases source-phase-name)))
+      (alist-cons-after a-phase-name source-phase-name source-phase
+       (alist-delete source-phase-name phases))))))
 
 ^L
 ;;;