poise-build-essential 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.kitchen.yml +3 -0
  4. data/.travis.yml +60 -0
  5. data/.yardopts +7 -0
  6. data/CHANGELOG.md +5 -0
  7. data/Gemfile +35 -0
  8. data/LICENSE +201 -0
  9. data/README.md +85 -0
  10. data/Rakefile +17 -0
  11. data/chef/attributes/default.rb +21 -0
  12. data/chef/recipes/default.rb +19 -0
  13. data/lib/poise_build_essential.rb +22 -0
  14. data/lib/poise_build_essential/build_essential_providers.rb +49 -0
  15. data/lib/poise_build_essential/build_essential_providers/base.rb +103 -0
  16. data/lib/poise_build_essential/build_essential_providers/debian.rb +41 -0
  17. data/lib/poise_build_essential/build_essential_providers/freebsd.rb +46 -0
  18. data/lib/poise_build_essential/build_essential_providers/mac_os_x.rb +66 -0
  19. data/lib/poise_build_essential/build_essential_providers/omnios.rb +46 -0
  20. data/lib/poise_build_essential/build_essential_providers/rhel.rb +46 -0
  21. data/lib/poise_build_essential/build_essential_providers/smartos.rb +39 -0
  22. data/lib/poise_build_essential/build_essential_providers/solaris.rb +47 -0
  23. data/lib/poise_build_essential/build_essential_providers/suse.rb +43 -0
  24. data/lib/poise_build_essential/build_essential_providers/windows.rb +68 -0
  25. data/lib/poise_build_essential/cheftie.rb +18 -0
  26. data/lib/poise_build_essential/resources.rb +26 -0
  27. data/lib/poise_build_essential/resources/poise_build_essential.rb +48 -0
  28. data/lib/poise_build_essential/version.rb +20 -0
  29. data/poise-build-essential.gemspec +42 -0
  30. data/test/cookbook/attributes/default.rb +17 -0
  31. data/test/cookbook/metadata.rb +18 -0
  32. data/test/cookbook/recipes/default.rb +37 -0
  33. data/test/gemfiles/chef-12.1.gemfile +23 -0
  34. data/test/gemfiles/chef-12.10.gemfile +23 -0
  35. data/test/gemfiles/chef-12.11.gemfile +23 -0
  36. data/test/gemfiles/chef-12.12.gemfile +22 -0
  37. data/test/gemfiles/chef-12.13.gemfile +22 -0
  38. data/test/gemfiles/chef-12.14.gemfile +19 -0
  39. data/test/gemfiles/chef-12.15.gemfile +19 -0
  40. data/test/gemfiles/chef-12.16.gemfile +19 -0
  41. data/test/gemfiles/chef-12.17.gemfile +19 -0
  42. data/test/gemfiles/chef-12.18.gemfile +19 -0
  43. data/test/gemfiles/chef-12.19.gemfile +19 -0
  44. data/test/gemfiles/chef-12.2.gemfile +23 -0
  45. data/test/gemfiles/chef-12.3.gemfile +23 -0
  46. data/test/gemfiles/chef-12.4.gemfile +24 -0
  47. data/test/gemfiles/chef-12.5.gemfile +23 -0
  48. data/test/gemfiles/chef-12.6.gemfile +23 -0
  49. data/test/gemfiles/chef-12.7.gemfile +23 -0
  50. data/test/gemfiles/chef-12.8.gemfile +23 -0
  51. data/test/gemfiles/chef-12.9.gemfile +23 -0
  52. data/test/gemfiles/chef-12.gemfile +19 -0
  53. data/test/gemfiles/master.gemfile +26 -0
  54. data/test/integration/default/serverspec/default_spec.rb +27 -0
  55. data/test/spec/build_essential_providers/debian_spec.rb +49 -0
  56. data/test/spec/build_essential_providers/freebsd_spec.rb +68 -0
  57. data/test/spec/build_essential_providers/mac_os_x_spec.rb +52 -0
  58. data/test/spec/build_essential_providers/omnios_spec.rb +67 -0
  59. data/test/spec/build_essential_providers/rhel_spec.rb +54 -0
  60. data/test/spec/build_essential_providers/smartos_spec.rb +64 -0
  61. data/test/spec/build_essential_providers/solaris_spec.rb +108 -0
  62. data/test/spec/build_essential_providers/suse_spec.rb +54 -0
  63. data/test/spec/recipe_spec.rb +35 -0
  64. data/test/spec/resources/poise_build_essential_spec.rb +49 -0
  65. data/test/spec/spec_helper.rb +19 -0
  66. metadata +210 -0
