Skip to content

Added option to enable PCRE for Linux git #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ The following attributes are platform-specific.
* `node['git']['version']` - git version to install
* `node['git']['url']` - URL to git tarball
* `node['git']['checksum']` - tarball SHA256 checksum
* `node['git']['use_pcre']` - if true, builds git with PCRE enabled

Recipes
=======
Expand Down
1 change: 1 addition & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
default['git']['version'] = '1.9.5'
default['git']['url'] = "https://nodeload.github.com/git/git/tar.gz/v#{node['git']['version']}"
default['git']['checksum'] = '0f30984828d573da01d9f8e78210d5f4c56da1697fd6d278bad4cfa4c22ba271'
default['git']['use_pcre'] = false
end

default['git']['server']['base_path'] = '/srv/git'
Expand Down
8 changes: 7 additions & 1 deletion libraries/provider_git_client_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ class Source < Chef::Provider::GitClient
case node['platform_version'].to_i
when 5
pkgs = %w(expat-devel gettext-devel curl-devel openssl-devel zlib-devel)
pkgs += %w{ pcre-devel } if node['git']['use_pcre']
when 6, 7
pkgs = %w(expat-devel gettext-devel libcurl-devel openssl-devel perl-ExtUtils-MakeMaker zlib-devel)
pkgs += %w{ pcre-devel } if node['git']['use_pcre']
else
pkgs = %w(expat-devel gettext-devel curl-devel openssl-devel perl-ExtUtils-MakeMaker zlib-devel) if node['platform'] == 'amazon'
pkgs += %w{ pcre-devel } if node['git']['use_pcre']
end
when 'debian'
pkgs = %w(libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev)
pkgs += %w{ libpcre3-dev } if node['git']['use_pcre']
end

pkgs.each do |pkg|
Expand All @@ -44,9 +48,11 @@ class Source < Chef::Provider::GitClient
# reduce line-noise-eyness
execute "Extracting and Building Git #{node['git']['version']} from Source" do
cwd Chef::Config['file_cache_path']
additional_make_params = ""
additional_make_params += "USE_LIBPCRE=1" if node['git']['use_pcre']
command <<-COMMAND
(mkdir git-#{node['git']['version']} && tar -zxf git-#{node['git']['version']}.tar.gz -C git-#{node['git']['version']} --strip-components 1)
(cd git-#{node['git']['version']} && make prefix=#{node['git']['prefix']} install)
(cd git-#{node['git']['version']} && make prefix=#{node['git']['prefix']} #{additional_make_params} install)
COMMAND
not_if "git --version | grep #{node['git']['version']}"
end
Expand Down