Aliases policy?

Auke Kok sofar at lunar-linux.org
Mon Mar 21 08:18:43 UTC 2005


Terry Chan wrote:

>>since lunar now has the aliases code we could actually start with
>>replacing unnecessary or unlogical dependencies. I would like to replace
>>xservers-profile f.e. Any concerns that might keep me away from doing
>>what I'm about to do? ;-)
>>    
>>
>Well does the alias code work ?  How is it supposed to be used ?
>

Some explanation is required:

1. I bumped the UPDATED field yesterday for 'lunar'. I would propose a 
two week waiting time to make sure everyone (or ... most people) have 
the core code before they are encountered with a moonbase that uses this 
feature

Here's how developers use 'aliases':

1. read /var/lib/lunar/aliases:

%X:XOrg XOrg-test xfree86 xfree86-beta
%MTA:postfix exim sendmail

This file defines aliases. The syntax currently implemented is:

%{alias name}:{substituted module name} ({name}) ({name}) ...

secondly, the "%ALIAS" name must start with a '%' sign (arbitrary). The 
reason I chose this character is that it currently has no meaning in bash.

third, you can ONLY use these aliases in 'DEPENDS' files. This is the 
drawback of the system, there's no way to use it in POST_INSTALL etc. 
The reason for this is to keep it simple.

the alias algorithm is really simple, and basically looks like this:

run_depends() {
  depends() {
    real_dependency=substitute_alias($1)
  }
  run_module_file $MODULE DEPENDS
}

The substitute_alias function (in reality called 'unalias') replaces 
'%X' with one of the alternatives listed in the 'aliases' file mentioned 
above. This happens real-time, so there is no table that stores 
'selections'. That also means:

a. once ONE of the possible substitutes has been installed, it will 
automatically be substituted
b. if NONE of the alt. has been installed, the user gets to choose one 
of them. It will be added to the list of dependencies etc automatically
c. if the user fails to select an alias, he will be asked to do so on 
the next occasion

(lsh-> type unalias)

The code is relatively small and simple, which has a huge bonus: there's 
no administration needed. The drawback is that you prolly want to do a 
'lunar fixdepends' once you decide to change from -say- xfree86 to XOrg.

I tested it in real life and it works relatively good because it's so 
simple. Once the users pick a choice it should be possible on a virgin 
install to do a 'lin xfce4-profile' just because the system will only 
ask once which type of X he would prefer.

The currently listed aliases only are '%X' and '%MTA'. I'm sure there 
are much more possible but I would like to ask all developers to go easy 
on adding more. First of all aliases are not good for all situations and 
secondly we don't want to replace the depends-mess with an alias-mess 
;^). Keep it in discussion in this ML I'd say.

Hope this helps.

sofar





More information about the Lunar-dev mailing list