unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Zelphir Kaltstahl <zelphirkaltstahl@posteo.de>
To: help-guix <help-guix@gnu.org>
Subject: Setting up guix source tree for testing a package
Date: Fri, 12 Mar 2021 00:31:36 +0100	[thread overview]
Message-ID: <7698a9df-6fe6-9581-a513-456f8058ad3b@posteo.de> (raw)

Hello Guix Users,

I am trying to set up GNU Guix for package testing, as I want to test a package
before sending in a patch to add it to GNU Guix.

I'll describe the steps I am taking and where I am seeing them in the docs in
the following.

All is happening inside a VM, which runs a Debian 10. The VM is almost fresh,
except for guest additions and git and vim and such things.


I start at https://guix.gnu.org/manual/en/html_node/Packaging-Guidelines.html
<https://guix.gnu.org/manual/en/html_node/Packaging-Guidelines.html>, wherein I
find a link to https://guix.gnu.org/manual/en/html_node/Defining-Packages.html
<https://guix.gnu.org/manual/en/html_node/Defining-Packages.html>.

Next the packaging guidelines tell me, that I may run for example:

~~~~
./pre-inst-env guix build gnew --keep-failed
~~~~

inside the Guix build tree.

I clone Guix, so that I have a source tree of Guix.

I define my package inside `guix/gnu/packages/guile.scm`.

In packaging guidelines, there is a link to
https://guix.gnu.org/manual/en/html_node/Running-Guix-Before-It-Is-Installed.html
<https://guix.gnu.org/manual/en/html_node/Running-Guix-Before-It-Is-Installed.html>.
I am supposed to run the test inside a fresh Guix, to make sure, that the
package will work fine for others, if I understand correctly.

On
https://guix.gnu.org/manual/en/html_node/Running-Guix-Before-It-Is-Installed.html
<https://guix.gnu.org/manual/en/html_node/Running-Guix-Before-It-Is-Installed.html>
I am told, that I need to generate a pre-installation script to run guix without
installing it (running stuff in the Guix build tree, as far as I understand). To
generate it, I need Guix again. The docs direct me to
https://guix.gnu.org/manual/en/html_node/Building-from-Git.html
<https://guix.gnu.org/manual/en/html_node/Building-from-Git.html>.

On https://guix.gnu.org/manual/en/html_node/Building-from-Git.html
<https://guix.gnu.org/manual/en/html_node/Building-from-Git.html> the dilemma is
finally uncovered, that I need Guix to build the pre-installation script, to use
that, to build a package in the Guix source tree.

> As you can see, there is a chicken-and-egg problem: you first need to have
Guix installed. Typically you would install Guix System (see System
Installation) or Guix on top of another distro (see Binary Installation); in
either case, you would verify the OpenPGP signature on the installation medium.
This “bootstraps” the trust chain.

I install it.

Then I run:

~~~~
guix environment guix --pure
~~~~

The docs tell me I have to run:

~~~~
./bootstrap
./configure --localstatedir=some_directory
~~~~

But here I am facing a problem. I have no clue what to set the
`--localstatedir=directory` to. The docs tell me it is important, but I see no
instructions on how to choose a directory for the local state, when I have
already a Guix installed (binary installation on foreign distro). The linked
docs about the https://guix.gnu.org/manual/en/html_node/The-Store.html
<https://guix.gnu.org/manual/en/html_node/The-Store.html> do not help me
choosing it either, because that page is about the store itself, not about my
specific scenario of doing things from Guix source tree. Since I intend to build
a package inside the Guix source tree, I think it should exactly _not_ be /var,
as that would conflict with the Guix installation, that I had to do to create
the pre-inst-env script.

What is the idea for the local state directory? Is it the location of a
temporary store, which will contain anything, that I produce using the
pre-inst-env script? That is what I am guessing. In that case I think
`localstoredir` might be a good alias for `localstatedir`.

I am trying with an empty directory, which I create just for that purpose, on
the same level as the cloned Guix repository:

~~~~
$ tree -L 2
.
├── guix
│   ├── ABOUT-NLS
│   ├── aclocal.m4
│   ├── AUTHORS
│   ├── autom4te.cache
│   ├── bootstrap
│   ├── build-aux
│   ├── ChangeLog
│   ├── CODE-OF-CONDUCT
│   ├── config-daemon.ac
│   ├── config.log
│   ├── config.status
│   ├── configure
│   ├── configure.ac
│   ├── COPYING
│   ├── doc
│   ├── etc
│   ├── gnu
│   ├── gnu.scm
│   ├── guix
│   ├── guix.scm
│   ├── HACKING
│   ├── INSTALL
│   ├── m4
│   ├── Makefile
│   ├── Makefile.am
│   ├── Makefile.in
│   ├── NEWS
│   ├── nix
│   ├── po
│   ├── pre-inst-env
│   ├── README
│   ├── ROADMAP
│   ├── scripts
│   ├── test-env
│   ├── tests
│   ├── THANKS
│   └── TODO
└── guix-store
~~~~

So I run:

~~~~
./configure --localstatedir=/home/user/dev/guix-store
~~~~

Next is running:

~~~~
make check
~~~~

Some warnings appear:

