unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* A Few Packaging Questions
@ 2022-08-05  2:50 Christopher Rodriguez
  2022-08-05 16:35 ` Csepp
  2022-08-07 21:02 ` Ludovic Courtès
  0 siblings, 2 replies; 3+ messages in thread
From: Christopher Rodriguez @ 2022-08-05  2:50 UTC (permalink / raw)
  To: guix-devel

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

Hello All,

1. Is there a way to call non-exported procedures from a module in
Guile?

I am looking to solve the non-determinism in one of the above-submitted
packages (dbqn), and per https://github.com/dzaima/BQN/issues/14 it
seems the issue is timestamps in jarfiles, which ant-build-system
handles in its strip-jar-timestamps procedure. I'd like to call that
procedure from that module rather than copy it into the bqn.scm module,
but I can't build the package with ant, so I'm looking for a way to call
it without switching systems.

2. Is there a list of variables accessible using gexps somewhere, or
some source code I might be able to glean the same information from?

I have just discovered #$output as a somewhat useful tool, and I'm
currently looking to learn more ahead of when I might need them.

3. What is the canonical way in the new input system to reference a
specific output of a package?

I first learned `("label" ,package "output"), and I've seen `(,package
"output") in the devel version of the manual, but when I recently did a
guix lint on some package definitions that used `(,openjdk "jdk") I got
a warning:

label 'openjdk' does not match package name 'openjdk:jdk'

I want to make sure I am doing things the "most correct" way, so I
figured I'd ask here.

Thank You for taking the time to read my questions, and I hope You have
a great day!

--

Christopher Rodriguez

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

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

* Re: A Few Packaging Questions
  2022-08-05  2:50 A Few Packaging Questions Christopher Rodriguez
@ 2022-08-05 16:35 ` Csepp
  2022-08-07 21:02 ` Ludovic Courtès
  1 sibling, 0 replies; 3+ messages in thread
From: Csepp @ 2022-08-05 16:35 UTC (permalink / raw)
  To: Christopher Rodriguez; +Cc: guix-devel

Hi!

Christopher Rodriguez <cdr255@gmail.com> writes:

> [[PGP Signed Part:Undecided]]
> Hello All,
>
> 1. Is there a way to call non-exported procedures from a module in
> Guile?

There is one but you should not use it.  Instead you should send a patch
that adds an export to the previously private declaration.
And the way is to use the @@ function, but code that relies on it is
AFAIK not acceptable in Guix.

> 2. Is there a list of variables accessible using gexps somewhere, or
> some source code I might be able to glean the same information from?
>
> I have just discovered #$output as a somewhat useful tool, and I'm
> currently looking to learn more ahead of when I might need them.

The info pages should have more, well, info.  Easiest way to find them
IMHO is through Emacs.  There is also an HTML mirror:

https://guix.gnu.org/en/manual/devel/en/html_node/G_002dExpressions.html#G_002dExpressions

> 3. What is the canonical way in the new input system to reference a
> specific output of a package?

According to the URL above, it's #$output[:output].

I hope that helped.  Happy packaging. UwU


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

* Re: A Few Packaging Questions
  2022-08-05  2:50 A Few Packaging Questions Christopher Rodriguez
  2022-08-05 16:35 ` Csepp
@ 2022-08-07 21:02 ` Ludovic Courtès
  1 sibling, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2022-08-07 21:02 UTC (permalink / raw)
  To: Christopher Rodriguez; +Cc: guix-devel

Hi Christopher,

Christopher Rodriguez <cdr255@gmail.com> skribis:

> Hello All,
>
> 1. Is there a way to call non-exported procedures from a module in
> Guile?

In general this is not recommended (if it’s private, it’s for a reason;
plus the compiler might choose to inline the procedure at its call
site(s), in which case it doesn’t exist as such at run time), but if you
really have to, you can use @@ to get at a procedure, as in:

  (@@ (guix build ant-build-system) strip-jar-timestamps)

> 2. Is there a list of variables accessible using gexps somewhere, or
> some source code I might be able to glean the same information from?
>
> I have just discovered #$output as a somewhat useful tool, and I'm
> currently looking to learn more ahead of when I might need them.

#$output is an exception, a trick to refer to the output of the
derivation in which the gexp appears.

Other than that, you can think of #$ as ‘unquote’ in regular
Lisp/Scheme.

> 3. What is the canonical way in the new input system to reference a
> specific output of a package?

You’d write a list, like: (list guile-3.0 guile-json).

Check out
<https://guix.gnu.org/manual/devel/en/html_node/Defining-Packages.html>
and related parts of the manual, and see
<https://guix.gnu.org/en/blog/2021/the-big-change/> for a longer
discussion.

> label 'openjdk' does not match package name 'openjdk:jdk'

You can ignore that; we should fix that ‘guix lint’ warning: it was
helpful with “old-style” inputs, but it wrongfully flags new-style
inputs, as in the example you give.

HTH!

Ludo’.


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

end of thread, other threads:[~2022-08-07 21:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-05  2:50 A Few Packaging Questions Christopher Rodriguez
2022-08-05 16:35 ` Csepp
2022-08-07 21:02 ` Ludovic Courtès

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