Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Chef 3442 #586

Closed
wants to merge 2 commits into from

3 participants

@pierreozoux

Hi, do you know in which release will it be included?

Thanks

@btm
Owner

Merged to master.

@btm btm closed this
@pierreozoux pierreozoux deleted the pierreozoux:CHEF-3442 branch
@prashantrajan

@btm could this be backported to the 10.x series? It's a major issue for anyone using Gentoo.

@btm
Owner

Cherry-picked to 10-stable, by request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 16, 2013
  1. http://tickets.opscode.com/browse/CHEF-3442

    pierre-o13 authored
  2. add tests to avoid futur regression

    pierre-o13 authored
This page is out of date. Refresh to see the latest.
View
13 lib/chef/provider/package/portage.rb
@@ -58,14 +58,19 @@ def load_current_resource
def parse_emerge(package, txt)
availables = {}
- package_without_category = package.split("/").last
found_package_name = nil
txt.each_line do |line|
if line =~ /\*\s+#{PACKAGE_NAME_PATTERN}/
- found_package_name = $&.strip
- if found_package_name == package || found_package_name.split("/").last == package_without_category
- availables[found_package_name] = nil
+ found_package_name = $&.gsub(/\*/, '').strip
+ if package =~ /\// #the category is specified
+ if found_package_name == package
+ availables[found_package_name] = nil
+ end
+ else #the category is not specified
+ if found_package_name.split("/").last == package
+ availables[found_package_name] = nil
+ end
end
end
View
44 spec/unit/provider/package/portage_spec.rb
@@ -230,6 +230,50 @@
lambda { @provider.candidate_version }.should raise_error(Chef::Exceptions::Package)
end
+ it "should find the candidate_version if a category is specifed and there are category duplicates" do
+ output = <<EOF
+Searching...
+[ Results for search key : git ]
+[ Applications found : 14 ]
+
+* app-misc/digitemp [ Masked ]
+ Latest version available: 3.5.0
+ Latest version installed: [ Not Installed ]
+ Size of files: 261 kB
+ Homepage: http://www.digitemp.com/ http://www.ibutton.com/
+ Description: Temperature logging and reporting using Dallas Semiconductor's iButtons and 1-Wire protocol
+ License: GPL-2
+
+* app-misc/git
+ Latest version available: 4.3.20
+ Latest version installed: [ Not Installed ]
+ Size of files: 416 kB
+ Homepage: http://www.gnu.org/software/git/
+ Description: GNU Interactive Tools - increase speed and efficiency of most daily task
+ License: GPL-2
+
+* dev-util/git
+ Latest version available: 1.6.0.6
+ Latest version installed: ignore
+ Size of files: 2,725 kB
+ Homepage: http://git.or.cz/
+ Description: GIT - the stupid content tracker, the revision control system heavily used by the Linux kernel team
+ License: GPL-2
+
+* dev-util/gitosis [ Masked ]
+ Latest version available: 0.2_p20080825
+ Latest version installed: [ Not Installed ]
+ Size of files: 31 kB
+ Homepage: http://eagain.net/gitweb/?p=gitosis.git;a=summary
+ Description: gitosis -- software for hosting git repositories
+ License: GPL-2
+EOF
+
+ @status = mock("Status", :exitstatus => 0)
+ @provider = Chef::Provider::Package::Portage.new(@new_resource, @run_context)
+ @provider.should_receive(:popen4).and_yield(nil, nil, StringIO.new(output), nil).and_return(@status)
+ @provider.candidate_version.should == "1.6.0.6"
+ end
end
describe Chef::Provider::Package::Portage, "install_package" do
Something went wrong with that request. Please try again.