guix-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 3/6] emacs: Find packages in system profiles.


From: Alex Kost
Subject: Re: [PATCH 3/6] emacs: Find packages in system profiles.
Date: Wed, 13 Jan 2016 23:45:36 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Ludovic Courtès (2016-01-12 23:28 +0300) wrote:

> Alex Kost <address@hidden> 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



reply via email to

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