all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel <guix-devel@gnu.org>, 45919@debbugs.gnu.org
Subject: Re: [bug#45919] [PATCH 0/8] Exporting a manifest and channels from a profile
Date: Wed, 27 Jan 2021 22:02:53 +0100	[thread overview]
Message-ID: <86bldahz42.fsf@gmail.com> (raw)
In-Reply-To: <87wnvyv7w6.fsf@gnu.org> ("Ludovic Courtès"'s message of "Wed, 27 Jan 2021 14:14:49 +0100")

Hi Ludo,

On Wed, 27 Jan 2021 at 14:14, Ludovic Courtès <ludo@gnu.org> wrote:
> Ludovic Courtès <ludo@gnu.org> skribis:
>
>> Here’s a simple but oft-requested feature (I remember discussing
>> with Pierre and Simon a year ago at the Guix Days about ways to
>> implement it—time flies!): these patches provide ‘guix package
>> --export-manifest’ and ‘--export-channels’.  These options spit
>> a manifest and a channel spec, respectively, with the goal of
>> helping users who wish to migrate to the declarative model.
>
> I’m rather happy with this patch set but since this is something we’ve
> discussed several times in the past, I think it’d be great if those
> interested could chime in and comment:
>
>   https://issues.guix.gnu.org/45919
>
> I’ll leave a few more days and then… push!

You are looking at me? :-)

Well, the feature is nice!  At first, I thought that it could be a bit
smarter than using only one commit.  But as you said, the aim is for
transitioning.  Maybe a future improvement should to list somewhere in
the comments which commit provides which set of packages.  It could
help… or not. :-)

Using Docker, it works.  Let describe how in case people are interested.


On machine A, I have:

--8<---------------cut here---------------start------------->8---
$ guix describe -f channels
(list (channel
        (name 'guix)
        (url "https://git.savannah.gnu.org/git/guix.git")
        (commit
          "cb68ae668af2ade4b0777d82f227e5462768e9e5")
        (introduction
          (make-channel-introduction
            "9edb3f66fd807b096b48283debdcddccfea34bad"
            (openpgp-fingerprint
              "BBB0 2DDF 2CEA F6A8 0D1D  E643 A2A0 6DF2 A33A 54FA")))))

$ cat ~/.config/guix/manifests/python.scm
(specifications->manifest
 (append
  '("python"
    )
  (map
   (lambda (pkg)
     (string-append "python-" pkg))
   '("ipython"
     "numpy"
     "matplotlib"
     "scipy"
     "biopython"
  ))))
--8<---------------cut here---------------end--------------->8---

And I generate a Docker pack with:

--8<---------------cut here---------------start------------->8---
$ guix pack -f docker --save-provenance -m ~/.config/guix/manifests/python.scm
/gnu/store/wxymmnxdvdvf08ifsfy39xjaxilhrigk-docker-pack.tar.gz
--8<---------------cut here---------------end--------------->8---


Then on machine B, after fetching this tarball, I run:

--8<---------------cut here---------------start------------->8---
$ docker load < /tmp/img/wxymmnxdvdvf08ifsfy39xjaxilhrigk-docker-pack.tar.gz
$ docker images
REPOSITORY                           TAG                 IMAGE ID            CREATED             SIZE
python-python-ipython-python-numpy   latest              49ddfedf1e27        51 years ago        1.45GB
--8<---------------cut here---------------end--------------->8---

And it works as expected:

--8<---------------cut here---------------start------------->8---
$ docker run -ti python-python-ipython-python-numpy:latest python3
Python 3.8.2 (default, Jan  1 1970, 00:00:01)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import this
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
>>> import numpy as np
>>> A = np.array([[1,0,1],[0,1,0],[0,0,1]])
>>> _, s, _ = np.linalg.svd(A); s; abs(s[0] - 1./s[2])
array([1.61803399, 1.        , 0.61803399])
0.0
>>>
--8<---------------cut here---------------end--------------->8---

