unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: "dabbede@gmail.com" <dabbede@gmail.com>
To: "(" <paren@disroot.org>
Cc: help-guix@gnu.org
Subject: Re: Creating a package using two sources/origins
Date: Tue, 13 Dec 2022 00:58:09 +0100	[thread overview]
Message-ID: <CAEwYQ4TB570UgOTygoGUMrsxuqc-d6txNreYAZZPSOnB9bJMUg@mail.gmail.com> (raw)
In-Reply-To: <CP07AL1WO41A.2H283M4ZH67ME@guix-framework>

Hi (

as you see I'm not yet practical with G-exp and I still have to
understand where exactly they are useful or not.

On Mon, Dec 12, 2022 at 11:43 PM ( <paren@disroot.org> wrote:
>
> Heya,
>
> What you need to do is combine ORIGIN with UNGEXP-NATIVE:
>
>   #~(modify-phases %standard-phases
>       (add-after 'unpack 'unpack-extra-sources
>         (lambda _
>           (copy-recursively #+(origin ...)
>                             "extra-source-directory"))))
>
> When the build script implementing the phases is... built, this lambda will look
> like this:
>
>   (lambda _
>     (copy-recursively "/gnu/store/...-extra-sources"
>                       "extra-source-directory"))
>
> Roughly, the UNGEXP-NATIVE compiles the origin directory for the host
> architecture, then substitutes itself for a string containing the output path of
> the compiled store item.
>
>     -- (

This is a short extract of my custom .scm file:

(define xenomai-version "3.1")
(define xenomai-origin
    (origin
      (method url-fetch)
      (uri (string-append
"https://xenomai.org/downloads/xenomai/stable/xenomai-"
xenomai-version
                          ".tar.bz2"))
      (sha256
        (base32
           "1064l80p9fdbp553mrbin4s7f5qhnwifhfds8a9wl6p6s10alsb4"))))
(define-public my-help
  (package
    (inherit hello)
    (name "my-help")
    (arguments
      #~(modify-phases %standard-phases
      (add-after 'unpack 'unpack-extra-sources
        (lambda _
          (copy-recursively #+xenomai-origin
                            "extra-source-directory")))))))

First of all, I'm not sure whether the gexp that you suggested is
placed correctly within the "arguments" field of the package.
Second, if I try to build the above my-help package I get an exception
with this backtrace:

pcp@PCP3600 ~/guix [env]$ ./pre-inst-env guix build --keep-failed my-help
Backtrace:
In ice-9/boot-9.scm:
  1747:15 19 (with-exception-handler #<procedure 7f52cb297de0 at ic?> ?)
  1752:10 18 (with-exception-handler _ _ #:unwind? _ # _)
In guix/ui.scm:
    449:6 17 (_)
In guix/scripts/build.scm:
    714:5 16 (_)
In srfi/srfi-1.scm:
   673:15 15 (append-map #<procedure 7f52cc86c000 at guix/scripts/b?> ?)
   586:17 14 (map1 ("x86_64-linux"))
In guix/scripts/build.scm:
   716:21 13 (_ _)
In guix/store.scm:
  1382:11 12 (map/accumulate-builds #<store-connection 256.99 7f52d?> ?)
   1300:8 11 (call-with-build-handler #<procedure 7f52cb297d80 at g?> ?)
In guix/scripts/build.scm:
   670:16 10 (_ #<package my-help@2.12.1 /home/pcp/guix/gnu/packages?>)
   659:24  9 (_ #<package my-help@2.12.1 /home/pcp/guix/gnu/package?> ?)
In guix/packages.scm:
  1317:17  8 (supported-package? #<package my-help@2.12.1 /home/pcp?> ?)
In guix/memoization.scm:
    101:0  7 (_ #<hash-table 7f52ccab3e00 0/31> #<package my-help@2?> ?)
In guix/packages.scm:
  1295:37  6 (_)
  1555:16  5 (package->bag _ _ _ #:graft? _)
  1652:22  4 (thunk)
In unknown file:
           3 (_ "my-help-2.12.1" #:system "x86_64-linux" #:source # # ?)
In ice-9/boot-9.scm:
  1685:16  2 (raise-exception _ #:continuable? _)
  1685:16  1 (raise-exception _ #:continuable? _)
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure apply: Apply to non-list: #<gexp (modify-phases
%standard-phases (add-after (quote unpack) (quote
unpack-extra-sources) (lambda _ (copy-recursively #<gexp-input native
#<origin "https://xenomai.org/downloads/xenomai/stable/xenomai-3.1.tar.bz2"
#<content-hash sha256:1064l80p9fdbp553mrbin4s7f5qhnwifhfds8a9wl6p6s10alsb4>
() 7f52ce4af960>:out> "extra-source-directory"))))
/home/pcp/guix/gnu/packages/dabbede.scm:31:6 7f52cc88c9c0>

Finally, if not too much out of scope, can you explain me why the #+
ungexp can accept an origin object instead of a package? I assumed
from the documentation that gexp where used only to reference among
derivation of packages.

Regards


  reply	other threads:[~2022-12-12 23:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-12 22:35 Creating a package using two sources/origins dabbede
2022-12-12 22:43 ` (
2022-12-12 23:58   ` dabbede [this message]
2022-12-13  6:17     ` (
2022-12-13 20:56       ` dabbede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAEwYQ4TB570UgOTygoGUMrsxuqc-d6txNreYAZZPSOnB9bJMUg@mail.gmail.com \
    --to=dabbede@gmail.com \
    --cc=help-guix@gnu.org \
    --cc=paren@disroot.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).