Feature#2198 - Install multiple package within a single call to the package manager

34 views
Skip to first unread message

gor...@ocre.cea.fr

unread,
Apr 27, 2009, 4:27:32 AM4/27/09
to puppe...@googlegroups.com
Hey,

I am new in the puppet code and I am trying to write a patch for this
feature, but I need some advice about the global design.
How could I manage the fact that there is many packages, do I have to
create another type that handle multiple packages ?
I have to select packages that could be install without breaking the
dependency graph, how could I make this new type part of the graph ?
And, where does it should be handle in the process ?
How can I link this new "metatype" with the existing providers ?

I am eager to know your ideas about it.

--
Stéphan Gorget (phantez)

Luke Kanies

unread,
May 1, 2009, 9:35:36 AM5/1/09
to puppe...@googlegroups.com

On Apr 27, 2009, at 10:27 AM, gor...@ocre.cea.fr wrote:

>
> Hey,
>
> I am new in the puppet code and I am trying to write a patch for this
> feature, but I need some advice about the global design.
> How could I manage the fact that there is many packages, do I have to
> create another type that handle multiple packages ?
> I have to select packages that could be install without breaking the
> dependency graph, how could I make this new type part of the graph ?
> And, where does it should be handle in the process ?
> How can I link this new "metatype" with the existing providers ?

I don't think a new type is either necessary or a good idea. The
critical issue is the interface between the package provider and the
transaction, and it should look somewhat like how prefetching looks.

In terms of ordering, there are basically two choices: Combine
adjacent packages, or just combine all packages. I expect that most
package types would be fine combining all packages into a single call,
but there should be a new package parameter added to allow people to
disable this.

So, the transaction would have to track what kinds of packages it had
run into, with a method something like this:

def eval_resource
...
if resource.provider.class.respond_to?(:install_multiple)
events = install_multiple(resource)
else
...
end
end

def install_multiple(resource)
provider_class = resource.provider.class
@multiple_install_events ||= {}
@multiple_install_events[provider_class] ||= {}
if event = @multiple_install_events[provider_class][resource.path]
return event
end

# Find all resources matching the provider class that set combining
resource_names = catalog.vertices.collect { |r|
r.provider.class.equal?(provider.class) }.reject { |r| r[:combine] ==
false }.collect { |r| r[:name] }

@multiple_install_events[provider_class] =
provider_class.install_multiple(resource_names)

@multiple_install_events[provider_class][resource.path]
end

----

Obviously this isn't quite right, but you get the idea -- you need to
have per-resource events, so that notification and dependencies work
correctly, but otherwise you want to combine everything.

You'll also need to check all of the resources first to see if they're
in sync - you don't want to include packages that are already
installed in the list to be installed.

--
Honest criticism is hard to take, particularly from a relative, a
friend, an acquaintance, or a stranger. -- Franklin P. Jones
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com

Francois Deppierraz

unread,
May 6, 2009, 5:27:23 AM5/6/09
to puppe...@googlegroups.com
Luke Kanies wrote:

> Obviously this isn't quite right, but you get the idea -- you need to
> have per-resource events, so that notification and dependencies work
> correctly, but otherwise you want to combine everything.

Such a feature would be awesome !

We are using Puppet to install Ubuntu workstations on which we are
installing about 200 packages. The initial puppet run takes
approximatively 20 minutes to finish.

A single call to apt-get or aptitude would certainly shorten this
operation quite a bit.

François

Luke Kanies

unread,
May 6, 2009, 10:48:33 AM5/6/09
to puppe...@googlegroups.com


These could actually be shortened quite a bit with existing
infrastructure by adding prefetching support to apt/aptitude. That
would cut out one call to apt-cache for every package.

--
"They called me mad, and I called them mad, and damn them, they
outvoted me." -- Nathaniel Lee, on being consigned to a mental
institution, circa 17th c.

Ohad Levy

unread,
May 6, 2009, 9:55:42 PM5/6/09
to puppe...@googlegroups.com
+1 for any improvement in this area, until now we ended up with creating our own dummy packages that just include dependencies to many other packages...
Reply all
Reply to author
Forward
0 new messages