[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: guix-package --roll-back

From: Nikita Karetnikov
Subject: Re: guix-package --roll-back
Date: Fri, 04 Jan 2013 13:18:38 -0500

>>>   $ guix-package -p foo --roll-back

>> Should I add any profile-related sanity checks to 'roll-back'?

> What kind of sanity check?

The one that should check that 'foo' is actually a profile.

>> Should 'roll-back' only work for 'guix-profile-*-link' and
>> 'default-*-link'? If not, then we have a problem because 'profile-rx'
>> can't handle something like '42-custom-profile'. Is it possible to
>> create such a profile?

> Yes, but I think the regexp handles it just fine, no?

It depends on how profiles are stored. It turned out that there are
several issues. By the way, what should I do to create a custom profile?

Both 'profile-rx' and 'profile-number' work fine when '%current-profile'
is used.

scheme@(guile-user)> (define %current-profile 
scheme@(guile-user)> (profile-number %current-profile)
$2 = "1"
scheme@(guile-user)> (readlink %current-profile)
$3 = "/nix/var/nix/profiles/per-user/root/guix-profile-1-link"

But fail for other inputs.

scheme@(guile-user)> (define profile-1 
scheme@(guile-user)> (profile-number profile-1)
$4 = #f

This implementation of 'profile-number' works for 'profile-1', but it
doesn't work for '%current-profile'.

(define (profile-number-1 profile)
  (and=> (regexp-exec (profile-rx %current-profile)
                      (basename profile)) ; 'readlink' was removed
                 (cut match:substring <> 1)))

scheme@(guile-user)> (profile-number-1 profile-1)
$5 = "1"
scheme@(guile-user)> (profile-number-1 %current-profile)
$6 = #f

Also, both 'profile-rx' and 'profile-number' can't handle custom

Here is what I used to create a bogus custom profile.

# cd /home
# mkdir testdir
# cd testdir
# touch env-42
# ln -s env-42 42-custom-profile
# ln -s 42-custom-profile guix-profile


scheme@(guile-user)> (define custom-profile "/home/testdir/guix-profile")
scheme@(guile-user)> (profile-number custom-profile)
$7 = #f

So, what kinds of profiles should be supported? Maybe it's not possible
to create something like 'custom-profile' and there is no need to


Attachment: pgp9CtpjFuBFT.pgp
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]