From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nikita Karetnikov Subject: Re: guix-package --roll-back Date: Fri, 04 Jan 2013 13:18:38 -0500 Message-ID: <87obh43j7r.fsf@karetnikov.org> References: <871uejyq9z.fsf@karetnikov.org> <874nj4sbfe.fsf@karetnikov.org> <87y5gf8sm1.fsf@gnu.org> <87hamy4yaj.fsf@karetnikov.org> <87pq1m5nxy.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:44233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TrBqo-0006Pk-Tl for bug-guix@gnu.org; Fri, 04 Jan 2013 13:18:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TrBqm-0003DE-BP for bug-guix@gnu.org; Fri, 04 Jan 2013 13:18:38 -0500 List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: bug-guix@gnu.org --=-=-= >>> $ 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 "/nix/var/nix/profiles/per-user/root/guix-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 "/nix/var/nix/profiles/per-user/root/guix-profile-1-link") 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 profiles. 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 bother. Nikita --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQIcBAEBAgAGBQJQ5xz+AAoJEM+IQzI9IQ38B0sQAJ/eJy2KH5GCICH3nd2E6MM7 yC2I68kZy7xBG2JV53+PInhSMIki7EZy0NMKocuKVQggR/rKA00VPh5fwnnEqHbK aKcB2mcP7RzkzRXNfo3P27+bBTkpn4lvbDXKnLZeNGOQGE+o7Yj2TXoRr1sSORvH lhGL0k7M2cU/pizZO2LlDfhT2muMryVJ2ImMgPprdp6GHPIC+rMINoSfiOfatxcG jZZ0+OH0k2YAFo68CDP9WTxp/xLKJ4bNaUuY5IwhoY0mcVaxCneZCZk6cTeEQpku HynFMaTpWZUKYSeQIIJ9Sxj1YCr5r5xEhpxiikF686XulO/6xIw4AL804LW9dR78 UNH6VPfXTbvQn+GRMeYBcvVzl7/5lGDdaTNSKXZDKv3vqMETA0AjK+tkvdx66HRc OjDYQxjcQzV9LCruj2jJfzsNCifgQ4HZ5Uozz7Qvfnp/ZjIVHf7aDhYSeqfhedb2 U2adLK54u57G4quO+gK3nOigS+tEcnublecQnxPT6Sb80OgKoigvse/pEEf8ag7h 8pjeCDX+nHSABkhb+2PQjK8IeY0DFJGLcAFGd58kRym3IAGdCjwX3lrklYoffJmX YHKaPlRMQ/ADUYPt/ecItV5a+0RMtcKbNGcYGsr7BA17+dxDTiJEFXt9pNmynBSA stGJcTvdUxfFtwfGf0gE =Vsrp -----END PGP SIGNATURE----- --=-=-=--