kameleon-builder 2.0.0 → 2.1.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 (157) hide show
  1. data/.editorconfig +0 -0
  2. data/.env +63 -15
  3. data/.gitignore +1 -0
  4. data/README.rst +4 -2
  5. data/Vagrantfile +13 -52
  6. data/bin/kameleon +5 -0
  7. data/completion/_kameleon.zsh +18 -0
  8. data/completion/kameleon.bash +13 -0
  9. data/completion/kameleon.fish +10 -0
  10. data/contrib/polipo_env.sh +2 -0
  11. data/contrib/steps/export/save_as_g5k.yaml +63 -0
  12. data/contrib/steps/setup/add_to_sudoers.yaml +5 -0
  13. data/docs/Makefile +10 -6
  14. data/docs/README.md +17 -0
  15. data/docs/source/_static/kameleon-logo.png +0 -0
  16. data/docs/source/_static/kameleon-logo.xcf +0 -0
  17. data/docs/source/_static/kameleon-long.png +0 -0
  18. data/docs/source/aliases.rst +4 -2
  19. data/docs/source/checkpoint.rst +2 -0
  20. data/docs/source/commands.rst +4 -3
  21. data/docs/source/conf.py +15 -7
  22. data/docs/source/context.rst +7 -4
  23. data/docs/source/faq.rst +39 -1
  24. data/docs/source/getting_started.rst +227 -1
  25. data/docs/source/grid5000_tutorial.rst +110 -0
  26. data/docs/source/index.rst +7 -2
  27. data/docs/source/installation.rst +12 -4
  28. data/docs/source/persistent_cache.rst +34 -0
  29. data/docs/source/recipe.rst +23 -16
  30. data/docs/source/use_cases.rst +93 -0
  31. data/docs/source/workspace.rst +2 -0
  32. data/kameleon-builder.gemspec +7 -1
  33. data/lib/kameleon.rb +3 -6
  34. data/lib/kameleon/cli.rb +104 -50
  35. data/lib/kameleon/compat.rb +39 -0
  36. data/lib/kameleon/context.rb +43 -13
  37. data/lib/kameleon/engine.rb +118 -77
  38. data/lib/kameleon/environment.rb +3 -5
  39. data/lib/kameleon/error.rb +15 -9
  40. data/lib/kameleon/logger.rb +7 -4
  41. data/lib/kameleon/persistent_cache.rb +139 -0
  42. data/lib/kameleon/recipe.rb +200 -81
  43. data/lib/kameleon/shell.rb +51 -16
  44. data/omnibus/.gitignore +11 -0
  45. data/omnibus/.kitchen.yml +25 -0
  46. data/omnibus/Berksfile +9 -0
  47. data/omnibus/Berksfile.lock +25 -0
  48. data/omnibus/Gemfile +12 -0
  49. data/omnibus/README.md +94 -0
  50. data/omnibus/config/projects/kameleon.rb +23 -0
  51. data/omnibus/config/software/kameleon.rb +24 -0
  52. data/omnibus/config/software/polipo.rb +30 -0
  53. data/omnibus/config/software/ruby.rb +158 -0
  54. data/omnibus/files/mac_dmg/Resources/background.png +0 -0
  55. data/omnibus/files/mac_dmg/Resources/icon.png +0 -0
  56. data/omnibus/files/mac_pkg/Resources/background.png +0 -0
  57. data/omnibus/files/mac_pkg/Resources/license.html +1 -0
  58. data/omnibus/files/mac_pkg/Resources/welcome.html +9 -0
  59. data/omnibus/omnibus.rb +27 -0
  60. data/omnibus/package-scripts/kameleon/makeselfinst +27 -0
  61. data/omnibus/package-scripts/kameleon/postrm +9 -0
  62. data/templates/archlinux-desktop.yaml +25 -0
  63. data/templates/archlinux.yaml +106 -0
  64. data/templates/debian-testing.yaml +25 -0
  65. data/templates/debian7-desktop.yaml +25 -0
  66. data/templates/{debian-wheezy-docker.yaml → debian7-docker.yaml} +30 -16
  67. data/templates/debian7-g5k.yaml +97 -0
  68. data/templates/debian7-oar-dev.yaml +51 -0
  69. data/templates/debian7.yaml +128 -0
  70. data/templates/extend.erb +23 -0
  71. data/templates/fedora-rawhide.yaml +30 -0
  72. data/templates/fedora20-desktop.yaml +21 -0
  73. data/templates/fedora20.yaml +105 -0
  74. data/templates/{debian-wheezy-chroot.yaml → old-debian7.yaml} +51 -38
  75. data/templates/{aliases → steps/aliases}/defaults.yaml +37 -12
  76. data/templates/steps/bootstrap/archlinux/arch_bootstrap.yaml +219 -0
  77. data/templates/steps/bootstrap/archlinux/install_bootloader.yaml +46 -0
  78. data/templates/steps/bootstrap/archlinux/populate_disk.yaml +39 -0
  79. data/templates/steps/bootstrap/debian/debootstrap.yaml +18 -10
  80. data/templates/steps/bootstrap/debian/debootstrap_arm.yaml +31 -0
  81. data/templates/steps/bootstrap/fedora/liveos_bootstrap.yaml +123 -0
  82. data/templates/steps/bootstrap/g5k_reserv.yaml +70 -0
  83. data/templates/steps/bootstrap/initialize_disk_chroot.yaml +84 -0
  84. data/templates/steps/bootstrap/initialize_disk_qemu.yaml +72 -0
  85. data/templates/steps/bootstrap/install_bootloader.yaml +42 -0
  86. data/templates/steps/bootstrap/prepare_chroot.yaml +126 -0
  87. data/templates/steps/bootstrap/prepare_docker.yaml +19 -8
  88. data/templates/steps/bootstrap/prepare_qemu.yaml +47 -0
  89. data/templates/steps/bootstrap/start_chroot.yaml +11 -2
  90. data/templates/steps/bootstrap/start_docker.yaml +2 -2
  91. data/templates/steps/bootstrap/start_qemu.yaml +75 -0
  92. data/templates/steps/bootstrap/ubuntu/debootstrap.yaml +27 -0
  93. data/templates/steps/breakpoint.yaml +2 -0
  94. data/templates/{checkpoints → steps/checkpoints}/docker.yaml +0 -0
  95. data/templates/steps/checkpoints/qcow2.yaml +38 -0
  96. data/templates/steps/checkpoints/qemu.yaml +39 -0
  97. data/templates/steps/export/clean_appliance.yaml +7 -1
  98. data/templates/steps/export/compact_qcow_img.yaml +12 -0
  99. data/templates/steps/export/save_appliance.yaml +58 -0
  100. data/templates/steps/export/save_appliance_from_g5k.yaml +47 -0
  101. data/templates/steps/export/save_vagrant_box.yaml +29 -0
  102. data/templates/steps/setup/archlinux/configure_keyboard.yaml +9 -0
  103. data/templates/steps/setup/archlinux/configure_network.yaml +9 -0
  104. data/templates/steps/setup/archlinux/configure_ruby.yaml +7 -0
  105. data/templates/steps/setup/archlinux/configure_system.yaml +20 -0
  106. data/templates/steps/setup/archlinux/install_dev_tools.yaml +18 -0
  107. data/templates/steps/setup/archlinux/install_gnome.yaml +27 -0
  108. data/templates/steps/setup/archlinux/install_software.yaml +9 -0
  109. data/templates/steps/setup/archlinux/install_yaourt.yaml +29 -0
  110. data/templates/steps/setup/autologin.yaml +16 -0
  111. data/templates/steps/setup/create_group.yaml +12 -0
  112. data/templates/steps/setup/create_user.yaml +9 -10
  113. data/templates/steps/setup/debian/configure_apt.yaml +65 -0
  114. data/templates/steps/setup/debian/configure_kernel.yaml +18 -0
  115. data/templates/steps/setup/debian/{keyboard_config.yaml → configure_keyboard.yaml} +1 -1
  116. data/templates/steps/setup/debian/{network_config.yaml → configure_network.yaml} +0 -0
  117. data/templates/steps/setup/debian/{system_config.yaml → configure_system.yaml} +0 -0
  118. data/templates/steps/setup/debian/install_gnome.yaml +13 -0
  119. data/templates/steps/setup/debian/install_kde.yaml +13 -0
  120. data/templates/steps/setup/debian/install_software.yaml +2 -0
  121. data/templates/steps/setup/debian/oar/oar_debian_config_frontend.yaml +8 -0
  122. data/templates/steps/setup/debian/oar/oar_debian_config_node.yaml +5 -0
  123. data/templates/steps/setup/debian/oar/oar_debian_config_server.yaml +5 -0
  124. data/templates/steps/setup/debian/oar/oar_prereq_install.yaml +16 -0
  125. data/templates/steps/setup/debian/setup_vagrant_box.yaml +52 -0
  126. data/templates/steps/setup/debian/upgrade_system.yaml +15 -0
  127. data/templates/steps/setup/fedora/configure_network.yaml +30 -0
  128. data/templates/steps/setup/fedora/configure_system.yaml +59 -0
  129. data/templates/steps/setup/fedora/install_software.yaml +3 -0
  130. data/templates/steps/setup/fedora/update_system.yaml +10 -0
  131. data/templates/steps/setup/oar/oar_config_devel.yaml +21 -0
  132. data/templates/steps/setup/oar/oar_config_frontend.yaml +38 -0
  133. data/templates/steps/setup/oar/oar_config_node.yaml +4 -0
  134. data/templates/steps/setup/oar/oar_config_server.yaml +25 -0
  135. data/templates/steps/setup/oar/oar_config_system.yaml +34 -0
  136. data/templates/steps/setup/oar/oar_devel_prereq_install.yaml +5 -0
  137. data/templates/steps/setup/oar/oar_git_install.yaml +21 -0
  138. data/templates/steps/setup/ubuntu/configure_apt.yaml +67 -0
  139. data/templates/ubuntu-12.04-desktop.yaml +25 -0
  140. data/templates/ubuntu-12.04.yaml +128 -0
  141. data/templates/ubuntu-14.04-desktop.yaml +27 -0
  142. data/templates/ubuntu-14.04.yaml +25 -0
  143. data/templates/vagrant-debian7.yaml +31 -0
  144. data/version.txt +1 -1
  145. metadata +155 -28
  146. checksums.yaml +0 -7
  147. data/templates/checkpoints/qcow2.yaml +0 -44
  148. data/templates/fedora-docker.yaml +0 -96
  149. data/templates/steps/bootstrap/fedora/docker_bootstrap.yaml +0 -25
  150. data/templates/steps/bootstrap/fedora/yum_bootstrap.yaml +0 -22
  151. data/templates/steps/bootstrap/prepare_appliance_with_nbd.yaml +0 -93
  152. data/templates/steps/export/build_appliance_from_docker.yaml +0 -105
  153. data/templates/steps/export/save_appliance_from_nbd.yaml +0 -54
  154. data/templates/steps/setup/debian/kernel_install.yaml +0 -20
  155. data/templates/steps/setup/debian/software_install.yaml +0 -15
  156. data/templates/steps/setup/fedora/kernel_install.yaml +0 -27
  157. data/templates/steps/setup/fedora/software_install.yaml +0 -10
