unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* "move-phase-after"?
@ 2016-09-06  8:03 Hartmut Goebel
  2016-09-06 10:54 ` "move-phase-after"? Danny Milosavljevic
  2016-09-06 17:11 ` "move-phase-after"? Efraim Flashner
  0 siblings, 2 replies; 6+ messages in thread
From: Hartmut Goebel @ 2016-09-06  8:03 UTC (permalink / raw)
  To: guix-devel

Hi,

for some package I need to switch the install and check phase. Could
please someone point me to a function like "move-phase-after"? Thanks.

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: "move-phase-after"?
  2016-09-06  8:03 "move-phase-after"? Hartmut Goebel
@ 2016-09-06 10:54 ` Danny Milosavljevic
  2016-09-06 13:06   ` "move-phase-after"? Danny Milosavljevic
  2016-09-07 12:20   ` "move-phase-after"? Ludovic Courtès
  2016-09-06 17:11 ` "move-phase-after"? Efraim Flashner
  1 sibling, 2 replies; 6+ messages in thread
From: Danny Milosavljevic @ 2016-09-06 10:54 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: guix-devel

Hi,

On Tue, 6 Sep 2016 10:03:34 +0200
Hartmut Goebel <h.goebel@crazy-compilers.com> wrote:

> for some package I need to switch the install and check phase. Could
> please someone point me to a function like "move-phase-after"? Thanks.

I don't think this exists yet. 

See the ./guix/build/utils.scm for the macro definition.

You would have to do something like

(let ((check (assoc-ref %standard-phases 'check)))
  (modify-phases %standard-phases
    (delete 'check)
    (add-after 'install 'check
      check)))

I think it would be possible to add such a thing to the macro.

You can see what the macro expands to by using (tree-il->scheme (macroexpand ...)).

See https://www.gnu.org/software/guile/docs/master/guile.html/Macro-Expansion.html

It's expanding to something like this:

(alist-replace 'a FN 
  (alist-cons-after 'b FN
    (alist-cons-after 'c FN
      (alist-delete 'd
        %standard-phases))))

Each of the alist-* results in a new list.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: "move-phase-after"?
  2016-09-06 10:54 ` "move-phase-after"? Danny Milosavljevic
@ 2016-09-06 13:06   ` Danny Milosavljevic
  2016-09-07 12:20   ` "move-phase-after"? Ludovic Courtès
  1 sibling, 0 replies; 6+ messages in thread
From: Danny Milosavljevic @ 2016-09-06 13:06 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: guix-devel

Maybe something like this (has NOT been tested):

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
 ;;;


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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: "move-phase-after"?
  2016-09-06  8:03 "move-phase-after"? Hartmut Goebel
  2016-09-06 10:54 ` "move-phase-after"? Danny Milosavljevic
@ 2016-09-06 17:11 ` Efraim Flashner
  1 sibling, 0 replies; 6+ messages in thread
From: Efraim Flashner @ 2016-09-06 17:11 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 576 bytes --]

On Tue, Sep 06, 2016 at 10:03:34AM +0200, Hartmut Goebel wrote:
> Hi,
> 
> for some package I need to switch the install and check phase. Could
> please someone point me to a function like "move-phase-after"? Thanks.
> 

Check out python-cysignals in python.scm for mixing build systems. I
know I've seen something else for moving 'check after 'install.

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: "move-phase-after"?
  2016-09-06 10:54 ` "move-phase-after"? Danny Milosavljevic
  2016-09-06 13:06   ` "move-phase-after"? Danny Milosavljevic
@ 2016-09-07 12:20   ` Ludovic Courtès
  2016-09-08  8:11     ` "move-phase-after"? Hartmut Goebel
  1 sibling, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2016-09-07 12:20 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

Hello,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> On Tue, 6 Sep 2016 10:03:34 +0200
> Hartmut Goebel <h.goebel@crazy-compilers.com> wrote:
>
>> for some package I need to switch the install and check phase. Could
>> please someone point me to a function like "move-phase-after"? Thanks.
>
> I don't think this exists yet. 
>
> See the ./guix/build/utils.scm for the macro definition.
>
> You would have to do something like
>
> (let ((check (assoc-ref %standard-phases 'check)))
>   (modify-phases %standard-phases
>     (delete 'check)
>     (add-after 'install 'check
>       check)))

Yeah, that’s what I would do.  I don’t think we need to extend
‘modify-phases’ just for this.

Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: "move-phase-after"?
  2016-09-07 12:20   ` "move-phase-after"? Ludovic Courtès
@ 2016-09-08  8:11     ` Hartmut Goebel
  0 siblings, 0 replies; 6+ messages in thread
From: Hartmut Goebel @ 2016-09-08  8:11 UTC (permalink / raw)
  To: Ludovic Courtès, Danny Milosavljevic; +Cc: guix-devel

Am 07.09.2016 um 14:20 schrieb Ludovic Courtès:
> Yeah, that’s what I would do.  I don’t think we need to extend
> ‘modify-phases’ just for this.

Okay. So I'll hack it into the build instructions.

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-09-08  8:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-06  8:03 "move-phase-after"? Hartmut Goebel
2016-09-06 10:54 ` "move-phase-after"? Danny Milosavljevic
2016-09-06 13:06   ` "move-phase-after"? Danny Milosavljevic
2016-09-07 12:20   ` "move-phase-after"? Ludovic Courtès
2016-09-08  8:11     ` "move-phase-after"? Hartmut Goebel
2016-09-06 17:11 ` "move-phase-after"? Efraim Flashner

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).