unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: Zelphir Kaltstahl <zelphirkaltstahl@posteo.de>
Cc: help-guix <help-guix@gnu.org>
Subject: Re: How to install previous versions?
Date: Sat, 10 Oct 2020 18:44:27 +0200	[thread overview]
Message-ID: <CAJ3okZ302YLJGV+U1L1AWSkvPPG=he-YzjvOoZcfqgxcOD4suQ@mail.gmail.com> (raw)
In-Reply-To: <cefb9e15-d763-9b89-6a8e-5d458d18942b@posteo.de>

Dear,

On Sat, 10 Oct 2020 at 17:15, Zelphir Kaltstahl
<zelphirkaltstahl@posteo.de> wrote:

> For example, clicking leads to:
>
> http://data.guix.gnu.org/revision/f5111b4d2b982d58387188bc3018e4dd2e9a9d4f
>
> Here is where I am lost. Where do I need to click?

Click on one date.  The row is:

     Version Output Builds From To

and From mean the date of the first commit where the package is at the
version Version.
To is the date of the last commit.


> And this gives you the commit with 'python-redis@3.8', using the command:
>
>   guix time-machine --commit=f5111b \
>          -- environment --ad-hoc python-redis python \
>          -- python
>
> OK, assume I get the commit id.
>
> I just tried this with the following command:
>
> ~~~~
> guix time-machine --commit=f5111b -- environment --ad-hoc 'python-redis@3.3.8' 'python@3.8' -- python3.8
> ~~~~

Remove the '@X.Y'.  It does not make sense since it is somehow already
included by the specification of the commit.


> My guess is, that in this commit of Guix there was no Python 3.8.2 yet? Or perhaps `python-redis` was not build for that Python version?

The "guix time-machine" gives you the exact same Guix as it was at the
commit specification.  Therefore, since the commit f5111b provides the
version of python-redis you want, all the others do matter.


> I do not have a specific use-case at this moment, but I would like to know how to get those specific versions, the same every single time I run the command. To compare, when I create a virtual environment using:

As I have tried to explain. :-)

In your project directory, you have to add 2 files about Guix:

   guix describe -f channels > channels.scm

and the manifest.scm file containing the list of packages the project
requires.  Then at any point in time, you can always do:

   guix time-machine -C channels.scm -- <subcommand> -m manifest <options>


> ~~~~
> python3 -m venv venv
> source venv/bin/activate
> pip install --requirement requirements.txt
> ~~~~

The issue with this approach is that somehow you need a SAT solver.
But that's another story. ;-)

With Guix, AFAICT, the similar is:
 - channels.scm which specifies a Guix version and so packages versions
 - manifest.scm which specifies the list of packages.


> But that is, what I already have, isn't it? There is no part in this, that indicates `guix time-machine`. If time-machine is necessary to get the older version of python-redis@3.3.8 in the command line, then there must be something I need to write in the manifest.scm file to let Guix know, that I want a specific commit id. Or perhaps this is not possible with a manifest? Or is the idea, that I need to have a tracked channel as well to achieve it?

It is possible with the manifest but AFAIU it is a bit tricky and you
should write some Scheme.  The easiest is using a channels.scm file.
See above.


> The other no-so-said is to track "guix describe", you *should* _track_
> the file channels.scm:
>
>    guix describe -f channels.scm
>
> OK this is probably the part, where I need to read the docs about it. I do not have a channels.scm and I do not know what does in there. I only have a vague idea about channels in my head.

Maybe with the output is easier to get the point. :-)

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

Basically, I have only one channel which is the official GNU Guix
"%default-channels".  The important information here are:

 - url: from where it fetch
 - commit: which checkout uses

Therefore, "guix time-machine -C the/channel./file.scm -- help" will
fetch from url and restore at the commit.

The other parts are important too. ;-)  But not for your question. :-)
Well, basically you can even drop them and it will be fine.

So yes, please go read the channel section.  It has recently been
reordered to be more "understandable".  Feedback is very welcome. :-)


> Then later or on another machine, you simply run the command:
>
>    guix time-machine -C path/to/channels.scm \
>           -- <subcommand> -m path/to/manifest.scm <options>
>
> If I understand this correctly, a manifest with specific versions can only be guaranteed to work, if I track a channel as well. And somehow in that channel definition, I must specify which commit of Guix I am on? But wouldn't that limit my choice of libraries to what was available in one commit?

Yes, the same way the choice of libraries is limited at each commit state. :-)

It is possible to mix libraries from different commits but the UI is
not as easy as it should be.

For example, imagine you are doing:

  guix pull
  guix install -m foo.scm /tmp/A
  [...] # time flies
  guix pull
  guix install -m bar.scm /tmp/B

And let assume that foo and bar are *not* coming from the same Guix
commit.  You can still do:

  guix package --search-paths -p /tmp/A -p /tmp/B

and therefore mix the two libraries.

Well, using the time-machine, you need to track the commit which
provided foo and the one of bar.  Then:

  guix time-machine --commit=commit-A -- install -m foo.scm -p /tmp/AA
  guix time-machine --commit=commit-B -- install -m bar.scm -p /tmp/BB

Then "guix package --search-paths -p /tmp/AA -p /tmp/BB" should
provide the exact same thing as before.

That's why it is important to track the Guix commit (guix describe -f
channels) of software you are installing.  Without this piece of
information, it is (almost) impossible to reinstall (other point in
time or space) the exact same version of the very software.

Hope that helps,
simon


  reply	other threads:[~2020-10-10 16:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-09 17:00 How to install previous versions? Zelphir Kaltstahl
2020-10-09 16:37 ` zimoun
2020-10-10 15:14   ` Zelphir Kaltstahl
2020-10-10 16:44     ` zimoun [this message]
2020-10-12 13:58       ` Zelphir Kaltstahl
2020-10-12 14:29         ` zimoun

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='CAJ3okZ302YLJGV+U1L1AWSkvPPG=he-YzjvOoZcfqgxcOD4suQ@mail.gmail.com' \
    --to=zimon.toutoune@gmail.com \
    --cc=help-guix@gnu.org \
    --cc=zelphirkaltstahl@posteo.de \
    /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).