@@ -8,30 +8,41 @@ module Kameleon
8
8
  READ_CHUNK_SIZE = 1048576
9
9
  EXIT_TIMEOUT = 60
10
10
 
11
- attr :exit_status, :process
11
+ attr :exit_status, :process, :shell_cmd
12
12
 
13
13
  def initialize(context_name, cmd, shell_workdir, local_workdir, kwargs = {})
14
- @logger = Log4r::Logger.new("kameleon::[shell]")
14
+ @logger = Log4r::Logger.new("kameleon::[kameleon]")
15
15
  @cmd = cmd.chomp
16
16
  @context_name = context_name
17
17
  @local_workdir = local_workdir
18
18
  @shell_workdir = shell_workdir
19
- @bashrc_file = "/tmp/kameleon_#{@context_name}_bash_rc"
20
- @bash_history_file = "/tmp/kameleon_#{@context_name}_bash_history"
21
- @bash_env_file = "/tmp/kameleon_#{@context_name}_bash_env"
22
- change_dir_cmd = ""
23
- if @shell_workdir
24
- unless @shell_workdir.eql? "/"
25
- change_dir_cmd = "mkdir -p #{@shell_workdir} &&"
26
- end
27
- change_dir_cmd = "#{change_dir_cmd} cd #{@shell_workdir} && "
28
- end
19
+ @bashrc_file = "kameleon_#{@context_name}_bash_rc"
20
+ @bash_history_file = "kameleon_#{@context_name}_bash_history"
21
+ @bash_env_file = "kameleon_#{@context_name}_bash_env"
29
22
  @default_bashrc_file = File.join(Kameleon.source_root,
30
23
  "contrib",
31
24
  "kameleon_bashrc.sh")
