Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: chef/omnibus
...
head fork: chef/omnibus
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 10 files changed
  • 0 commit comments
  • 1 contributor
View
40 cookbooks/build-essential/recipes/default.rb
@@ -25,7 +25,15 @@
end
end
-
+ # TODO: figure out what the root cause is and remove this dep
+ # Background: Erlang fails to ./configure erts on Ubuntu 12.04 platforms
+ # because the test program it uses to detect ncurses fails to find ncurses in
+ # the embedded/ directory. Installing ncurses-devel causes ./configure to
+ # work, and the resulting erlang is linked to the correct ncurses shared
+ # object (in embedded/). So this is ugly, but required to make erlang build.
+ if platform?("ubuntu") and node[:platform_version].to_f >= 12.04
+ package "ncurses-dev"
+ end
when "centos"
centos_major_version = node['platform_version'].split('.').first.to_i
pkgs = if centos_major_version < 6
@@ -47,26 +55,20 @@
action :install
end
end
+when "mac_os_x"
+ include_recipe "homebrew"
end
-package "autoconf" do
- action :install
-end
-
-package "flex" do
- action :install
-end
+unless node['platform'] == "mac_os_x"
+ package "autoconf" do
+ action :install
+ end
-package "bison" do
- action :install
-end
+ package "flex" do
+ action :install
+ end
-# TODO: figure out what the root cause is and remove this dep
-# Background: Erlang fails to ./configure erts on Ubuntu 12.04 platforms
-# because the test program it uses to detect ncurses fails to find ncurses in
-# the embedded/ directory. Installing ncurses-devel causes ./configure to
-# work, and the resulting erlang is linked to the correct ncurses shared
-# object (in embedded/). So this is ugly, but required to make erlang build.
-if platform?("ubuntu") and node[:platform_version].to_f >= 12.04
- package "ncurses-dev"
+ package "bison" do
+ action :install
+ end
end
View
60 cookbooks/homebrew/README.rdoc
@@ -0,0 +1,60 @@
+= Description
+
+Installs Homebrew and acts as the native package provider for Mac OS X using
+Homebrew to install packages. See:
+
+http://woss.name/2011/01/23/converging-your-home-directory-with-chef/
+
+for additional background.
+
+= Requirements
+
+== Platform
+
+This is only going to work on platforms that Homebrew supports which is, I
+think, just Mac OS X. This cookbook has been tested on Mac OS X 10.6.6 with the
+latest version of Homebrew (as of Mon 24 Jan 2011 at any rate!).
+
+== Cookbooks
+
+Shouldn't require any other cookbooks, though its operation may be greatly
+enhanced by another cookbook I'm brewing that manages launchd. ;-)
+
+= Resources and Providers
+
+This cookbook provides a package provider called +homebrew_package+ which will
+install/remove packages using Homebrew. This becomes the default provider for
++package+ if your platform is Mac OS X.
+
+= Attributes
+
+None.
+
+= Usage
+
+Just make sure that this cookbook is selected before you start installing
+packages. You can add:
+
+ include_recipe 'homebrew'
+
+to all your recipes that install packages, or you can just make sure it's on
+the run list somewhere early on. The bookbook itself ensures that Homebrew is
+installed and up to date.
+
+= License and Author
+
+Author:: Graeme Mathieson (<mathie@woss.name>)
+
+Copyright:: 2011, Graeme Mathieson
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
View
17 cookbooks/homebrew/Rakefile
@@ -0,0 +1,17 @@
+require 'rubygems'
+require 'chef'
+require 'json'
+
+desc "Generate an updated JSON metadata file"
+task :metadata do
+ cook_meta = Chef::Cookbook::Metadata.new
+ cook_meta.from_file('metadata.rb')
+ File.open('metadata.json', 'w') do |f|
+ f.write(JSON.pretty_generate(cook_meta))
+ end
+end
+
+desc "Create an archive for uploading to cookbooks.opscode.com"
+task :archive do
+ sh %{git archive --format=tar --prefix=homebrew/ HEAD |gzip -9 > homebrew.tar.gz}
+end
View
79 cookbooks/homebrew/libraries/homebrew_package.rb
@@ -0,0 +1,79 @@
+# Chef package provider for Homebrew
+
+require 'chef/provider/package'
+require 'chef/resource/package'
+require 'chef/platform'
+
+class Chef
+ class Provider
+ class Package
+ class Homebrew < Package
+ def load_current_resource
+ @current_resource = Chef::Resource::Package.new(@new_resource.name)
+ @current_resource.package_name(@new_resource.package_name)
+ @current_resource.version(current_installed_version)
+
+ @current_resource
+ end
+
+ def install_package(name, version)
+ brew('install', name)
+ end
+
+ # Homebrew doesn't really have a notion of upgrading packages, just
+ # install the latest version?
+ def upgrade_package(name, version)
+ install_package(name, version)
+ end
+
+ def remove_package(name, version)
+ brew('uninstall', name)
+ end
+
+ # Homebrew doesn't really have a notion of purging, so just remove.
+ def purge_package(name, version)
+ remove_package(name, version)
+ end
+
+ protected
+ def brew(*args)
+ run_command_with_systems_locale(
+ :command => "brew #{args.join(' ')}"
+ )
+ end
+
+ def current_installed_version
+ get_version_from_command("brew list --versions | awk '/^#{@new_resource.package_name} / { print $2 }'")
+ end
+
+ def candidate_version
+ get_version_from_command("brew info #{@new_resource.package_name} | awk '/^#{@new_resource.package_name} / { print $2 }'")
+ end
+
+ def get_version_from_command(command)
+ version = get_response_from_command(command).chomp
+ version.empty? ? nil : version
+ end
+
+ # Nicked from lib/chef/package/provider/macports.rb and tweaked
+ # slightly.
+ def get_response_from_command(command)
+ output = nil
+ status = popen4(command) do |pid, stdin, stdout, stderr|
+ begin
+ output = stdout.read
+ rescue Exception => e
+ raise Chef::Exceptions::Package, "Could not read from STDOUT on command: #{command}\nException: #{e.inspect}"
+ end
+ end
+ unless (0..1).include? status.exitstatus
+ raise Chef::Exceptions::Package, "#{command} failed - #{status.inspect}"
+ end
+ output
+ end
+ end
+ end
+ end
+end
+
+Chef::Platform.set :platform => :mac_os_x, :resource => :package, :provider => Chef::Provider::Package::Homebrew
View
33 cookbooks/homebrew/metadata.json
@@ -0,0 +1,33 @@
+{
+ "suggestions": {
+ },
+ "conflicting": {
+ },
+ "long_description": "= Description\n\nInstalls Homebrew and acts as the native package provider for Mac OS X using\nHomebrew to install packages. See:\n\nhttp://woss.name/2011/01/23/converging-your-home-directory-with-chef/\n\nfor additional background.\n\n= Requirements\n\n== Platform\n\nThis is only going to work on platforms that Homebrew supports which is, I\nthink, just Mac OS X. This cookbook has been tested on Mac OS X 10.6.6 with the\nlatest version of Homebrew (as of Mon 24 Jan 2011 at any rate!).\n\n== Cookbooks\n\nShouldn't require any other cookbooks, though its operation may be greatly\nenhanced by another cookbook I'm brewing that manages launchd. ;-)\n\n= Resources and Providers\n\nThis cookbook provides a package provider called +homebrew_package+ which will\ninstall/remove packages using Homebrew. This becomes the default provider for\n+package+ if your platform is Mac OS X.\n\n= Attributes\n\nNone.\n\n= Usage\n\nJust make sure that this cookbook is selected before you start installing\npackages. You can add:\n\n include_recipe 'homebrew'\n\nto all your recipes that install packages, or you can just make sure it's on\nthe run list somewhere early on. The bookbook itself ensures that Homebrew is\ninstalled and up to date.\n\n= License and Author\n\nAuthor:: Graeme Mathieson (<mathie@woss.name>)\n\nCopyright:: 2011, Graeme Mathieson\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
+ "providing": {
+ },
+ "platforms": {
+ "mac_os_x": [
+
+ ]
+ },
+ "license": "Apache 2.0",
+ "maintainer": "Graeme Mathieson",
+ "replacing": {
+ },
+ "maintainer_email": "mathie@woss.name",
+ "name": "homebrew",
+ "version": "1.0.0",
+ "groupings": {
+ },
+ "dependencies": {
+ },
+ "description": "Install Homebrew and use it as your package provider in Mac OS X",
+ "recipes": {
+ "homebrew": "Install Homebrew"
+ },
+ "attributes": {
+ },
+ "recommendations": {
+ }
+}
View
9 cookbooks/homebrew/metadata.rb
@@ -0,0 +1,9 @@
+name "homebrew"
+maintainer "Graeme Mathieson"
+maintainer_email "mathie@woss.name"
+license "Apache 2.0"
+description "Install Homebrew and use it as your package provider in Mac OS X"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
+version "1.0.0"
+recipe "homebrew", "Install Homebrew"
+supports "mac_os_x"
View
15 cookbooks/homebrew/recipes/default.rb
@@ -0,0 +1,15 @@
+execute "install homebrew" do
+ command "curl -sfL https://github.com/mxcl/homebrew/tarball/master | tar zx -m --strip 1"
+ cwd "/usr/local"
+ not_if { File.exist? '/usr/local/bin/brew' }
+end
+
+file "/usr/local/bin/brew" do
+ owner "root"
+end
+
+package 'git'
+
+execute "update homebrew from github" do
+ command "/usr/local/bin/brew update || true"
+end
View
6 cookbooks/omnibus/recipes/default.rb
@@ -52,6 +52,9 @@
},
["centos"] => {
"default" => ["rpm-build"]
+ },
+ ["mac_os_x"] => {
+ "default" => [],
}
)
package_pkgs.each do |pkg|
@@ -67,6 +70,9 @@
},
["centos"] => {
"default" => ["libxml2", "libxml2-devel", "libxslt", "libxslt-devel"]
+ },
+ ["mac_os_x"] => {
+ "default" => [],
}
)
xml_pkgs.each do |pkg|
View
3  cookbooks/python/recipes/package.rb
@@ -36,6 +36,9 @@
["freebsd"] => {
"default" => ["python"]
},
+ ["mac_os_x"] => {
+ "default" => ["python"]
+ },
"default" => ["python","python-dev"]
)
end
View
15 lib/omnibus/project.rb
@@ -122,7 +122,7 @@ def package_types
when 'solaris2'
[ "solaris" ]
else
- []
+ [ "tar" ]
end
end
@@ -157,6 +157,13 @@ def fpm_command(pkg_type)
command_and_opts
end
+ def tar_command(pkg_type)
+ command_and_opts = [ "tar",
+ "zcvf",
+ "#{package_name}-#{build_version}_#{iteration}.tar.gz",
+ "#{install_path}"]
+ end
+
def render_tasks
directory config.package_dir
directory "pkg"
@@ -168,7 +175,11 @@ def render_tasks
desc "package #{@name} into a #{pkg_type}"
task pkg_type => (@dependencies.map {|dep| "software:#{dep}"}) do
- fpm_full_cmd = fpm_command(pkg_type).join(" ")
+ if pkg_type == "tar"
+ fpm_full_cmd = tar_command(pkg_type).join(" ")
+ else
+ fpm_full_cmd = fpm_command(pkg_type).join(" ")
+ end
puts "[project:#{name}] Executing `#{fpm_full_cmd}`"
shell = Mixlib::ShellOut.new(fpm_full_cmd,

No commit comments for this range

Something went wrong with that request. Please try again.