all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Custom 'install phase
@ 2021-03-07 19:06 Raghav Gururajan
  2021-03-07 21:44 ` Julien Lepiller
  0 siblings, 1 reply; 12+ messages in thread
From: Raghav Gururajan @ 2021-03-07 19:06 UTC (permalink / raw)
  To: help-guix


[-- Attachment #1.1: Type: text/plain, Size: 1040 bytes --]

Hello Guix!

I am trying to re-write the custom 'install phase of this 
(https://paste.debian.net/1188301/) package definition,as follows:

```
            (replace 'install
              (lambda _
                (for-each (lambda (solution)
                            (with-directory-excursion solution
                                 (apply (assoc-ref copy:%standard-phases 
'install)
                                        #:install-plan
                                        '(("src" (string-append 
"include/" solution)
                                           #:include-regexp ("\\.h$"))))))
                          (list
                           "qtlockedfile"
                           "qtpropertybrowser"
                           "qtservice"
                           "qtsingleapplication"
                           "qtsoap"))
                #t))
```

I get an error In procedure apply: Apply to non-list: "src".

Can anyone help me with the correct snippet please?

Regards,
RG.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

* Re: Custom 'install phase
  2021-03-07 19:06 Custom 'install phase Raghav Gururajan
@ 2021-03-07 21:44 ` Julien Lepiller
  2021-03-08  8:16   ` Raghav Gururajan
  0 siblings, 1 reply; 12+ messages in thread
From: Julien Lepiller @ 2021-03-07 21:44 UTC (permalink / raw)
  To: help-guix, Raghav Gururajan

I think you need to remove the apply, but keep one level of parenthesis, like so:

((assoc-ref …) args …)

Apply takes the last arguments, which must be a list and appends all its elements to the invocation. Like (apply foo '(1 2 3 4)) is tge same as (foo 1 2 3 4). Here you're probably confused because of the assoc-ref is not a procodure, but it's fine: it returns a procedure, so guile can execute it and pass arguments to it the normal way.

Le 7 mars 2021 14:06:37 GMT-05:00, Raghav Gururajan <rg@raghavgururajan.name> a écrit :
>Hello Guix!
>
>I am trying to re-write the custom 'install phase of this 
>(https://paste.debian.net/1188301/) package definition,as follows:
>
>```
>            (replace 'install
>              (lambda _
>                (for-each (lambda (solution)
>                            (with-directory-excursion solution
>                               (apply (assoc-ref copy:%standard-phases 
>'install)
>                                        #:install-plan
>                                        '(("src" (string-append 
>"include/" solution)
>                                        #:include-regexp ("\\.h$"))))))
>                          (list
>                           "qtlockedfile"
>                           "qtpropertybrowser"
>                           "qtservice"
>                           "qtsingleapplication"
>                           "qtsoap"))
>                #t))
>```
>
>I get an error In procedure apply: Apply to non-list: "src".
>
>Can anyone help me with the correct snippet please?
>
>Regards,
>RG.

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

* Re: Custom 'install phase
  2021-03-07 21:44 ` Julien Lepiller
@ 2021-03-08  8:16   ` Raghav Gururajan
  2021-03-08  9:26     ` Ricardo Wurmus
  0 siblings, 1 reply; 12+ messages in thread
From: Raghav Gururajan @ 2021-03-08  8:16 UTC (permalink / raw)
  To: Julien Lepiller, help-guix


[-- Attachment #1.1: Type: text/plain, Size: 1458 bytes --]

Hi Julien!

> I think you need to remove the apply, but keep one level of parenthesis, 
> like so:
> 
> ((assoc-ref …) args …)
> 
> Apply takes the last arguments, which must be a list and appends all its 
> elements to the invocation. Like (apply foo '(1 2 3 4)) is tge same as 
> (foo 1 2 3 4). Here you're probably confused because of the assoc-ref is 
> not a procodure, but it's fine: it returns a procedure, so guile can 
> execute it and pass arguments to it the normal way.

So I tried the following:

```
            (replace 'install
              (lambda _
                (for-each (lambda (solution)
                            (with-directory-excursion solution
                                 ((assoc-ref copy:%standard-phases 'install)
                                        #:install-plan
                                        '(("src" (string-append 
"include/" solution)
                                           #:include-regexp ("\\.h$"))))))
                          (list
                           "qtlockedfile"
                           "qtpropertybrowser"
                           "qtservice"
                           "qtsingleapplication"
                           "qtsoap"))
                #t))
```

I get "In procedure string-append: Wrong type (expecting string): #f", 
with and without replacing `(string-append "include/" solution)` with 
`"include"`.

Regards,
RG.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

* Re: Custom 'install phase
  2021-03-08  8:16   ` Raghav Gururajan
@ 2021-03-08  9:26     ` Ricardo Wurmus
  2021-03-08  9:35       ` Raghav Gururajan
  0 siblings, 1 reply; 12+ messages in thread
From: Ricardo Wurmus @ 2021-03-08  9:26 UTC (permalink / raw)
  To: Raghav Gururajan; +Cc: help-guix


Raghav Gururajan <rg@raghavgururajan.name> writes:

> Hi Julien!
>
>> I think you need to remove the apply, but keep one level of
>> parenthesis, like so:
>> ((assoc-ref …) args …)
>> Apply takes the last arguments, which must be a list and appends all
>> its elements to the invocation. Like (apply foo '(1 2 3 4)) is tge
>> same as (foo 1 2 3 4). Here you're probably confused because of the
>> assoc-ref is not a procodure, but it's fine: it returns a procedure,
>> so guile can execute it and pass arguments to it the normal way.
>
> So I tried the following:
>
> ```
>            (replace 'install
>              (lambda _
>                (for-each (lambda (solution)
>                            (with-directory-excursion solution
>                                 ((assoc-ref copy:%standard-phases 'install)
>                                        #:install-plan
>                                        '(("src" (string-append
>                                        "include/" solution)

The (string-append …) is quoted.  Is this on purpose?

>                #t))

Note that we no longer need to end phases on #t.

-- 
Ricardo


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

* Re: Custom 'install phase
  2021-03-08  9:26     ` Ricardo Wurmus
@ 2021-03-08  9:35       ` Raghav Gururajan
  2021-03-08 11:45         ` Julien Lepiller
  0 siblings, 1 reply; 12+ messages in thread
From: Raghav Gururajan @ 2021-03-08  9:35 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Julien Lepiller, help-guix


[-- Attachment #1.1: Type: text/plain, Size: 1007 bytes --]

Hi Ricardo!

> The (string-append …) is quoted.  Is this on purpose?
> 
>>                 #t))
> 
> Note that we no longer need to end phases on #t.

Oops, I meed to change that to (list. I now did:

```
            (replace 'install
              (lambda _
                (for-each (lambda (solution)
                            (with-directory-excursion solution
                                 ((assoc-ref copy:%standard-phases 'install)
                                        #:install-plan
                                        (list ("src" (string-append 
"include/" solution)
                                           #:include-regexp ("\\.h$"))))))
                          (list
                           "qtlockedfile"
                           "qtpropertybrowser"
                           "qtservice"
                           "qtsingleapplication"
                           "qtsoap"))))
```

I now get Wrong type to apply: "\\.h$"

Regards,
RG.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

* Re: Custom 'install phase
  2021-03-08  9:35       ` Raghav Gururajan
@ 2021-03-08 11:45         ` Julien Lepiller
  2021-03-09  1:09           ` Raghav Gururajan
  0 siblings, 1 reply; 12+ messages in thread
From: Julien Lepiller @ 2021-03-08 11:45 UTC (permalink / raw)
  To: Raghav Gururajan, Ricardo Wurmus; +Cc: help-guix

Maybe quote it? #:include-regexp '("\\.h$")

Le 8 mars 2021 04:35:28 GMT-05:00, Raghav Gururajan <rg@raghavgururajan.name> a écrit :
>Hi Ricardo!
>
>> The (string-append …) is quoted.  Is this on purpose?
>> 
>>>                 #t))
>> 
>> Note that we no longer need to end phases on #t.
>
>Oops, I meed to change that to (list. I now did:
>
>```
>            (replace 'install
>              (lambda _
>                (for-each (lambda (solution)
>                            (with-directory-excursion solution
>                            ((assoc-ref copy:%standard-phases 'install)
>                                        #:install-plan
>                                        (list ("src" (string-append 
>"include/" solution)
>                                        #:include-regexp ("\\.h$"))))))
>                          (list
>                           "qtlockedfile"
>                           "qtpropertybrowser"
>                           "qtservice"
>                           "qtsingleapplication"
>                           "qtsoap"))))
>```
>
>I now get Wrong type to apply: "\\.h$"
>
>Regards,
>RG.

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

* Re: Custom 'install phase
  2021-03-08 11:45         ` Julien Lepiller
@ 2021-03-09  1:09           ` Raghav Gururajan
  2021-03-09  2:37             ` Julien Lepiller
  2021-03-09  8:13             ` Ricardo Wurmus
  0 siblings, 2 replies; 12+ messages in thread
From: Raghav Gururajan @ 2021-03-09  1:09 UTC (permalink / raw)
  To: Julien Lepiller, Ricardo Wurmus; +Cc: help-guix


[-- Attachment #1.1: Type: text/plain, Size: 865 bytes --]

Hi Julien!

> Maybe quote it? #:include-regexp '("\\.h$")

So I did:

```
            (replace 'install
              (lambda _
                (for-each (lambda (solution)
                            (with-directory-excursion solution
                                 ((assoc-ref copy:%standard-phases 'install)
                                        #:install-plan
                                        (list ("src" (string-append 
"include/" solution)
                                           #:include-regexp '("\\.h$"))))))
                          (list
                           "qtlockedfile"
                           "qtpropertybrowser"
                           "qtservice"
                           "qtsingleapplication"
                           "qtsoap"))))
```

I get Wrong type to apply: "src"

Regards,
RG.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

* Re: Custom 'install phase
  2021-03-09  1:09           ` Raghav Gururajan
@ 2021-03-09  2:37             ` Julien Lepiller
  2021-03-09  3:28               ` Raghav Gururajan
  2021-03-09  8:13             ` Ricardo Wurmus
  1 sibling, 1 reply; 12+ messages in thread
From: Julien Lepiller @ 2021-03-09  2:37 UTC (permalink / raw)
  To: Raghav Gururajan, Ricardo Wurmus; +Cc: help-guix

Well, look at the location of that "src". You have ("src" (string-append …)). That can't work, "src" is a string, not a function (that's what the error message is trying to tell you).

Since you need two lists for the install-plan, you can fix that with:

#:install-plan
(list (list "src" (string-append …)))

Le 8 mars 2021 20:09:24 GMT-05:00, Raghav Gururajan <rg@raghavgururajan.name> a écrit :
>Hi Julien!
>
>> Maybe quote it? #:include-regexp '("\\.h$")
>
>So I did:
>
>```
>            (replace 'install
>              (lambda _
>                (for-each (lambda (solution)
>                            (with-directory-excursion solution
>                            ((assoc-ref copy:%standard-phases 'install)
>                                        #:install-plan
>                                        (list ("src" (string-append 
>"include/" solution)
>                                       #:include-regexp '("\\.h$"))))))
>                          (list
>                           "qtlockedfile"
>                           "qtpropertybrowser"
>                           "qtservice"
>                           "qtsingleapplication"
>                           "qtsoap"))))
>```
>
>I get Wrong type to apply: "src"
>
>Regards,
>RG.

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

* Re: Custom 'install phase
  2021-03-09  2:37             ` Julien Lepiller
@ 2021-03-09  3:28               ` Raghav Gururajan
  2021-03-09  3:47                 ` Raghav Gururajan
  0 siblings, 1 reply; 12+ messages in thread
From: Raghav Gururajan @ 2021-03-09  3:28 UTC (permalink / raw)
  To: Julien Lepiller, Ricardo Wurmus; +Cc: help-guix


[-- Attachment #1.1: Type: text/plain, Size: 521 bytes --]

Hi Julien!

> Well, look at the location of that "src". You have ("src" (string-append 
> …)). That can't work, "src" is a string, not a function (that's what the 
> error message is trying to tell you).
> 
> Since you need two lists for the install-plan, you can fix that with:
> 
> #:install-plan
> (list (list "src" (string-append …)))

Wouldn't that make `"src"` and `(string-append "include/" solutions)` 
make two separate components of a list? They must be one single argument.

Regards,
RG.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

* Re: Custom 'install phase
  2021-03-09  3:28               ` Raghav Gururajan
@ 2021-03-09  3:47                 ` Raghav Gururajan
  0 siblings, 0 replies; 12+ messages in thread
From: Raghav Gururajan @ 2021-03-09  3:47 UTC (permalink / raw)
  To: Julien Lepiller, Ricardo Wurmus; +Cc: help-guix


[-- Attachment #1.1: Type: text/plain, Size: 879 bytes --]

So this appears to be close to working one:

```
            (replace 'install
              (lambda args
                (for-each (lambda (solution)
                            (with-directory-excursion solution
                              (apply (assoc-ref copy:%standard-phases 
'install)
                                     #:install-plan
                                     '(("src" "include/qtsolutions"
                                        #:include-regexp ("\\.h$")))
                                     args)))
                          (list
                           "qtlockedfile"
                           "qtpropertybrowser"
                           "qtservice"
                           "qtsingleapplication"
                           "qtsoap"))))
```

I now get "In procedure copy-file: Permission denied".

Regards,
RG.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

* Re: Custom 'install phase
  2021-03-09  1:09           ` Raghav Gururajan
  2021-03-09  2:37             ` Julien Lepiller
@ 2021-03-09  8:13             ` Ricardo Wurmus
  2021-03-09  8:25               ` Raghav Gururajan
  1 sibling, 1 reply; 12+ messages in thread
From: Ricardo Wurmus @ 2021-03-09  8:13 UTC (permalink / raw)
  To: Raghav Gururajan; +Cc: help-guix


Raghav Gururajan <rg@raghavgururajan.name> writes:

>            (replace 'install
>              (lambda _
>                (for-each (lambda (solution)
>                            (with-directory-excursion solution
>                                 ((assoc-ref copy:%standard-phases 'install)
>                                        #:install-plan
>                                        (list ("src" (string-append
>                                        "include/" solution)
>                                           #:include-regexp '("\\.h$"))))))
>                          (list
>                           "qtlockedfile"
>                           "qtpropertybrowser"
>                           "qtservice"
>                           "qtsingleapplication"
>                           "qtsoap"))))
[…]

> I get Wrong type to apply: "src"

As Julien wrote this is expected as you have an expression that starts
with a string:

   ("hello" whatever)

This will try to apply the string "hello" to the argument “whatever”.  I
don’t know how to apply a string to anything, and neither does Scheme.

I would go with quasiquotation:

--8<---------------cut here---------------start------------->8---
(with-directory-excursion solution
  ((assoc-ref copy:%standard-phases 'install)
   #:install-plan
   `(("src" ,(string-append "include/" solution)
      #:include-regexp ("\\.h$")))))
--8<---------------cut here---------------end--------------->8---

The expression following #:install-plan is quoted (so it’s inert data),
and we temporarily unquote to evaluate the “string-append” expression;
then we go straight back to “data mode”, so we don’t have to explicitly
quote “("\\.h$")”.

-- 
Ricardo


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

* Re: Custom 'install phase
  2021-03-09  8:13             ` Ricardo Wurmus
@ 2021-03-09  8:25               ` Raghav Gururajan
  0 siblings, 0 replies; 12+ messages in thread
From: Raghav Gururajan @ 2021-03-09  8:25 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Julien Lepiller, help-guix


[-- Attachment #1.1: Type: text/plain, Size: 997 bytes --]

Hi Ricardo!

> As Julien wrote this is expected as you have an expression that starts
> with a string:
> 
>     ("hello" whatever)
> 
> This will try to apply the string "hello" to the argument “whatever”.  I
> don’t know how to apply a string to anything, and neither does Scheme.
> 
> I would go with quasiquotation:
> 
> --8<---------------cut here---------------start------------->8---
> (with-directory-excursion solution
>    ((assoc-ref copy:%standard-phases 'install)
>     #:install-plan
>     `(("src" ,(string-append "include/" solution)
>        #:include-regexp ("\\.h$")))))
> --8<---------------cut here---------------end--------------->8---
> 
> The expression following #:install-plan is quoted (so it’s inert data),
> and we temporarily unquote to evaluate the “string-append” expression;
> then we go straight back to “data mode”, so we don’t have to explicitly
> quote “("\\.h$")”.

It worked. Thanks so much!

Regards,
RG.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

end of thread, other threads:[~2021-03-09  8:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-07 19:06 Custom 'install phase Raghav Gururajan
2021-03-07 21:44 ` Julien Lepiller
2021-03-08  8:16   ` Raghav Gururajan
2021-03-08  9:26     ` Ricardo Wurmus
2021-03-08  9:35       ` Raghav Gururajan
2021-03-08 11:45         ` Julien Lepiller
2021-03-09  1:09           ` Raghav Gururajan
2021-03-09  2:37             ` Julien Lepiller
2021-03-09  3:28               ` Raghav Gururajan
2021-03-09  3:47                 ` Raghav Gururajan
2021-03-09  8:13             ` Ricardo Wurmus
2021-03-09  8:25               ` Raghav Gururajan

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.