Skip to content

Commit

Permalink
Remove old java::* recipes, use java::multi with OpenJDK 6 being the …
Browse files Browse the repository at this point in the history
…default (for now)
  • Loading branch information
michaelklishin committed May 24, 2012
1 parent 13687ce commit d571e7c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 150 deletions.
45 changes: 3 additions & 42 deletions ci_environment/java/recipes/default.rb
@@ -1,9 +1,10 @@
#
# Author:: Seth Chisamore (<schisamo@opscode.com>)
# Author:: Travis CI Development Team
# Cookbook Name:: java
# Recipe:: default
#
# Copyright 2008-2011, Opscode, Inc.
# Copyright 2008-2011, Travis CI Development Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,44 +19,4 @@
# limitations under the License.
#

case node['platform']
when "ubuntu"
apt_repository "ubuntu-partner" do
uri "http://archive.canonical.com/ubuntu"
distribution node['lsb']['codename']
components ['partner']
action :add
end
# update-java-alternatives doesn't work with only sun java installed
node.set['java']['java_home'] = "/usr/lib/jvm/java-6-sun"

when "debian"
apt_repository "debian-non-free" do
uri "http://http.us.debian.org/debian"
distribution "stable"
components ['main','contrib','non-free']
action :add
end
# update-java-alternatives doesn't work with only sun java installed
node.set['java']['java_home'] = "/usr/lib/jvm/java-6-sun"
when "centos", "redhat", "fedora"
pkgs.each do |pkg|
if node['java'].attribute?('rpm_url')
remote_file "#{Chef::Config[:file_cache_path]}/#{pkg}" do
source "#{node['java']['rpm_url']}/#{pkg}"
checksum node['java']['rpm_checksum']
mode "0644"
end
else
cookbook_file "#{Chef::Config[:file_cache_path]}/#{pkg}" do
source pkg
mode "0644"
action :create_if_missing
end
end
end
else
Chef::Log.error("Installation of Sun Java packages not supported on this platform.")
end

include_recipe "java::#{node['java']['install_flavor']}"
include_recipe "java::multi"
50 changes: 0 additions & 50 deletions ci_environment/java/recipes/openjdk.rb

This file was deleted.

37 changes: 28 additions & 9 deletions ci_environment/java/recipes/openjdk6.rb
@@ -1,17 +1,36 @@
version = 6

pkgs = value_for_platform(
["centos","redhat","fedora","scientific","amazon"] => {
"default" => ["java-1.#{version}.0-openjdk","java-1.#{version}.0-openjdk-devel"]
},
["arch","freebsd"] => {
"default" => ["openjdk#{version}"]
},
"default" => ["openjdk-#{version}-jdk"]
)
pkgs = value_for_platform(["centos","redhat","fedora","scientific","amazon"] => {
"default" => ["java-1.#{version}.0-openjdk","java-1.#{version}.0-openjdk-devel"]
},
["arch","freebsd"] => {
"default" => ["openjdk#{version}"]
},
"default" => ["openjdk-#{version}-jdk"])

# once we test the waters and write the announcement, this will be moved to the
# openjdk7 recipe. MK.
execute "update-java-alternatives" do
alternative = case [node[:platform], node[:platform_version]]
when ["ubuntu", "11.04"] then
"java-6-openjdk"
when ["ubuntu", "11.10"] then
"java-1.6.0-openjdk"
when ["ubuntu", "12.04"] then
"java-1.6.0-openjdk-i386"
else
"java-1.6.0-openjdk"
end

command "update-java-alternatives -s #{alternative}"
returns [0,2]
action :nothing
only_if { platform?("ubuntu", "debian") }
end

pkgs.each do |pkg|
package pkg do
action :install
notifies :run, resources(:execute => "update-java-alternatives")
end
end
49 changes: 0 additions & 49 deletions ci_environment/java/recipes/sun.rb

This file was deleted.

0 comments on commit d571e7c

Please sign in to comment.