Discussion:
Building from a local source code checkout
(too old to reply)
Konrad Hinsen
2017-12-19 11:34:46 UTC
Permalink
Raw Message
Hi everyone,

For debugging package definitions, it would be really nice to be able to
build a package from a checkout of the original project source code,
rather than having to make a tarball for each modification of that
source code. Is this possible somehow? The manual suggests that a
package source could be something else than an origin object, such as a
local-file, but I cannot get even local-file to work.

Konrad
Ludovic Courtès
2017-12-19 17:15:13 UTC
Permalink
Raw Message
Hello,
Post by Konrad Hinsen
For debugging package definitions, it would be really nice to be able
to build a package from a checkout of the original project source
code, rather than having to make a tarball for each modification of
that source code. Is this possible somehow?
You should be able to use “guix build foo --with-source=./foo” (note
that the directory name must match the package name).

https://www.gnu.org/software/guix/manual/html_node/Package-Transformation-Options.html
Post by Konrad Hinsen
The manual suggests that a package source could be something else than
an origin object, such as a local-file, but I cannot get even
local-file to work.
It should work (you must import (guix gexp) to get ‘local-file’).

Can you share what errors you got?

HTH,
Ludo’.
Konrad Hinsen
2017-12-20 08:52:37 UTC
Permalink
Raw Message
Hi Ludo,
Post by Ludovic Courtès
Post by Konrad Hinsen
For debugging package definitions, it would be really nice to be able
to build a package from a checkout of the original project source
code, rather than having to make a tarball for each modification of
that source code. Is this possible somehow?
You should be able to use “guix build foo --with-source=./foo” (note
that the directory name must match the package name).
https://www.gnu.org/software/guix/manual/html_node/Package-Transformation-Options.html
The name matching condition is my problem with this approach, which is
why I was looking for a way to do specify a local source in the package
definition itself.

I am working in the Python universe where package names almost never
match the name of the checkout directory because of the python- prefix.
Moreover, I want to build both python- and python2- packages from my
checkout.
Post by Ludovic Courtès
Post by Konrad Hinsen
The manual suggests that a package source could be something else than
an origin object, such as a local-file, but I cannot get even
local-file to work.
It should work (you must import (guix gexp) to get ‘local-file’).
Can you share what errors you got?
None - once I import (guix gexp) ;-)

Thanks,
Konrad.
Konrad Hinsen
2017-12-20 10:19:00 UTC
Permalink
Raw Message
Post by Konrad Hinsen
The name matching condition is my problem with this approach, which is
why I was looking for a way to do specify a local source in the package
definition itself.
I just had the obvious idea of using symlinks to work around the name
Post by Konrad Hinsen
guix build python-activepapers
--with-source=~/Development/python-activepaper
guix build: error: lstat: No such file or directory:
"~/Development/python-activepapers"
Post by Konrad Hinsen
guix build python-activepapers
--with-source=~/Development/python-activepapers/
guix build: warning: transformation 'with-source' had no effect on
python-activepapers-0.2.2

Maybe it wants a version number in the source specification? One more
Post by Konrad Hinsen
guix build python-activepapers
--with-source=~/Development/python-activepapers-0.2.3/
guix build: error: lstat: No such file or directory:
"~/Development/python-activepapers-0.2.3/"

Is there a good reason for symlinks not working, or is it just "to be
done"? In the latter case, I'd be happy to work on that.

Konrad.
Carlo Zancanaro
2017-12-20 12:41:10 UTC
Permalink
Raw Message
Post by Konrad Hinsen
Post by Konrad Hinsen
guix build python-activepapers
--with-source=~/Development/python-activepaper
"~/Development/python-activepapers"
I found earlier today that the tilde wasn't expanded in guix package --manifest. Maybe it's the same for --with-source. Try putting your home directory in as an absolute path.
Konrad Hinsen
2017-12-21 06:38:53 UTC
Permalink
Raw Message
Hi Carlo,
Post by Carlo Zancanaro
Post by Konrad Hinsen
Post by Konrad Hinsen
guix build python-activepapers
--with-source=~/Development/python-activepaper
"~/Development/python-activepapers"
I found earlier today that the tilde wasn't expanded in guix package
--manifest. Maybe it's the same for --with-source. Try putting your
home directory in as an absolute path.
Oops, you are right! So

guix build python-activepapers --with-source=$HOME/Development/python-activepapers/

actually works, but

