guix environment: add option to download and unpack source

  • Open
  • quality assurance status badge
Details
4 participants
  • Björn Höfling
  • Danny Milosavljevic
  • Jan Nieuwenhuizen
  • Vagrant Cascadian
Owner
unassigned
Submitted by
Vagrant Cascadian
Severity
normal
V
V
Vagrant Cascadian wrote on 24 Jun 2018 21:06
(address . bug-guix@gnu.org)
87tvpsngwm.fsf@aikidev.net
I've a minor feature request.

When working on new package definitions, it's often useful to debug
build failures with guix environment.

The current implementation, as I understand it, requires manually
downloading the source, and merely drops you into whatever working
directory you happen to be it.

It would be great if there were an option you could pass that downloads
and unpacks the source somewhere and drops you into the newly unpacked
source directory.

Not sure what to call it exactly, but something like:

guix environment --with-source hello

Should drop you into an unpacked source directory with the inputs and
such for building "hello".


live well,
vagrant
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEcDardHbDotegGFCHt4uC1IFLkbYFAlsv66kACgkQt4uC1IFL
kbaMbg/+O9qlPN1LckmSM7GLMUVmA4hDF74xVcLFonrrQukTgutZZ8Ti28XnT5Yq
Vf0ss6w8ic3N4Zpg7kXnGpnT+rM3KEaGjfuj67n7gqsrkQiYiDDhRZI4Gey8S5/L
jPNd4wBr6GRe6zUpauhMI6ineC4yyiK3e20UrtC7Mh7Ko2XmIfBhIhml60DzP5Qc
0T4D0m/CMO1um2CLMeEGb3M6iHDffY5xYeR1Lt/4siRf5pc4DxolP4Igkfj5T5po
BqzT1WM5KaG7iJ+xHLSXyJZfyFrdleayoxE5ejzfut0/xOfjpT+9mTujFIcQYIcW
KUEl46wqpCj/mO/TVtQB3GUFNrFQNoUR3NhnP/ilXaiAr6/5EzSYyGtIvL+wuMWM
Wmppqe0OvxEEy1vAotQC3B/HyFSe7gp/qFgO22JqoOcbhdLk24uiRB0XtFtkfroM
7Rfw4TXL6cgC3Z9zE5UYCq7I2Sp8ZJ9jb1/ANL5+95B0tQ+/2nIEUDmPiNlCeE0r
Agmd5VmomfI278og5p4Q9QUdzpK7nZvxBi4i83MyHTjjD7ZcX1g9k+dy3u1PaoWz
e4SPcbf/QWK2xQqdMNy3cjIoCHF4NVRMqL2TKGteCp5TiaPpE7zMt8pKXXfnpgfE
Yui/AVg2nqZ+4GtD1vne/JF+OQ3vccd2WUdgJAf06nI+4IPFPeg=
=1GdW
-----END PGP SIGNATURE-----

B
B
Björn Höfling wrote on 24 Jun 2018 21:20
(name . Vagrant Cascadian)(address . vagrant@debian.org)(address . 31956@debbugs.gnu.org)
20180624212013.6afadf07@alma-ubu
On Sun, 24 Jun 2018 12:06:17 -0700
Vagrant Cascadian <vagrant@debian.org> wrote:

Toggle quote (20 lines)
> I've a minor feature request.
>
> When working on new package definitions, it's often useful to debug
> build failures with guix environment.
>
> The current implementation, as I understand it, requires manually
> downloading the source, and merely drops you into whatever working
> directory you happen to be it.
>
> It would be great if there were an option you could pass that
> downloads and unpacks the source somewhere and drops you into the
> newly unpacked source directory.
>
> Not sure what to call it exactly, but something like:
>
> guix environment --with-source hello
>
> Should drop you into an unpacked source directory with the inputs and
> such for building "hello".

Hi Vagrant,

if you need this in the case of build failures, use the "-K" option:


--keep-failed
-K

Keep the build tree of failed builds. Thus, if a build fails, its
build tree is kept under /tmp, in a directory whose name is shown at
the end of the build log. This is useful when debugging build issues.
See Debugging Build Failures, for tips and tricks on how to debug build
issues.


See also


For the case that the built went through OK, there is no such option.
You could raise an exception at the end of your package
definition/build phases.