32
- bash_cmd = "bash --rcfile #{@bashrc_file}"
25
+ if @shell_workdir
26
+ @bashrc_file = File.join(@shell_workdir, @bashrc_file)
27
+ @bash_history_file = File.join(@shell_workdir, @bash_history_file)
28
+ @bash_env_file = File.join(@shell_workdir, @bash_env_file)
29
+ end
30
+
31
+ ## Changing the default bashrc if the cache is activated
32
+ @cache = Kameleon::Persistent_cache.instance
33
+ if @cache.activated? then
34
+ new_kameleon_bashrc = Tempfile.new('kameleon_bashrc').path
35
+ FileUtils.cp @default_bashrc_file, new_kameleon_bashrc
36
+ tpl = ERB.new(File.read(@cache.polipo_env))
37
+ polipo_env_content = tpl.result(binding)
38
+ File.open(new_kameleon_bashrc,'a') do |f|
39
+ f.puts(polipo_env_content)
40
+ end
41
+ @default_bashrc_file = new_kameleon_bashrc
42
+ end
43
+
33
44
  @shell_cmd = "source #{@default_bashrc_file} 2> /dev/null; "\
34
- "#{@cmd} -c '#{change_dir_cmd}#{bash_cmd}'"
45
+ "#{@cmd} --rcfile #{@bashrc_file}"
35
46
  @logger.debug("Initialize shell (#{self})")