guix build python-activepapers --with-source=$HOME/Development/python-activepapers

(without the terminating slash) doesn't:

guix build: error: guix/scripts/build.scm:155:6: package
`python-activepapers-0.2.2' has an invalid input: ("source"
"/gnu/store/bbi86dn5nq6f79lhvs7ghzisjahjaq5p-python-activepapers")

Perhaps I should stop trying to understand computers ;-)

Thanks,
Konrad.
Pjotr Prins
2017-12-21 10:38:13 UTC
Permalink
Raw Message
Post by Konrad Hinsen
Perhaps I should stop trying to understand computers ;-)
We are waiting for AI to start programming ;)

Pj.
--
Martin Castillo
2017-12-21 11:20:43 UTC
Permalink
Raw Message
Hi,
Post by Konrad Hinsen
Oops, you are right! So
guix build python-activepapers --with-source=$HOME/Development/python-activepapers/
actually works, but
guix build python-activepapers --with-source=$HOME/Development/python-activepapers
As one error message earlier in the thread stated, guix uses lstat to
get info about the stated file. lstat doesn't follow symlinks. You force
the dereference by appending the slash.

Martin
--
GPG: 7FDE 7190 2F73 2C50 236E 403D CC13 48F1 E644 08EC
Ludovic Courtès
2017-12-21 14:38:46 UTC
Permalink
Raw Message
Hi,
Post by Martin Castillo
Post by Konrad Hinsen
Oops, you are right! So
guix build python-activepapers --with-source=$HOME/Development/python-activepapers/
actually works, but
guix build python-activepapers --with-source=$HOME/Development/python-activepapers
As one error message earlier in the thread stated, guix uses lstat to
get info about the stated file. lstat doesn't follow symlinks. You force
the dereference by appending the slash.
Indeed.

I agree the matching-name constraint can be annoying. The alternative
would be allow the user to (optionally?) specify the name of the package
whose source is being changed, as in:

guix build python-activepapers \
--with-source=python-activepapers=$HOME/Dev/AP

WDYT?

A bit heavyweight syntactically but maybe we have to live with it.

Ludo’.
Martin Castillo
2017-12-21 16:53:30 UTC
Permalink
Raw Message
Post by Ludovic Courtès
I agree the matching-name constraint can be annoying. The alternative
would be allow the user to (optionally?) specify the name of the package
guix build python-activepapers \
--with-source=python-activepapers=$HOME/Dev/AP
WDYT?
A bit heavyweight syntactically but maybe we have to live with it.
Ludo’.
Why can't guix use the argument package name argument?
v-- this one
guix build python-activepapers --with-source=$HOME/Dev/AP

Martin
--
GPG: 7FDE 7190 2F73 2C50 236E 403D CC13 48F1 E644 08EC
Ludovic Courtès
2017-12-22 09:29:46 UTC
Permalink
Raw Message
Post by Martin Castillo
Why can't guix use the argument package name argument?
v-- this one
guix build python-activepapers --with-source=$HOME/Dev/AP
Because there can be several packages passes as arguments to ‘guix
build’.

Now it would make sense to DTRT when there’s just one package on the
command line.

Ludo’.
Konrad Hinsen
2017-12-21 17:02:29 UTC
Permalink
Raw Message
Post by Ludovic Courtès
I agree the matching-name constraint can be annoying. The alternative
would be allow the user to (optionally?) specify the name of the package
guix build python-activepapers \
--with-source=python-activepapers=$HOME/Dev/AP
WDYT?
Looks much clearer to me. But, as you say, this could well be optional
if we can live with an ambiguity in the rare case of filenames containg
an equal sign.

Konrad.
Ludovic Courtès
2017-12-22 23:07:25 UTC
Permalink
Raw Message
Post by Konrad Hinsen
Post by Ludovic Courtès
I agree the matching-name constraint can be annoying. The alternative
would be allow the user to (optionally?) specify the name of the package
guix build python-activepapers \
--with-source=python-activepapers=$HOME/Dev/AP
WDYT?
Looks much clearer to me. But, as you say, this could well be optional
if we can live with an ambiguity in the rare case of filenames containg
an equal sign.
I’ve implemented it here:

https://git.savannah.gnu.org/cgit/guix.git/commit/?id=3e30cdf1c35ebeb52630ec19b3b43b9e6d5ffb81

You no longer need to rename your source directory. :-)

Ludo’.

Loading...