RFC: CHEF-425 Gentoo package names

Hi everyone

Ticket: http://tickets.opscode.com/browse/CHEF-425
Commits: http://github.com/kennethkalmer/chef/commit/8df3958 &
http://github.com/kennethkalmer/chef/commit/3abe57

The issue is when providing package names to the Gentoo package provider
without including a category name, which causes it to re-emerge installed
packages over and over again. After applying some thought to it (and
reviewing the code) it became obvious that one needs to provide a proper
’atom’ to the package resource.

The first commit simply logs a warning for the chef user, alerting them that
the atom isn’t correct.

The second commit applies some voodoo to infer the possible category name
for portage. If multiple categories are inferred, no assumptions are made,
keeping ambiguous package names and letting emerge fail. However, if only a
single category is found then the package name is updated to have this
category name.

Please have a look and let me know what you think. I can understand the
inferring code can be too much, hence two separate commits. At the very
least the logging patch should be accepted.

Can I start a new page on the wiki detailing ‘gotchas’ for Gentoo? I’d like
to ensure Gentoo users can enjoy chef without bumping their heads on small
things like this.

Best


Kenneth Kalmer
kenneth.kalmer@gmail.com
http://opensourcery.co.za
@kennethkalmer

This looks reasonable to me, at least from a high level. DWIM-ery
means that if there is only one category, it should work it out, and
if there is more than one we should carp.

Adam

On Thu, Feb 4, 2010 at 2:30 AM, Kenneth Kalmer kenneth.kalmer@gmail.com wrote:

Hi everyone
Ticket: http://tickets.opscode.com/browse/CHEF-425
Commits: Log info if package names do not contain category (Gentoo provider) [… · kennethkalmer/chef@8df3958 · GitHub &
Attempt to infer package category when missing (Gentoo provider) [CHE… · kennethkalmer/chef@3abe575 · GitHub
The issue is when providing package names to the Gentoo package provider
without including a category name, which causes it to re-emerge installed
packages over and over again. After applying some thought to it (and
reviewing the code) it became obvious that one needs to provide a proper
'atom' to the package resource.
The first commit simply logs a warning for the chef user, alerting them that
the atom isn't correct.
The second commit applies some voodoo to infer the possible category name
for portage. If multiple categories are inferred, no assumptions are made,
keeping ambiguous package names and letting emerge fail. However, if only a
single category is found then the package name is updated to have this
category name.
Please have a look and let me know what you think. I can understand the
inferring code can be too much, hence two separate commits. At the very
least the logging patch should be accepted.
Can I start a new page on the wiki detailing 'gotchas' for Gentoo? I'd like
to ensure Gentoo users can enjoy chef without bumping their heads on small
things like this.
Best

Kenneth Kalmer
kenneth.kalmer@gmail.com
http://opensourcery.co.za
@kennethkalmer

--
Opscode, Inc.
Adam Jacob, CTO
T: (206) 508-7449 E: adam@opscode.com

On Thu, Feb 4, 2010 at 10:46 PM, Adam Jacob adam@opscode.com wrote:

This looks reasonable to me, at least from a high level. DWIM-ery
means that if there is only one category, it should work it out, and
if there is more than one we should carp.

Portage will carp for us, no need for an exception. Looking at the ambiguous
'ace' package:

$ emerge -pv ace

These are the packages that would be merged, in order:

Calculating dependencies -

[ Results for search key : ace ]
[ Applications found : 2 ]

  • dev-libs/ace
    Latest version available: 5.5-r1
    Latest version installed: [ Not Installed ]
    Size of files: 26,478 kB
    Homepage: http://www.cs.wustl.edu/~schmidt/ACE.html
    Description: The Adaptive Communications Environment
    License: BSD as-is

  • games-board/ace
    Latest version available: 1.2-r2
    Latest version installed: [ Not Installed ]
    Size of files: 302 kB
    Homepage: http://www.delorie.com/store/ace/
    Description: DJ Delorie's Ace of Penguins solitaire games
    License: GPL-2

!!! The short ebuild name "ace" is ambiguous. Please specify
!!! one of the above fully-qualified ebuild names instead.

                                                                   ...

done!
$ echo $?
1

Best

--
Kenneth Kalmer
kenneth.kalmer@gmail.com
http://opensourcery.co.za
@kennethkalmer