Neat!

So far, so good.  Well, let extract the ’manifest’ from this Docker
blob.

--8<---------------cut here---------------start------------->8---
$ docker export -o /tmp/img/re-pack.tar $(docker ps -a --format "{{.ID}}" | head -n1)
$ tar -xf /tmp/img/re-pack.tar $(tar -tf /tmp/img/re-pack.tar | grep 'profile/manifest')
$ cat gnu/store/7frdchgf5sqw8b83azsml3lw0h52gfbk-profile/manifest | grep -E "(\(\"python|cb68ae)" | head -n5
    (("python"
              "cb68ae668af2ade4b0777d82f227e5462768e9e5")
     ("python-ipython"
        (("python-backcall"
         ("python-pyzmq"
--8<---------------cut here---------------end--------------->8---

Now, a trick to get the channels and specifications:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix package -p /tmp/img/gnu/store/7frdchgf5sqw8b83azsml3lw0h52gfbk-profile --export-channels
;; This channel file can be passed to 'guix pull -C' or to
;; 'guix time-machine -C' to obtain the Guix revision that was
;; used to populate this profile.

(list
     (channel
       (name 'guix)
       (url "https://git.savannah.gnu.org/git/guix.git")
       (commit
         "cb68ae668af2ade4b0777d82f227e5462768e9e5")
       (introduction
         (make-channel-introduction
           "9edb3f66fd807b096b48283debdcddccfea34bad"
           (openpgp-fingerprint
             "BBB0 2DDF 2CEA F6A8 0D1D  E643 A2A0 6DF2 A33A 54FA"))))
)

$ ./pre-inst-env guix package -p /tmp/img/gnu/store/7frdchgf5sqw8b83azsml3lw0h52gfbk-profile --export-manifest
$ ./pre-inst-env guix package -p /tmp/img/gnu/store/7frdchgf5sqw8b83azsml3lw0h52gfbk-profile --export-manifest
;; This "manifest" file can be passed to 'guix package -m' to reproduce
;; the content of your profile.  This is "symbolic": it only specifies
;; package names.  To reproduce the exact same profile, you also need to
;; capture the channels being used, as returned by "guix describe".
;; See the "Replicating Guix" section in the manual.

(specifications->manifest
  (list "python"
        "python-ipython"
        "python-numpy"
        "python-matplotlib"
        "python-scipy"
        "python-biopython"))
--8<---------------cut here---------------end--------------->8---

Awesome!


The unexpected is this channels and manifests files do not reproduce the
same Docker pack tarball:

--8<---------------cut here---------------start------------->8---
$ guix describe
Generation 99   Jan 05 2021 16:56:39    (current)
  guix-past 829923f
    repository URL: https://gitlab.inria.fr/guix-hpc/guix-past
    branch: master
    commit: 829923f01f894f1e687735627025ada26230832f
  guix-bimsb a8b539d
    repository URL: https://github.com/BIMSBbioinfo/guix-bimsb
    branch: master
    commit: a8b539d61a359060c35f3cb34c7edd1d9d14241d
  bimsb-nonfree 4084e63
    repository URL: https://github.com/BIMSBbioinfo/guix-bimsb-nonfree.git
    branch: master
    commit: 4084e63c9c0d662780870aded9f5a6ca1b063780
  guix-science cf87b05
    repository URL: https://github.com/guix-science/guix-science.git
    branch: master
    commit: cf87b0501c4a38b96edf41025a27bf1cb91f521a
  guix 957f0c4
    repository URL: https://git.savannah.gnu.org/git/guix.git
    branch: master
    commit: 957f0c40327ce00f53db22737e3775ce616ac258

$ guix time-machine -C /tmp/img/channels.scm -- pack -f docker --save-provenance -m /tmp/img/manifest.scm
Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.org/git/guix.git'...
/gnu/store/xzk604g8gysv4azn7sf9nylr6iah97gl-docker-pack.tar.gz
--8<---------------cut here---------------end--------------->8---

To compare with
/gnu/store/wxymmnxdvdvf08ifsfy39xjaxilhrigk-docker-pack.tar.gz.

On a third machine, I get:
/gnu/store/wxymmnxdvdvf08ifsfy39xjaxilhrigk-docker-pack.tar.gz

Well, that’s another story and I have not inspected yet the
derivations and what could be wrong on the machine B.


Cheers,
simon


  reply	other threads:[~2021-01-27 21:12 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-16 18:29 [bug#45919] [PATCH 0/8] Exporting a manifest and channels from a profile Ludovic Courtès
2021-01-16 18:34 ` [bug#45919] [PATCH 1/8] profiles: Add 'manifest->code' Ludovic Courtès
2021-01-16 18:34   ` [bug#45919] [PATCH 2/8] utils: Add 'version-unique-prefix' Ludovic Courtès
2021-01-16 18:34   ` [bug#45919] [PATCH 3/8] guix package: Add '--export-manifest' Ludovic Courtès
2021-01-16 18:34   ` [bug#45919] [PATCH 4/8] channels: Factorize 'manifest-entry-channel' and channel serialization Ludovic Courtès
2021-01-16 18:34   ` [bug#45919] [PATCH 5/8] channels: Add the channel name to channel sexps Ludovic Courtès
2021-01-16 18:34   ` [bug#45919] [PATCH 6/8] guix describe: Use 'manifest-entry-channel' Ludovic Courtès
2021-01-16 18:34   ` [bug#45919] [PATCH 7/8] channels: Add 'channel->code' Ludovic Courtès
2021-01-16 18:34   ` [bug#45919] [PATCH 8/8] guix package: Add '--export-channels' Ludovic Courtès
2021-01-27 13:14 ` bug#45919: [PATCH 0/8] Exporting a manifest and channels from a profile Ludovic Courtès
2021-01-27 21:02   ` zimoun [this message]
2021-01-28 15:54     ` [bug#45919] " Ludovic Courtès
2021-02-01 22:37       ` Unreproducible “guix pack -f docker” because config.scm-builder zimoun
2021-02-02 14:48         ` zimoun
2021-02-02 18:12         ` Ludovic Courtès
2021-02-02 20:11           ` zimoun
2021-02-05 10:09             ` Ludovic Courtès
2021-02-05 17:22               ` zimoun
2021-02-06 21:46                 ` Ludovic Courtès
2021-02-08 18:44                   ` [PATCH] Fix unreproducible “guix pack -f docker” (hard link) zimoun
     [not found]                   ` <86lfbzad42.fsf@gmail.com>
2021-02-09  8:35                     ` Unreproducible “guix pack -f docker” because config.scm-builder Ludovic Courtès
2021-02-09  8:51                       ` zimoun
2021-01-28 17:57     ` [bug#45919] [PATCH 0/8] Exporting a manifest and channels from a profile Bengt Richter
2021-01-29 19:13       ` zimoun
2021-01-28 17:04   ` bug#45919: " Pierre Neidhardt
2021-01-29 17:57     ` [bug#45919] " Pierre Neidhardt
2021-01-29 18:57       ` zimoun
2021-01-29 21:51         ` Pierre Neidhardt
2021-01-30 14:31           ` zimoun
2021-01-30 21:23             ` bug#45919: " Ludovic Courtès
2021-01-31  5:08               ` Ryan Prior
2021-02-01 13:30                 ` Ludovic Courtès
2021-01-30 13:55       ` Ludovic Courtès
2021-01-31 17:26         ` Pierre Neidhardt
2021-02-01 13:25           ` Ludovic Courtès
2021-02-01 15:32             ` Pierre Neidhardt
2021-02-01 17:04               ` Ludovic Courtès

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86bldahz42.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=45919@debbugs.gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=ludo@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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.