@@ -0,0 +1,39 @@
1
+ #
2
+ # Copyright 2008-2017, Chef Software, Inc.
3
+ # Copyright 2017, Noah Kantrowitz
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ require 'poise_build_essential/build_essential_providers/base'
19
+
20
+
21
+ module PoiseBuildEssential
22
+ module BuildEssentialProviders
23
+ # A provider for `poise_build_essential` to install on SmartOS platforms.
24
+ #
25
+ # @see PoiseBuildEssential::Resources::PoiseBuildEssential::Resource
26
+ # @provides poise_build_essential
27
+ class SmartOS < Base
28
+ provides(:poise_build_essential, platform_family: 'smartos')
29
+
30
+ private
31
+
32
+ # (see Base#install_build_essential)
33
+ def install_build_essential
34
+ %w{autoconf binutils build-essential gcc47 gmake pkg-config}.map {|name| package name }
35
+ end
36
+
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,47 @@
1
+ #
2
+ # Copyright 2008-2017, Chef Software, Inc.
3
+ # Copyright 2017, Noah Kantrowitz
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ require 'poise_build_essential/build_essential_providers/base'
19
+
20
+
21
+ module PoiseBuildEssential
22
+ module BuildEssentialProviders
23
+ # A provider for `poise_build_essential` to install on Solaris platforms.
24
+ #
25
+ # @see PoiseBuildEssential::Resources::PoiseBuildEssential::Resource
26
+ # @provides poise_build_essential
27
+ class Solaris < Base
28
+ provides(:poise_build_essential, platform_family: 'solaris2')
29
+
30
+ private
31
+
32
+ # (see Base#install_build_essential)
33
+ def install_build_essential
34
+ if node['platform_version'].to_f < 5.11
35
+ unsupported_platform('poise_build_essential does not support Solaris before 11. You will need to install SUNWbison, SUNWgcc, SUNWggrp, SUNWgmake, and SUNWgtar from the Solaris DVD')
36
+ return []
37
+ end
38
+
39
+ # lock because we don't use gcc 5 yet.
40
+ [package('gcc') { version '4.8.2'} ] + \
41
+ %w{autoconf automake bison gnu-coreutils flex gcc-3 gnu-grep gnu-make
42
+ gnu-patch gnu-tar make pkg-config ucb}.map {|name| package name }
43
+ end
44
+
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,43 @@
1
+ #
2
+ # Copyright 2008-2017, Chef Software, Inc.
3
+ # Copyright 2017, Noah Kantrowitz
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ require 'poise_build_essential/build_essential_providers/base'
19
+
20
+
21
+ module PoiseBuildEssential
22
+ module BuildEssentialProviders
23
+ # A provider for `poise_build_essential` to install on SUSE platforms.
24
+ #
25
+ # @see PoiseBuildEssential::Resources::PoiseBuildEssential::Resource
26
+ # @provides poise_build_essential
27
+ class SUSE < Base
28
+ provides(:poise_build_essential, platform_family: 'suse')
29
+
30
+ private
31
+
32
+ # (see Base#install_build_essential)
33
+ def install_build_essential
34
+ pkgs = %w{autoconf bison flex gcc gcc-c++ kernel-default-devel make m4}
35
+ if node['platform_version'].to_i < 12
36
+ pkgs += %w{gcc48 gcc48-c++}
37
+ end
38
+ package pkgs
39
+ end
40
+
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,68 @@
1
+ #
2
+ # Copyright 2008-2017, Chef Software, Inc.
3
+ # Copyright 2017, Noah Kantrowitz
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ require 'poise_build_essential/build_essential_providers/base'
19
+
20
+
21
+ module PoiseBuildEssential
22
+ module BuildEssentialProviders
23
+ # A provider for `poise_build_essential` to install on Windows platforms.
24
+ #
25
+ # @see PoiseBuildEssential::Resources::PoiseBuildEssential::Resource
26
+ # @provides poise_build_essential
27
+ class Windows < Base
28
+ provides(:poise_build_essential, platform_family: 'windows')
29
+
30
+ private
31
+
32
+ # (see Base#install_build_essential)
33
+ def install_build_essential
34
+ install_build_essential_packages
35
+ end
36
+
37
+ # (see Base#upgrade_build_essential)
38
+ def upgrade_build_essential
39
+ # Upgrade and install are the same on Windows. (?)
40
+ install_build_essential
41
+ end
42
+
43
+ # (see Base#remove_build_essential)
44
+ def remove_build_essential
45
+ raise NotImplementedError
46
+ end
47
+
48
+ # Install MSYS2 packages needed for the build environment.
49
+ #
50
+ # @api private
51
+ # @return [Array<Chef::Resource>]
52
+ def install_build_essential_packages
53
+ # TODO This probably won't work on 32-bit right now, fix that.
54
+ [
55
+ 'base-devel', # Brings down msys based bash/make/awk/patch/stuff.
56
+ 'mingw-w64-x86_64-toolchain', # Puts 64-bit SEH mingw toolchain in msys2\mingw64.
57
+ 'mingw-w64-i686-toolchain' # Puts 32-bit DW2 mingw toolchain in msys2\ming32.
58
+ ].map do |pkg_group|
59
+ # The pacman package provider doesn't support groups, so going old-school.
60
+ poise_msys2_execute "pacman --sync #{pkg_group}" do
61
+ command ['pacman', '--sync', '--noconfirm', '--noprogressbar', '--needed', pkg_group]
62
+ end
63
+ end
64
+ end
65
+
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,18 @@
1
+ #
2
+ # Copyright 2017, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require 'poise_build_essential/resources'
18
+ require 'poise_build_essential/build_essential_providers'
@@ -0,0 +1,26 @@
1
+ #
2
+ # Copyright 2017, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require 'poise_build_essential/resources/poise_build_essential'
18
+
19
+
20
+ module PoiseBuildEssential
21
+ # Chef resources and providers for poise-build-essential.
22
+ #
23
+ # @since 1.0.0
24
+ module Resources
25
+ end
26
+ end
@@ -0,0 +1,48 @@
1
+ #
2
+ # Copyright 2017, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require 'chef/resource'
18
+ require 'poise'
19
+
20
+
21
+ module PoiseBuildEssential
22
+ module Resources
23
+ # (see PoiseBuildEssential::Resource)
24
+ # @since 1.0.0
25
+ module PoiseBuildEssential
26
+ # A `poise_build_essential` resource to install a C compiler and build tools.
27
+ #
28
+ # @provides poise_build_essential
29
+ # @action install
30
+ # @action upgrade
31
+ # @action uninstall
32
+ # @example
33
+ # poise_build_essential 'build-essential'
34
+ class Resource < Chef::Resource
35
+ include Poise
36
+ provides(:poise_build_essential)
37
+ actions(:install, :upgrade, :remove)
38
+
39
+ # @!attribute allow_unsupported_platform
40
+ # Whether or not to raise an error on unsupported platforms.
41
+ # @return [Boolean]
42
+ attribute(:allow_unsupported_platform, kind_of: [TrueClass, FalseClass], default: lazy { node['poise-build-essential']['allow_unsupported_platform'] })
43
+ end
44
+
45
+ # Providers can be found under build_essential_providers/.
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,20 @@
1
+ #
2
+ # Copyright 2017, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+
18
+ module PoiseBuildEssential
19
+ VERSION = '1.0.0'
20
+ end
@@ -0,0 +1,42 @@
1
+ #
2
+ # Copyright 2017, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ lib = File.expand_path('../lib', __FILE__)
18
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
19
+ require 'poise_build_essential/version'
20
+
21
+ Gem::Specification.new do |spec|
22
+ spec.name = 'poise-build-essential'
23
+ spec.version = PoiseBuildEssential::VERSION
24
+ spec.authors = ['Noah Kantrowitz']
25
+ spec.email = %w{noah@coderanger.net}
26
+ spec.description = 'A Chef cookbook to install a C compiler and build tools.'
27
+ spec.summary = spec.description
28
+ spec.homepage = 'https://github.com/poise/poise-build-essential'
29
+ spec.license = 'Apache 2.0'
30
+
31
+ spec.files = `git ls-files`.split($/)
32
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
33
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
34
+ spec.require_paths = %w{lib}
35
+
36
+ spec.add_dependency 'chef', '>= 12.1', '< 14'
37
+ spec.add_dependency 'halite', '~> 1.1'
38
+ spec.add_dependency 'poise', '~> 2.6'
39
+ # spec.add_dependency 'poise-msys2'
40
+
41
+ spec.add_development_dependency 'poise-boiler', '~> 1.6'
42
+ end
@@ -0,0 +1,17 @@
1
+ #
2
+ # Copyright 2017, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ override['poise-msys2']['root'] = "Z:\\msys2"
@@ -0,0 +1,18 @@
1
+ #
2
+ # Copyright 2017, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ name 'poise-build-essential_test'
18
+ depends 'poise-build-essential'
@@ -0,0 +1,37 @@
1
+ #
2
+ # Copyright 2017, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ include_recipe 'poise-build-essential'
18
+
19
+ directory '/build_essential_test'
20
+
21
+ file '/build_essential_test/main.c' do
22
+ content <<-EOH
23
+ #include <stdio.h>
24
+ int main()
25
+ {
26
+ printf("Hello, World!\\n");
27
+ return 0;
28
+ }
29
+ EOH
30
+ end
31
+
32
+ file '/build_essential_test/Makefile' do
33
+ content <<-EOH
34
+ all:
35
+ \t${CC} -o hello main.c
36
+ EOH
37
+ end
@@ -0,0 +1,23 @@
1
+ #
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
18
+
19
+ gem 'chef', '~> 12.1.2'
20
+ gem 'rack', '< 2'
21
+ gem 'foodcritic', '< 8'
22
+ gem 'fauxhai', '<= 3.9.0'
23
+ gem 'chefspec', '< 6'