Also there is the -S option to build:

guix build -S <package-name>

builds the source of your package. This will download the package,
verifies the checkum applies patches and applies snippets (i.e. rules
to remove for example binaries or other non-free-licensed parts).

Björn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlsv7u0ACgkQvyhstlk+X/3Q7gCfXY0gNl9dA5rwaBdp3GxugXEC
xSsAn2iFUIz5TUd6UpcxYO9wZg/K5Zxu
=NE91
-----END PGP SIGNATURE-----


D
D
Danny Milosavljevic wrote on 24 Jun 2018 21:27
(name . Vagrant Cascadian)(address . vagrant@debian.org)(address . 31956@debbugs.gnu.org)
20180624212727.0adf311c@scratchpost.org
Hi Vagrant,

On Sun, 24 Jun 2018 12:06:17 -0700
Vagrant Cascadian <vagrant@debian.org> wrote:

Toggle quote (8 lines)
> It would be great if there were an option you could pass that downloads
> and unpacks the source somewhere and drops you into the newly unpacked
> source directory.
>
> Not sure what to call it exactly, but something like:
>
> guix environment --with-source hello

+1

Right now, my silly workaround is to add a phase which fails

(add-after 'unpack 'fail
(lambda _
(error "stop it")))

and then do

guix build --keep-failed hello

and then do

guix environment --pure hello
cd /tmp/guix-build-hello*

That's... very manual.

Also, if the directory in /tmp is not .drv-0, the environment is technically not the same as it was inside the guix-daemon build container.

In that case there'd be an extra step

rm -rf /tmp/guix-build-hello-*.drv-0
ln -s /tmp/guix-build-hello-* /tmp/guix-build-hello-<...>.drv-0
cd /tmp/guix-build-hello-<...>.drv-0

All in all that's not simple.

Also, guix-daemon is taken from Nix and thus not exactly the same as
guix environment in some cases.

That's why in some cases I have to (edit the package definition and
invoke guix build) over and over again in order to find a problem.

In the long term we'll replace guix-daemon by guix environment.
Much easier to reproduce situations then.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlsv8J8ACgkQ5xo1VCww
uqU+awf/bRY+CFdyWKV+qmSY0CmaPPdv/0q1ninj0LYvMH/XAAfxHz/BhT3Irr3t
xToaA31CHGkPg/dQz2jRsXPuYwVg3bythaikpCxW0XhrEYtcZ3Qjnw8mgKoHxqeg
AV/jJKu2adL0IshTNO7xQoqkZeacfTu12iWbLI9HZk8IFPiQw2XGlY2euP5EGqXl
qtSZLTGXi0XqoEkwnipyeHNE+WdlZj1vVw1UsimPBKvx+SXCSN0gQEPj6R/q6Y62
SeFZrNLtuV9qZMxM2mo590GPyCQDolp+aRk8ylZc9QgBHfXt3TlfGbNRiOKd6vnH
DkcoaAGcZ6AdzblhU2Wi3Q+Z0YNyXg==
=/0DY
-----END PGP SIGNATURE-----


J
J
Jan Nieuwenhuizen wrote on 24 Jun 2018 22:50
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
87d0wf3o40.fsf@gnu.org
Danny Milosavljevic writes:

Toggle quote (23 lines)
>> Not sure what to call it exactly, but something like:
>>
>> guix environment --with-source hello
>
> +1
>
> Right now, my silly workaround is to add a phase which fails
>
> (add-after 'unpack 'fail
> (lambda _
> (error "stop it")))
>
> and then do
>
> guix build --keep-failed hello
>
> and then do
>
> guix environment --pure hello
> cd /tmp/guix-build-hello*
>
> That's... very manual.

A very nice recipe...interesting we had a discussion about this today on
#guix. What I would really like, is for the --with-source directory
be a git archive, so that edits can be made and tested until it works.

Attempt a rebuild with new patches/new git commit and repeat.

Making repeated patches until a build succeeds is something I find
pretty cumbersome.

It could be an ad-hoc, new git archive. It would also be nice if Guix
could somehow record upstream sources as (shallow?, tarred?) git
archives.

janneke

--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com| Avatar® http://AvatarAcademy.com
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 31956@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 31956
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch