Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Guix support #115

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

civodul
Copy link
Collaborator

@civodul civodul commented Nov 17, 2024

These patches improves Guix support to make it easier to test a variety of configurations.

With the last patch, runnin:

guix build -L .guix/modules -m .guix/manifest.scm

... will perform several native builds (x86_64-linux, i686-linux, Guile 3.0 and 2.2, with and without libevent) and cross-compilation builds (currently failing; see #111).

With this change, ‘make check’ runs in 230s on x86_64-linux-gnu (4-core
CPU) instead of 880s.

* tests/speedup.scm <top level>: Exit with 77 when
‘FIBERS_EXPENSIVE_TESTS’ is unset.
With this change, tests run in 46s instead of 230s on my x86_64 laptop
when using ‘guix build -f guix.scm’.

* build-aux/guile.am (.scm.go): Set GUILE_AUTO_COMPILE=0.
* env.in: Set ‘XDG_CACHE_HOME’ when it’s undefined.
* guix.scm (guile-fibers)[arguments]: Remove.
This follows the guidelines in
<https://guix.gnu.org/cookbook/en/html_node/Software-Development.html>.

* .guix/modules/fibers-package.scm: New file, based on…
* guix.scm: … this.  Turn into a symlink to the above.
* Makefile.am (EXTRA_DIST): Add both files.
This is clearer and less ambiguous: if the person has additional
channels providing same-named packages, it will still refer to the
canonical packages under (gnu packages …).

* .guix/modules/fibers-package.scm (S): Remove.
(guile-fibers)[native-inputs, inputs]: Directly refer to the right (gnu
packages …) variables.
[synopsis]: Remove outdated sentence.
* .guix/modules/fibers-package.scm (guile2.2-fibers)
(guile-fibers/libevent): New variables.
* .guix/modules/fibers-package.scm (guile-fibers)[native-inputs]: Add
Guile.
* .guix/manifest.scm: New file.
* Makefile.am (EXTRA_DIST): Add it.
# interpreted) so make sure they can be auto-compiled upon 'make
# check'.
if test "$XDG_CACHE_HOME" = ""; then
XDG_CACHE_HOME="${TMPDIR:-/tmp}/guile-fibers-cache"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is terrible w.r.t. security.
If they are meant to be compiled, just compile them (with .scm->.go rules), or put them in a subdirectory of the build directory.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, if you put them in a subdirectory of the build directory, you might as well do this unconditionally.

'("i586-pc-gnu"
"aarch64-linux-gnu"))))

(concatenate-manifests (list native-builds cross-builds))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, there probably exists a target-linux? predicate.

You could also unify 'native-builds' with cross-builds':

(map (lambda (system target) [package->manifest stuff]) '(("system1" . "target1") ...))

This is also rather i*86/x86_64 centric.

Also, I think this should be changed into a list of packages instead of a manifest, because the file collisions would make the manifest itself meaningless, whereas the individual builds would be meaningful.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's very x86-centric, but it's already an improvement over the GitHub action that does x86_64-only. (And for now it's only meant for use by contributors on their machines, which, let's face it, is x86_64.)

I think using manifests is more convenient and generally necessary since there's more info than mere packages can carry.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IME, it's also nice that you can change the last line when testing things locally, for instance to cross-builds if that's all you want to test.

@@ -53,6 +53,12 @@
(lp (1+ i) (make-vector (- words 2) #f))
x)))

(unless (getenv "FIBERS_EXPENSIVE_TESTS")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#104 is relevant.

I consider this name misleading. Proposal: "FIBERS_SKIP_BENCHMARKS".

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, tests/speedup.scm is not a test per se, it's a benchmark, but I didn't mean to revisit that classification here. I chose a variable that's similar to what other projects do, such as Coreutils (it's called RUN_EXPENSIVE_TESTS there; maybe we can just stick to that name?).

Also, my goal was to skip tests/speedup.scm by default.

Copy link
Collaborator

@emixa-d emixa-d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The security thing is particularly important.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants