eycloud-helper-emerge 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/ChangeLog.md +0 -0
- data/Gemfile +3 -0
- data/README.md +64 -0
- data/Rakefile +2 -0
- data/definitions/enable_package.rb +20 -0
- data/definitions/package_use.rb +26 -0
- data/definitions/update_file.rb +36 -0
- data/eycloud-helper-emerge.gemspec +22 -0
- data/metadata.json +13 -0
- data/metadata.rb +7 -0
- metadata +73 -0
data/.gitignore
ADDED
data/ChangeLog.md
ADDED
File without changes
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# Emerge helpers for EY Cloud
|
2
|
+
|
3
|
+
This cookbook holds 2 definitions, one called enable_package and one called update_file. Between these two definitions it enables you to 'unmask' a package in Chef and then install an 'masked' version of said package.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
For example if you want to install Libxml 2.7.6 on AppCloud you would use the following as a recipe.
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
enable_package "dev-libs/libxml2" do
|
11
|
+
version "2.7.6"
|
12
|
+
end
|
13
|
+
|
14
|
+
package "dev-libs/libxml2" do
|
15
|
+
version "2.7.6"
|
16
|
+
action :install
|
17
|
+
end
|
18
|
+
```
|
19
|
+
|
20
|
+
There is also the following which will update `/etc/portage/package.unmask/local`
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
enable_package "x11-libs/#{package}" do
|
24
|
+
version node[:qt_webkit_version]
|
25
|
+
unmask true
|
26
|
+
end
|
27
|
+
```
|
28
|
+
|
29
|
+
Alternately, this example shows you how to modify the 'use_flags' that are used during package compilation too.
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
enable_package "dev-lang/ruby" do
|
33
|
+
version "1.8.7_p299"
|
34
|
+
end
|
35
|
+
|
36
|
+
package_use "dev-lang/ruby" do
|
37
|
+
flags "threads"
|
38
|
+
end
|
39
|
+
|
40
|
+
package "dev-lang/ruby" do
|
41
|
+
version "1.8.7_p299"
|
42
|
+
action :install
|
43
|
+
end
|
44
|
+
```
|
45
|
+
|
46
|
+
## Terminology
|
47
|
+
|
48
|
+
Gentoo uses the names 'mask' and 'unmask' terminology between stable and unstable. Typically this is done in /etc/make.conf with ACCEPT_KEYWORDS declaration for '~amd64' and '~x86'. However it can also be added to /etc/portage/package.keywords/local to 'unmask' packages individually.
|
49
|
+
|
50
|
+
## Installation
|
51
|
+
|
52
|
+
INSTALLATION HERE
|
53
|
+
|
54
|
+
## Contributing
|
55
|
+
|
56
|
+
1. Fork it
|
57
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
58
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
59
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
60
|
+
5. Create new Pull Request
|
61
|
+
|
62
|
+
## License
|
63
|
+
|
64
|
+
MIT LICENSE
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
define :enable_package, :version => nil do
|
2
|
+
name = params[:name]
|
3
|
+
version = params[:version]
|
4
|
+
full_name = name + ("-#{version}" if version)
|
5
|
+
unmask = params[:unmask] || false
|
6
|
+
|
7
|
+
update_file "local portage package.keywords" do
|
8
|
+
path "/etc/portage/package.keywords/local"
|
9
|
+
body "=#{full_name}"
|
10
|
+
not_if "grep '=#{full_name}' /etc/portage/package.keywords/local"
|
11
|
+
end
|
12
|
+
|
13
|
+
if unmask
|
14
|
+
update_file "local portage package.unmask" do
|
15
|
+
path "/etc/portage/package.unmask/local"
|
16
|
+
body "=#{full_name}"
|
17
|
+
not_if "grep '=#{full_name}' /etc/portage/package.keywords/local"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
define :package_use, :flags => nil do
|
2
|
+
name = params[:name]
|
3
|
+
flags = params[:flags]
|
4
|
+
full_name = name + (" #{flags}" if flags)
|
5
|
+
|
6
|
+
file "/etc/portage/package.use" do
|
7
|
+
action :delete
|
8
|
+
|
9
|
+
not_if "file -d /etc/portage/package.use"
|
10
|
+
end
|
11
|
+
|
12
|
+
directory "/etc/portage/package.use" do
|
13
|
+
action :create
|
14
|
+
end
|
15
|
+
|
16
|
+
execute "touch /etc/portage/package.use/local" do
|
17
|
+
action :run
|
18
|
+
not_if { FileTest.exists?("/etc/portage/package.use/local") }
|
19
|
+
end
|
20
|
+
|
21
|
+
update_file "local portage package.use" do
|
22
|
+
path "/etc/portage/package.use/local"
|
23
|
+
body full_name
|
24
|
+
not_if "grep '#{full_name}' /etc/portage/package.use/local"
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
define :update_file, :action => :append do
|
2
|
+
require 'tempfile'
|
3
|
+
|
4
|
+
filepath = params[:path] || params[:name]
|
5
|
+
|
6
|
+
file params[:name] do
|
7
|
+
backup params[:backup] if params[:backup]
|
8
|
+
group params[:group] if params[:group]
|
9
|
+
mode params[:mode] if params[:mode]
|
10
|
+
owner params[:owner] if params[:owner]
|
11
|
+
path filepath
|
12
|
+
end
|
13
|
+
|
14
|
+
case params[:action].to_sym
|
15
|
+
when :append, :rewrite
|
16
|
+
|
17
|
+
mode = params[:action].to_sym == :append ? 'a' : 'w'
|
18
|
+
|
19
|
+
ruby_block "#{params[:action]}-to-#{filepath}" do
|
20
|
+
block do
|
21
|
+
File.open(filepath, mode) do |f|
|
22
|
+
f.puts params[:body]
|
23
|
+
end
|
24
|
+
not_if(params[:not_if]) if params[:not_if]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
when :truncate
|
29
|
+
|
30
|
+
execute "truncate-#{filepath}" do
|
31
|
+
command "> #{filepath}"
|
32
|
+
not_if(params[:not_if]) if params[:not_if]
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
version = "0.1.0" # TODO get from metadata.json or .rb
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "eycloud-helper-emerge"
|
8
|
+
s.version = version
|
9
|
+
s.authors = ["Dr Nic Williams"]
|
10
|
+
s.email = ["drnicwilliams@gmail.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{Emerge recipe for EY Cloud} # TODO from metadata
|
13
|
+
s.description = %q{Emerge recipe for EY Cloud} # TODO from metadata long_description
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
|
20
|
+
# s.add_dependency("eycloud-helper-cronjobs")
|
21
|
+
s.add_development_dependency("rake")
|
22
|
+
end
|
data/metadata.json
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"name": "emerge",
|
3
|
+
"description": "Emerge recipe for EY Cloud",
|
4
|
+
"long_description": "",
|
5
|
+
"license": "MIT",
|
6
|
+
"maintainer": "Dr Nic Williams",
|
7
|
+
"maintainer_email": "drnicwilliams@gmail.com",
|
8
|
+
"version": "0.1.0",
|
9
|
+
"attributes": {
|
10
|
+
},
|
11
|
+
"dependencies": {
|
12
|
+
}
|
13
|
+
}
|
data/metadata.rb
ADDED
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: eycloud-helper-emerge
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Dr Nic Williams
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-03-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: &70326282899600 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70326282899600
|
25
|
+
description: Emerge recipe for EY Cloud
|
26
|
+
email:
|
27
|
+
- drnicwilliams@gmail.com
|
28
|
+
executables: []
|
29
|
+
extensions: []
|
30
|
+
extra_rdoc_files: []
|
31
|
+
files:
|
32
|
+
- .gitignore
|
33
|
+
- ChangeLog.md
|
34
|
+
- Gemfile
|
35
|
+
- README.md
|
36
|
+
- Rakefile
|
37
|
+
- definitions/enable_package.rb
|
38
|
+
- definitions/package_use.rb
|
39
|
+
- definitions/update_file.rb
|
40
|
+
- eycloud-helper-emerge.gemspec
|
41
|
+
- metadata.json
|
42
|
+
- metadata.rb
|
43
|
+
homepage: ''
|
44
|
+
licenses: []
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options: []
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
segments:
|
56
|
+
- 0
|
57
|
+
hash: -830720860235660342
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
segments:
|
65
|
+
- 0
|
66
|
+
hash: -830720860235660342
|
67
|
+
requirements: []
|
68
|
+
rubyforge_project:
|
69
|
+
rubygems_version: 1.8.17
|
70
|
+
signing_key:
|
71
|
+
specification_version: 3
|
72
|
+
summary: Emerge recipe for EY Cloud
|
73
|
+
test_files: []
|