Skip to content
This repository has been archived by the owner on Dec 2, 2020. It is now read-only.

Commit

Permalink
Merge pull request #81 from boxen/binary-tweaks
Browse files Browse the repository at this point in the history
Binary tweaks
  • Loading branch information
MikeMcQuaid committed Mar 12, 2015
2 parents bf5a4f6 + d4d63bb commit f50895f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
14 changes: 12 additions & 2 deletions files/boxen-bottle-hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,27 @@ def self.file(formula)
"#{formula.name}-#{formula.pkg_version}.tar.bz2"
end

# Keep in sync with same-named function in:
# https://github.com/boxen/our-boxen/blob/master/script/sync
def self.s3_cellar
case HOMEBREW_CELLAR.to_s
when "/opt/boxen/homebrew/Cellar" then ""
when "/usr/local/Cellar" then "default/"
else "#{Base64.strict_encode64(HOMEBREW_CELLAR.to_s)}/"
end
end

def self.url(formula)
os = MacOS.version
file = self.file(formula)
path = "/#{Base64.strict_encode64(HOMEBREW_CELLAR)}/#{os}/#{file}"
path = "/#{s3_cellar}#{os}/#{file}"

if ENV['BOXEN_HOMEBREW_BOTTLE_URL']
ENV['BOXEN_HOMEBREW_BOTTLE_URL'] + path
else
host = ENV['BOXEN_S3_HOST'] || 's3.amazonaws.com'
bucket = ENV['BOXEN_S3_BUCKET'] || 'boxen-downloads'
"http://#{bucket}.#{host}/homebrew" + path
"https://#{host}/#{bucket}/homebrew" + path
end
end

Expand Down
3 changes: 0 additions & 3 deletions lib/puppet/provider/homebrew_tap/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ def command_opts
:custom_environment => {
"HOME" => "/#{homedir_prefix}/#{default_user}",
"PATH" => "#{self.class.home}/bin:/usr/bin:/usr/sbin:/bin:/sbin",
"CFLAGS" => "-O2",
"CPPFLAGS" => "-O2",
"CXXFLAGS" => "-O2",
"HOMEBREW_ROOT" => "#{self.class.home}",
},
:failonfail => true,
Expand Down
4 changes: 0 additions & 4 deletions lib/puppet/provider/package/homebrew.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,8 @@ def command_opts
:custom_environment => {
"HOME" => "/#{homedir_prefix}/#{default_user}",
"PATH" => "#{self.class.home}/bin:/usr/bin:/usr/sbin:/bin:/sbin",
"CFLAGS" => "-O2",
"CPPFLAGS" => "-O2",
"CXXFLAGS" => "-O2",
"BOXEN_HOMEBREW_BOTTLE_URL" => bottle_url,
"HOMEBREW_CACHE" => self.class.cache,
"HOMEBREW_BUILD_BOTTLE" => "1"
},
:failonfail => true,
:uid => default_user
Expand Down

0 comments on commit f50895f

Please sign in to comment.