From: Alex Kost <alezost@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH 3/6] emacs: Find packages in system profiles.
Date: Wed, 13 Jan 2016 23:45:36 +0300 [thread overview]
Message-ID: <87pox59pjj.fsf@gmail.com> (raw)
In-Reply-To: <878u3ubkzc.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Tue, 12 Jan 2016 21:28:55 +0100")
Ludovic Courtès (2016-01-12 23:28 +0300) wrote:
> Alex Kost <alezost@gmail.com> skribis:
>
>> For a usual profile, packages are placed in a profile directory itself,
>> but for a system profile, packages are placed in 'profile'
>> sub-directory. So we need to do some special cases for system profiles
>> to find packages there as well.
>
> [...]
>
>> +(defun guix-packages-profile (profile &optional generation system?)
>> + "Return a directory where packages are installed for the
>> +PROFILE's GENERATION.
>> +
>> +If SYSTEM? is non-nil, then PROFILE is considered to be a system
>> +profile. Unlike usual profiles, for a system profile, packages
>> +are placed in 'profile' subdirectory."
>> + (let ((profile (if generation
>> + (guix-generation-file profile generation)
>> + profile)))
>> + (if system?
>> + (expand-file-name "profile" profile)
>> + profile)))
>
> It seems you’re calling /run/current-system the system profile, which
> leads to the ‘system?’ Boolean here, but the system profile really is
> /run/current-system/profile.
As we need to work with generations, I use "/var/guix/profiles/system"
instead of a "/run/current-system" link. But you are right, I called it
“system profile”.
I think using "/var/guix/profiles/system/profile" wouldn't help to
remove ‘system?’ boolean. For example:
(guix-packages-profile "/var/guix/profiles/per-user/me/guix-profile" 3)
=> "/var/guix/profiles/per-user/me/guix-profile-3-link"
(guix-packages-profile "/var/guix/profiles/system/profile" 3)
=> "/var/guix/profiles/system/profile-3-link"
The first one is correct, but the second should be:
=> "/var/guix/profiles/system-3-link/profile"
As you can see we need to distinguish system and usual profiles because
packages are placed in different places for them
("system-NN-link/profile" and "usual-NN-link" without "profile" subdir),
that's why I added ‘system?’ argument. I don't see how it can be
avoided.
> I had overlooked it, but wouldn’t it be easier if patch #2 did:
>
> +(defvar guix-system-profile
> + (concat guix-config-state-directory "/profiles/system/profile")
> + "System profile.")
>
> ?
Not really.
Both "/var/guix/profiles/system" (which I called “system profile”) and
"/var/guix/profiles/system/profile" (which I called “packages profile”)
are needed. The former — for finding generations, and the latter — for
finding packages.
I actually need "/var/guix/profiles/system" in the first place, so if
‘guix-system-profile’ is not an appropriate name for this variable, it
should be renamed (what name do you suggest?).
And about name confusion: now I see that “profile” should be used only
for a directory (symlink) with packages. But I always thought that a
directory that has generations can also be named a “profile” (apparently
cannot), especially taking into account ‘profile-generations’ procedure
from (guix profiles) module:
(profile-generations "/var/guix/profiles/system")
That's why ^^^ I called "/var/guix/profiles/system" a system profile.
--
Alex
next prev parent reply other threads:[~2016-01-13 20:45 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-10 9:53 [PATCH 0/6] emacs: Add "M-x guix-system-generations" Alex Kost
2016-01-10 9:53 ` [PATCH 1/6] guix system: Export <boot-parameters> accessors Alex Kost
2016-01-12 20:25 ` Ludovic Courtès
2016-01-13 20:44 ` Alex Kost
2016-01-13 22:33 ` Ludovic Courtès
2016-01-14 8:34 ` Alex Kost
2016-01-14 13:25 ` Ludovic Courtès
2016-01-10 9:53 ` [PATCH 2/6] emacs: profiles: Add 'guix-system-profile' Alex Kost
2016-01-12 20:25 ` Ludovic Courtès
2016-01-10 9:53 ` [PATCH 3/6] emacs: Find packages in system profiles Alex Kost
2016-01-12 20:28 ` Ludovic Courtès
2016-01-13 20:45 ` Alex Kost [this message]
2016-01-13 22:42 ` Ludovic Courtès
2016-01-14 8:38 ` Alex Kost
2016-01-14 13:27 ` Ludovic Courtès
2016-01-10 9:53 ` [PATCH 4/6] emacs: Replace 'generation-diff' search with 'profile-diff' Alex Kost
2016-01-12 20:29 ` Ludovic Courtès
2016-01-10 9:53 ` [PATCH 5/6] emacs: Remove 'generation' search type Alex Kost
2016-01-12 20:31 ` Ludovic Courtès
2016-01-10 9:53 ` [PATCH 6/6] emacs: Add interface for system generations Alex Kost
2016-01-12 20:35 ` Ludovic Courtès
2016-01-13 20:56 ` Alex Kost
2016-01-13 22:44 ` Ludovic Courtès
2016-01-12 20:23 ` [PATCH 0/6] emacs: Add "M-x guix-system-generations" 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=87pox59pjj.fsf@gmail.com \
--to=alezost@gmail.com \
--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.