~~~~
Your input po file po/doc/guix-manual.de.po seems outdated (The amount of entries differ between files: 10012 is not 334
). Please consider running po4a-updatepo to refresh it.
~~~~

But I am guessing, that these can be ignored for my purposes, as I am not doing
anything with translations or po files.

However, there are other errors, like not finding code for some modules (the
output of make check is very long and probably I should rather put the log
somewhere and link to it). The check seems to fail ultimately with the following
result:

~~~~
make[4]: *** [Makefile:5563: tests/store.log] Error 1
make[4]: Leaving directory '/home/user/dev/guix'
make[3]: *** [Makefile:5545: check-TESTS] Error 2
make[3]: Leaving directory '/home/user/dev/guix'
make[2]: *** [Makefile:5794: check-am] Error 2
make[2]: Leaving directory '/home/user/dev/guix'
make[1]: *** [Makefile:5322: check-recursive] Error 1
make[1]: Leaving directory '/home/user/dev/guix'
make: *** [Makefile:5796: check] Error 2
~~~~

The only red colored fail I can see is above from that, first line of the following:

~~~~
FAIL: tests/go.scm
PASS: tests/grafts.scm
PASS: tests/graph.scm
PASS: tests/gremlin.scm
SKIP: tests/hackage.scm
PASS: tests/import-utils.scm
PASS: tests/inferior.scm
PASS: tests/lint.scm
PASS: tests/modules.scm
PASS: tests/monads.scm
PASS: tests/nar.scm
PASS: tests/networking.scm
PASS: tests/opam.scm
PASS: tests/openpgp.scm
PASS: tests/packages.scm
SKIP: tests/pack.scm
PASS: tests/pki.scm
PASS: tests/print.scm
PASS: tests/processes.scm
PASS: tests/profiles.scm
SKIP: tests/publish.scm
SKIP: tests/pypi.scm
PASS: tests/records.scm
PASS: tests/scripts.scm
PASS: tests/search-paths.scm
PASS: tests/services.scm
PASS: tests/services/file-sharing.scm
PASS: tests/services/linux.scm
PASS: tests/sets.scm
PASS: tests/size.scm
SKIP: tests/snix.scm
PASS: tests/status.scm
PASS: tests/store-database.scm
PASS: tests/store-deduplication.scm
PASS: tests/store-roots.scm
make[4]: *** [Makefile:5563: tests/store.log] Error 1
make[4]: Leaving directory '/home/user/dev/guix'
make[3]: *** [Makefile:5545: check-TESTS] Error 2
make[3]: Leaving directory '/home/user/dev/guix'
make[2]: *** [Makefile:5794: check-am] Error 2
make[2]: Leaving directory '/home/user/dev/guix'
make[1]: *** [Makefile:5322: check-recursive] Error 1
make[1]: Leaving directory '/home/user/dev/guix'
make: *** [Makefile:5796: check] Error 2
~~~~

I am not sure, whether this means, that I have an erroneous Guix or whether the
localstatedir was wrong or what else it means. However, I continue.

The docs on https://guix.gnu.org/manual/en/html_node/Building-from-Git.html
<https://guix.gnu.org/manual/en/html_node/Building-from-Git.html> continue:

> From there on, you can authenticate all the commits included in your checkout
by running: make authenticate

It is not clear to me, whether that means, that I need to run it in my scenario
or whether I should not run it.

A look into the Makefile shows, that it is actually calling a guix command `guix
git authenticate`. The description is "verify commit signatures and
authorizations". "verify" or "verify-signatures" seems a more appropriate name,
because it indicates checking signatures, instead of authenticating commits.
However, this might be my lacking understanding of what `make authenticate` does
or aims to do.

When I try running:

~~~~
make authenticate
~~~~

I get an error:

~~~~
$ make authenticate 
Authenticating Git checkout...
/bin/bash: line 1: guix: command not found
make: *** [Makefile:6290: authenticate] Error 127
~~~~

I am confused as to why it does not find guix. I am inside the environment
created by `guix environment guix --pure`.

I continue nevertheless and try to run:

~~~~
./pre-inst-env guix build guile-fslib
~~~~

However, my whole setup now seems wo be messed up. The `guix` command can simply
no longer be found:

~~~~
$ pwd
/home/user/dev
$ guix environment guix --pure
$ pushd guix
~/dev/guix ~/dev
$ ./pre-inst-env guix build guile-fslib
guix build: error: failed to connect to `/home/user/dev/guix-store/guix/daemon-socket/socket': No such file or directory
~~~~

A logout and login does not change the error.

Where did I go wrong?

Regards,
Zelphir

-- 
repositories: https://notabug.org/ZelphirKaltstahl


             reply	other threads:[~2021-03-11 23:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 23:31 Zelphir Kaltstahl [this message]
2021-03-12  1:01 ` Setting up guix source tree for testing a package Fredrik Salomonsson
2021-03-17 20:46   ` Zelphir Kaltstahl
2021-03-18  0:22     ` Fredrik Salomonsson
2021-03-12 19:59 ` Joshua Branson
2021-03-17 20:49   ` Zelphir Kaltstahl
2021-03-12 21:52 ` Leo Famulari

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=7698a9df-6fe6-9581-a513-456f8058ad3b@posteo.de \
    --to=zelphirkaltstahl@posteo.de \
    --cc=help-guix@gnu.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).