Hi all,

I have defined a package_method for the package manager "gem" (it is 
used to install Ruby modules and manage their dependencies - not a 
*system* package manager, but a package manager nonetheless).

body package_method gem {
     package_changes => "bulk";

     package_list_command => "/usr/bin/gem list";
     package_list_name_regex => "^([^\s]+)\s\([\d.]+\)";
     package_list_version_regex => "^[^\s]+\s\(([\d.]+)\)";
     package_installed_regex => ".*"; # all reported are installed

     package_add_command => "/usr/bin/gem install -i ";
     package_delete_command => "/usr/bin/gem uninstall ";
     package_update_command => "/usr/bin/gem update -i ";

     package_delete_convention => "$(name)";
     package_name_convention => "$(name) -v=$(version)";
} 


This works great for adding/updating/removing packages. Except if you 
want to specify a package name to install without specifying a version. 
Let me explain.

See the value of package_name_convention? This is because there are two 
formats for "gem install":
1) "gem install package" installs the latest version of package
2) "gem install package -v=X.Y.Z" installs version X.Y.Z of package

If I don't specify a version to install in my package promise, like this 
(note there's no package_version):

packages:
     "passenger"
         package_method => gem,
         package_policy => "add";

Then the command that's run is "gem install package -v=*". "gem" doesn't 
like this.

So, my question is: How can I implement a package manager like this, to 
support installing both with a specific version, and without any 
specific version?

I tried various combinaisons of ifvarclass => isdefined("version") but 
that's not legal syntax. Maybe what is needed is some mechanism to 
change package_name_convention depending on the value of "version"?

Any other ideas?

Thanks in advance,
Jonathan
-- 
==========================================
Jonathan CLARKE
------------------------------------------
Normation
44 rue Cauchy, 94110 Arcueil, France
------------------------------------------
Telephone:  +33 (0)1 83 62 26 96
------------------------------------------
Web:        http://www.normation.com/
==========================================
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to