36
47
  # Injecting all variables of the options and assign the variables
37
48
  instance_variables.each do |v|
@@ -45,7 +56,11 @@ module Kameleon
45
56
  end
46
57
 
47
58
  def stop
48
- @process.stop
59
+ @process.stop(0) unless @process.nil?
60
+ end
61
+
62
+ def started?
63
+ return !@process.nil?
49
64
  end
50
65
 
51
66
  def exited?
@@ -59,6 +74,7 @@ module Kameleon
59
74
 
60
75
  def send_file(source_path, remote_dest_path, chunk_size=READ_CHUNK_SIZE)
61
76
  copy_process, = fork("pipe")
77
+ copy_process.io.stdin << init_shell_cmd
62
78
  copy_process.io.stdin << "cat > #{remote_dest_path}\n"
63
79
  copy_process.io.stdin.flush
64
80
  open(source_path, "rb") do |f|
@@ -73,15 +89,32 @@ module Kameleon
73
89
  end
74
90
 
75
91
  def init_shell_cmd
92
+ ## log shell error message
93
+ error = read_io(@stderr)
94
+ init_stdout = read_io(@stdout)
95
+ @logger.error(error) unless error.empty?
96
+ @logger.info(init_stdout) unless init_stdout.empty?
76
97
  bashrc_content = ""
77
98
  if File.file?(@default_bashrc_file)
78
99
  tpl = ERB.new(File.read(@default_bashrc_file))
79
100
  bashrc_content = tpl.result(binding)
80
101
  end
81
102
  bashrc = Shellwords.escape(bashrc_content)
103
+ if @shell_workdir
104
+ unless @shell_workdir.eql? "/"
105
+ change_dir_cmd = "mkdir -p #{@shell_workdir} &&"
106
+ end
107
+ change_dir_cmd = "#{change_dir_cmd} cd #{@shell_workdir}"
108
+ change_dir_cmd = Shellwords.escape(change_dir_cmd)
109
+ end
82
110
  shell_cmd = "mkdir -p $(dirname #{@bashrc_file})\n"
83
111
  shell_cmd << "echo #{bashrc} > #{@bashrc_file}\n"
112
+ shell_cmd << "echo #{bashrc} > #{@bashrc_file}\n"
113
+ unless change_dir_cmd.nil?
114
+ shell_cmd << "echo #{change_dir_cmd} >> #{@bashrc_file}\n"
115
+ end
84
116
  shell_cmd << "source #{@bashrc_file}\n"
117
+ shell_cmd << "export KAMELEON_WORKDIR=$PWD\n"
85
118
  shell_cmd
86
119
  end
87
120
 
@@ -167,7 +200,8 @@ module Kameleon
167
200
  end
168
201
 
169
202
  def fork_and_wait
170
- system(@shell_cmd)
203
+ process, _, _ = fork("inherit")
204
+ process.wait()
171
205
  end
172
206
 
173
207
  protected
@@ -214,6 +248,7 @@ module Kameleon
214
248
  def fork(io)
215
249
  command = ["bash", "-c", @shell_cmd]
216
250
  @logger.notice("Starting process: #{@cmd.inspect}")
251
+ @logger.debug("Starting shell process: #{ command.inspect}")
217
252
  ChildProcess.posix_spawn = true
218
253
  process = ChildProcess.build(*command)
219
254
  # Create the pipes so we can read the output in real time as
@@ -0,0 +1,11 @@
1
+ *.gem
2
+ .bundle
3
+ .kitchen/
4
+ .kitchen.local.yml
5
+ vendor/bundle
6
+ pkg/*
7
+ .vagrant
8
+ bin/*
9
+ files/**/cache/
10
+ vendor/cookbooks
11
+ *.out
@@ -0,0 +1,25 @@
1
+ driver:
2
+ name: vagrant
3
+ customize:
4
+ cpus: 2
5
+ memory: 2048
6
+ synced_folders:
7
+ - ['../../..', '/home/vagrant/kameleon']
8
+ - ['../../../pkg/%{instance_name}', '/var/cache/omnibus/pkg', 'create: true']
9
+
10
+ provisioner:
11
+ require_chef_omnibus: 11.8.0
12
+
13
+ platforms:
14
+ - name: ubuntu-12.04
15
+ run_list: apt::default
16
+ - name: centos-5.10
17
+
18
+ suites:
19
+ - name: default
20
+ run_list: omnibus::default
21
+ attributes:
22
+ omnibus:
23
+ build_user: vagrant
24
+ build_dir: /home/vagrant/kameleon
25
+ install_dir: /opt/kameleon
data/omnibus/Berksfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://api.berkshelf.com'
2
+
3
+ # The apt cookbook is required to bring the apt cache up-to-date on Ubuntu
4
+ # systems, since the cache can become stale on older boxes.
5
+ cookbook 'apt', '~> 2.0'
6
+
7
+ # cookbook 'omnibus'
8
+ # Uncomment to use the latest version of the Omnibus cookbook from GitHub
9
+ cookbook 'omnibus', github: 'opscode-cookbooks/omnibus'
@@ -0,0 +1,25 @@
1
+ DEPENDENCIES
2
+ apt (~> 2.0)
3
+ omnibus
4
+ git: git://github.com/opscode-cookbooks/omnibus.git
5
+ branch: master
6
+
7
+ GRAPH
8
+ 7-zip (1.0.2)
9
+ windows (>= 1.2.2)
10
+ apt (2.3.8)
11
+ build-essential (2.0.0)
12
+ chef-sugar (1.2.8)
13
+ chef_handler (1.1.5)
14
+ homebrew (1.5.4)
15
+ omnibus (1.2.5)
16
+ 7-zip (~> 1.0)
17
+ build-essential (~> 2.0)
18
+ chef-sugar (~> 1.1)
19
+ homebrew (~> 1.5)
20
+ windows (~> 1.30)
21
+ wix (~> 1.1)
22
+ windows (1.30.2)
23
+ chef_handler (>= 0.0.0)
24
+ wix (1.1.0)
25
+ windows (>= 1.2.2)
data/omnibus/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Use Berkshelf for resolving cookbook dependencies
4
+ gem 'berkshelf', '~> 3.0.0.beta'
5
+
6
+ # Install omnibus software
7
+ gem 'omnibus', '~> 3.0'
8
+ gem 'omnibus-software', github: 'opscode/omnibus-software'
9
+
10
+ # Use Test Kitchen with Vagrant for convering the build environment
11
+ gem 'test-kitchen', '~> 1.2'
12
+ gem 'kitchen-vagrant', '~> 0.14'
data/omnibus/README.md ADDED
@@ -0,0 +1,94 @@
1
+ kameleon Omnibus project
2
+ ========================
3
+ This project creates full-stack platform-specific packages for
4
+ `kameleon`!
5
+
6
+ Installation
7
+ ------------
8
+ You must have a sane Ruby 1.9+ environment with Bundler installed. Ensure all
9
+ the required gems are installed:
10
+
11
+ ```shell
12
+ $ bundle install --binstubs
13
+ ```
14
+
15
+ Usage
16
+ -----
17
+ ### Build
18
+
19
+ You create a platform-specific package using the `build project` command:
20
+
21
+ ```shell
22
+ $ bin/omnibus build project kameleon
23
+ ```
24
+
25
+ The platform/architecture type of the package created will match the platform
26
+ where the `build project` command is invoked. For example, running this command
27
+ on a MacBook Pro will generate a Mac OS X package. After the build completes
28
+ packages will be available in the `pkg/` folder.
29
+
30
+ ### Clean
31
+
32
+ You can clean up all temporary files generated during the build process with
33
+ the `clean` command:
34
+
35
+ ```shell
36
+ $ bin/omnibus clean
37
+ ```
38
+
39
+ Adding the `--purge` purge option removes __ALL__ files generated during the
40
+ build including the project install directory (`/opt/kameleon`) and
41
+ the package cache directory (`/var/cache/omnibus/pkg`):
42
+
43
+ ```shell
44
+ $ bin/omnibus clean --purge
45
+ ```
46
+
47
+ ### Help
48
+
49
+ Full help for the Omnibus command line interface can be accessed with the
50
+ `help` command:
51
+
52
+ ```shell
53
+ $ bin/omnibus help
54
+ ```
55
+
56
+ Kitchen-based Build Environment
57
+ -------------------------------
58
+ Every Omnibus project ships will a project-specific
59
+ [Berksfile](http://berkshelf.com/) and [Vagrantfile](http://www.vagrantup.com/)
60
+ that will allow you to build your omnibus projects on all of the projects listed
61
+ in the `.kitchen.yml`. You can add/remove additional platforms as needed by
62
+ changing the list found in the `.kitchen.yml` `platforms` YAML stanza.
63
+
64
+ This build environment is designed to get you up-and-running quickly. However,
65
+ there is nothing that restricts you to building on other platforms. Simply use
66
+ the [omnibus cookbook](https://github.com/opscode-cookbooks/omnibus) to setup
67
+ your desired platform and execute the build steps listed above.
68
+
69
+ The default build environment requires Test Kitchen and VirtualBox for local
70
+ development. Test Kitchen also exposes the ability to provision instances using
71
+ various cloud providers like AWS, DigitalOcean, or OpenStack. For more
72
+ information, please see the [Test Kitchen documentation](http://kitchen.ci).
73
+
74
+ Once you have tweaked your `.kitchen.yml` (or `.kitchen.local.yml`) to your
75
+ liking, you can bring up an individual build environment using the `kitchen`
76
+ command.
77
+
78
+ ```shell
79
+ $ bundle exec kitchen converge ubuntu-12.04
80
+ ```
81
+
82
+ Then login to the instance and build the project as described in the Usage
83
+ section:
84
+
85
+ ```shell
86
+ $ bundle exec kitchen login ubuntu-12.04
87
+ [vagrant@ubuntu...] $ cd kameleon
88
+ [vagrant@ubuntu...] $ bundle install
89
+ [vagrant@ubuntu...] $ ...
90
+ [vagrant@ubuntu...] $ ./bin/omnibus build project kameleon
91
+ ```
92
+
93
+ For a complete list of all commands and platforms, run `kitchen list` or
94
+ `kitchen help`.
@@ -0,0 +1,23 @@
1
+
2
+ name 'kameleon'
3
+ maintainer 'Oar Team'
4
+ homepage 'http://kameleon.readthedocs.org'
5
+
6
+ replaces 'kameleon'
7
+ install_path '/opt/kameleon'
8
+ build_version Omnibus::BuildVersion.new.semver
9
+ build_iteration 1
10
+
11
+ # creates required build directories
12
+ dependency 'preparation'
13
+
14
+ # kameleon dependencies/components
15
+ dependency "polipo"
16
+ dependency "kameleon"
17
+
18
+ # version manifest file
19
+ dependency "version-manifest"
20
+
21
+
22
+ exclude '\.git*'
23
+ exclude 'bundler\/git'
@@ -0,0 +1,24 @@
1
+ # This is an example software definition for a Ruby project.
2
+ #
3
+ # Lots of software definitions for popular open source software
4
+ # already exist in `opscode-omnibus`:
5
+ #
6
+ # https://github.com/opscode/omnibus-software/tree/master/config/software
7
+ #
8
+ name "kameleon"
9
+ default_version "2.0.0"
10
+
11
+ dependency "ruby"
12
+ dependency "bundler"
13
+ dependency "rsync"
14
+
15
+ source :git => "git://github.com/oar-team/kameleon.git"
16
+
17
+ relative_path "kameleon"
18
+
19
+ build do
20
+ command "git checkout #{default_version}"
21
+ bundle "install --path=#{install_dir}/embedded/service/gem"
22
+ command "mkdir -p #{install_dir}/embedded/service/kameleon"
23
+ command "#{install_dir}/embedded/bin/rsync -a --delete --exclude=.git/*** --exclude=.gitignore ./ #{install_dir}/embedded/service/kameleon/"
24
+ end
@@ -0,0 +1,30 @@
1
+ # This is an example software definition for a C project.
2
+ #
3
+ # Lots of software definitions for popular open source software
4
+ # already exist in `opscode-omnibus`:
5
+ #
6
+ # https://github.com/opscode/omnibus-software/tree/master/config/software
7
+ #
8
+ name "polipo"
9
+ default_version "1.0.3"
10
+
11
+
12
+ source :url => "http://freehaven.net/~chrisd/polipo/polipo-1.0.3.tar.gz",
13
+ :md5 => "a0b00ca01541cf77ff3d725c27cf68bb"
14
+
15
+ relative_path 'polipo-1.0.3'
16
+
17
+ prefix="#{install_dir}/embedded"
18
+ libdir="#{prefix}/lib"
19
+
20
+ env = {
21
+ "LDFLAGS" => "-L#{libdir} -I#{prefix}/include",
22
+ "CFLAGS" => "-L#{libdir} -I#{prefix}/include -fPIC",
23
+ "LD_RUN_PATH" => libdir
24
+ }
25
+
26
+ build do
27
+ command "sed -i 's/^LOCAL_ROOT = \/usr\/share\/polipo\/www/LOCAL_ROOT = \$\(PREFIX\)\/usr\/share\/polipo\/www/g' Makefile"
28
+ command "make -j #{max_build_jobs} PREFIX=#{prefix} all", :env => env
29
+ command "make -j #{max_build_jobs} PREFIX=#{prefix} install", :env => env
30
+ end
@@ -0,0 +1,158 @@
1
+ #
2
+ # Copyright:: Copyright (c) 2012-2014 Chef Software, Inc.
3
+ # License:: Apache License, Version 2.0
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
+ name "ruby"
19
+ default_version "1.9.3-p484"
20
+
21
+ dependency "zlib"
22
+ dependency "ncurses"
23
+ dependency "libedit"
24
+ dependency "openssl"
25
+ dependency "libyaml"
26
+ dependency "libiconv"
27
+ dependency "gdbm"
28
+ dependency "libgcc" if (platform == "solaris2" and Omnibus.config.solaris_compiler == "gcc")
29
+
30
+ version "1.9.3-p484" do
31
+ source md5: '8ac0dee72fe12d75c8b2d0ef5d0c2968'
32
+ end
33
+
34
+ source url: "http://cache.ruby-lang.org/pub/ruby/#{version.match(/^(\d+\.\d+)/)[0]}/ruby-#{version}.tar.gz"
35
+
36
+ relative_path "ruby-#{version}"
37
+
38
+ env =
39
+ case platform
40
+ when "mac_os_x"
41
+ {
42
+ # -Qunused-arguments suppresses "argument unused during compilation"
43
+ # warnings. These can be produced if you compile a program that doesn't
44
+ # link to anything in a path given with -Lextra-libs. Normally these
45
+ # would be harmless, except that autoconf treats any output to stderr as
46
+ # a failure when it makes a test program to check your CFLAGS (regardless
47
+ # of the actual exit code from the compiler).
48
+ "CFLAGS" => "-arch x86_64 -m64 -L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include -I#{install_dir}/embedded/include/ncurses -O3 -g -pipe -Qunused-arguments",
49
+ "LDFLAGS" => "-arch x86_64 -L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include -I#{install_dir}/embedded/include/ncurses"
50
+ }
51
+ when "solaris2"
52
+ {
53
+ "CFLAGS" => "-L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include -O3 -g -pipe",
54
+ "LDFLAGS" => "-R#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include -static-libgcc",
55
+ "LD_OPTIONS" => "-R#{install_dir}/embedded/lib"
56
+ }
57
+ when "aix"
58
+ {
59
+ # see http://www.ibm.com/developerworks/aix/library/au-gnu.html
60
+ #
61
+ # specifically:
62
+ #
63
+ # "To use AIX run-time linking, you should create the shared object
64
+ # using gcc -shared -Wl,-G and create executables using the library
65
+ # by adding the -Wl,-brtl option to the link line. Technically, you
66
+ # can leave off the -shared option, but it does no harm and reduces
67
+ # confusion."
68
+ #
69
+ # AIX also uses -Wl,-blibpath instead of -R or LD_RUN_PATH, but the
70
+ # option is not additive, so requires /usr/lib and /lib as well (there
71
+ # is a -bsvr4 option to allow ld to take an -R flag in addition
72
+ # to turning on -brtl, but it had other side effects I couldn't fix).
73
+ #
74
+ # If libraries linked with gcc -shared have symbol resolution failures
75
+ # then it may be useful to add -bexpfull to export all symbols.
76
+ #
77
+ # -O2 optimized away some configure test which caused ext libs to fail
78
+ #
79
+ # We also need prezl's M4 instead of picking up /usr/bin/m4 which
80
+ # barfs on ruby.
81
+ #
82
+ "CC" => "xlc -q64",
83
+ "CXX" => "xlC -q64",
84
+ "LD" => "ld -b64",
85
+ "CFLAGS" => "-q64 -O -qhot -I#{install_dir}/embedded/include",
86
+ "CXXFLAGS" => "-q64 -O -qhot -I#{install_dir}/embedded/include",
87
+ "LDFLAGS" => "-q64 -L#{install_dir}/embedded/lib -Wl,-brtl -Wl,-blibpath:#{install_dir}/embedded/lib:/usr/lib:/lib",
88
+ "OBJECT_MODE" => "64",
89
+ "ARFLAGS" => "-X64 cru",
90
+ "M4" => "/opt/freeware/bin/m4",
91
+ "warnflags" => "-qinfo=por"
92
+ }
93
+ else
94
+ {
95
+ "CFLAGS" => "-I#{install_dir}/embedded/include -O3 -g -pipe",
96
+ "LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib"
97
+ }
98
+ end
99
+
100
+ build do
101
+ configure_command = ["./configure",
102
+ "--prefix=#{install_dir}/embedded",
103
+ "--with-out-ext=fiddle,dbm",
104
+ "--enable-shared",
105
+ "--enable-libedit",
106
+ "--with-ext=psych",
107
+ "--disable-install-doc"]
108
+
109
+ case platform
110
+ when "aix"
111
+ patch :source => "ruby-aix-configure.patch", :plevel => 1
112
+ patch :source => "ruby_aix_1_9_3_448_ssl_EAGAIN.patch", :plevel => 1
113
+ # --with-opt-dir causes ruby to send bogus commands to the AIX linker
114
+ when "freebsd"
115
+ configure_command << "--without-execinfo"
116
+ configure_command << "--with-opt-dir=#{install_dir}/embedded"
117
+ when "smartos"
118
+ # Opscode patch - someara@opscode.com
119
+ # GCC 4.7.0 chokes on mismatched function types between OpenSSL 1.0.1c and Ruby 1.9.3-p286
120
+ patch :source => "ruby-openssl-1.0.1c.patch", :plevel => 1
121
+
122
+ # Patches taken from RVM.
123
+ # http://bugs.ruby-lang.org/issues/5384
124
+ # https://www.illumos.org/issues/1587
125
+ # https://github.com/wayneeseguin/rvm/issues/719
126
+ patch :source => "rvm-cflags.patch", :plevel => 1
127
+
128
+ # From RVM forum
129
+ # https://github.com/wayneeseguin/rvm/commit/86766534fcc26f4582f23842a4d3789707ce6b96
130
+ configure_command << "ac_cv_func_dl_iterate_phdr=no"
131
+ configure_command << "--with-opt-dir=#{install_dir}/embedded"
132
+ else
133
+ configure_command << "--with-opt-dir=#{install_dir}/embedded"
134
+ end
135
+
136
+ # @todo expose bundle_bust() in the DSL
137
+ env.merge!({
138
+ "RUBYOPT" => nil,
139
+ "BUNDLE_BIN_PATH" => nil,
140
+ "BUNDLE_GEMFILE" => nil,
141
+ "GEM_PATH" => nil,
142
+ "GEM_HOME" => nil
143
+ })
144
+
145
+ # @todo: move into omnibus-ruby
146
+ has_gmake = system("gmake --version")
147
+
148
+ if has_gmake
149
+ env.merge!({'MAKE' => 'gmake'})
150
+ make_binary = 'gmake'
151
+ else
152
+ make_binary = 'make'
153
+ end
154
+
155
+ command configure_command.join(" "), :env => env
156
+ command "#{make_binary} -j #{max_build_jobs}", :env => env
157
+ command "#{make_binary} -j #{max_build_jobs} install", :env => env
158
+ end