kameleon-builder 2.6.3 → 2.6.5
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.
- checksums.yaml +4 -4
- data/.bumpversion.cfg +1 -1
- data/CHANGES +18 -0
- data/contrib/proxy_env.sh +12 -0
- data/lib/kameleon/cli.rb +9 -2
- data/lib/kameleon/context.rb +2 -2
- data/lib/kameleon/engine.rb +29 -12
- data/lib/kameleon/persistent_cache.rb +13 -9
- data/lib/kameleon/recipe.rb +5 -2
- data/lib/kameleon/shell.rb +6 -9
- data/lib/kameleon/utils.rb +2 -2
- data/version.txt +1 -1
- metadata +3 -3
- data/contrib/polipo_env.sh +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cf98d0c4404c2d7b78eb2ce549dd869d66e32ae
|
4
|
+
data.tar.gz: fb49b1ec019fa7e9473c5c3429e49590bf3dec9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e20e9e4bba49152c18a5b61c899f8a304b6837e1b53beca6d846131dd723e66ad92fcc675ad6ddfa029ea0d34aaebba57086e6c8462f35289fa3289a94396f5
|
7
|
+
data.tar.gz: a3b86f4a410c6219ed77e6155a20a58d09629f844b648add40d850f7e19292bd5f31f33f15c0901913c9be6fbc74632c720627976f2ab302d6ca5eb64779fda2
|
data/.bumpversion.cfg
CHANGED
data/CHANGES
CHANGED
@@ -1,6 +1,24 @@
|
|
1
1
|
Kameleon CHANGELOG
|
2
2
|
==================
|
3
3
|
|
4
|
+
Version 2.6.5
|
5
|
+
-------------
|
6
|
+
|
7
|
+
Released on September 14th 2015
|
8
|
+
|
9
|
+
- Fixed the proxy-cache to allow big files
|
10
|
+
- Added ``--proxy`` and ``--proxy-credentials`` options to set a global proxy for kameleon
|
11
|
+
- Added ``proxy_local``, ``proxy_out`` and ``proxy_in`` kameleon recipe variables to get proxy address from recipe
|
12
|
+
- Enabled ERB templating in the user environement files
|
13
|
+
- Renamed ``--proxy-path`` option to ``--polipo-path``
|
14
|
+
|
15
|
+
Version 2.6.4
|
16
|
+
-------------
|
17
|
+
|
18
|
+
Released on September 07th 2015
|
19
|
+
|
20
|
+
- Fixed kameleon data variables resolution
|
21
|
+
|
4
22
|
Version 2.6.3
|
5
23
|
-------------
|
6
24
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
export http_proxy="http://<%= @proxy %>"
|
2
|
+
export https_proxy="http://<%= @proxy %>"
|
3
|
+
export ftp_proxy="http://<%= @proxy %>"
|
4
|
+
export rsync_proxy="http://<%= @proxy %>"
|
5
|
+
export all_proxy="http://<%= @proxy %>"
|
6
|
+
export HTTP_PROXY="http://<%= @proxy %>"
|
7
|
+
export HTTPS_PROXY="http://<%= @proxy %>"
|
8
|
+
export FTP_PROXY="http://<%= @proxy %>"
|
9
|
+
export RSYNC_PROXY="http://<%= @proxy %>"
|
10
|
+
export ALL_PROXY="http://<%= @proxy %>"
|
11
|
+
export no_proxy="localhost,$(echo <%= @proxy %> | tr ":" "\n" | head -n 1),127.0.0.1,localaddress,.localdomain"
|
12
|
+
export NO_PROXY="$no_proxy"
|
data/lib/kameleon/cli.rb
CHANGED
@@ -224,9 +224,16 @@ module Kameleon
|
|
224
224
|
:enum => ["gzip", "xz", "bz2"],
|
225
225
|
:default => "gz",
|
226
226
|
:desc => "Uses a persistent cache tar file to build the image."
|
227
|
-
method_option :
|
227
|
+
method_option :polipo_path, :type => :string ,
|
228
228
|
:default => nil,
|
229
|
-
:desc => "Full path of the
|
229
|
+
:desc => "Full path of the polipo binary to use for the persistent cache."
|
230
|
+
method_option :proxy, :type => :string, :default => "",
|
231
|
+
:desc => "Specifies the hostname and port number of an HTTP " \
|
232
|
+
"proxy; it should have the form 'host:port'"
|
233
|
+
method_option :proxy_credentials, :type => :string, :default => "",
|
234
|
+
:desc => "Specifies the username and password if the parent "\
|
235
|
+
"proxy requires authorisation it should have the "\
|
236
|
+
"form 'username:password'"
|
230
237
|
method_option :global, :type => :hash,
|
231
238
|
:default => {}, :aliases => "-g",
|
232
239
|
:desc => "Set custom global variables."
|
data/lib/kameleon/context.rb
CHANGED
@@ -8,7 +8,7 @@ module Kameleon
|
|
8
8
|
attr_accessor :cmd
|
9
9
|
attr_accessor :workdir
|
10
10
|
attr_accessor :local_workdir
|
11
|
-
attr_accessor :
|
11
|
+
attr_accessor :proxy
|
12
12
|
attr_accessor :env_files
|
13
13
|
|
14
14
|
|
@@ -19,7 +19,7 @@ module Kameleon
|
|
19
19
|
@workdir = workdir
|
20
20
|
@exec_prefix = exec_prefix
|
21
21
|
@local_workdir = local_workdir
|
22
|
-
@
|
22
|
+
@proxy = kwargs[:proxy]
|
23
23
|
@fail_silently = kwargs.fetch(:fail_silently, true)
|
24
24
|
@lazyload = kwargs.fetch(:lazyload, false)
|
25
25
|
@env_files = env_files
|
data/lib/kameleon/engine.rb
CHANGED
@@ -32,12 +32,18 @@ module Kameleon
|
|
32
32
|
fail BuildError, "Checkpoint is unavailable for this recipe"
|
33
33
|
end
|
34
34
|
|
35
|
-
@recipe.resolve!
|
36
|
-
|
37
35
|
if @options[:enable_cache] || @options[:from_cache] then
|
36
|
+
if @recipe.global["in_context"]["proxy_cache"].nil? then
|
37
|
+
raise BuildError, "Missing varible for in context 'proxy_cache' when using the option --cache"
|
38
|
+
end
|
39
|
+
|
40
|
+
if @recipe.global["out_context"]["proxy_cache"].nil? then
|
41
|
+
raise BuildError, "Missing varible for out context 'proxy_cache' when using the option --cache"
|
42
|
+
end
|
38
43
|
@cache = Kameleon::Persistent_cache.instance
|
44
|
+
|
39
45
|
@cache.cwd = @cwd
|
40
|
-
@cache.polipo_path = @options[:
|
46
|
+
@cache.polipo_path = @options[:polipo_path]
|
41
47
|
@cache.name = @recipe.name
|
42
48
|
@cache.mode = @options[:enable_cache] ? :build : :from
|
43
49
|
@cache.cache_path = @options[:from_cache]
|
@@ -45,16 +51,27 @@ module Kameleon
|
|
45
51
|
@cache.recipe_files = @recipe.all_files
|
46
52
|
@cache.recipe_path = @recipe.path
|
47
53
|
@cache.archive_format = @options[:cache_archive_compression]
|
48
|
-
|
49
|
-
|
50
|
-
|
54
|
+
if @options[:proxy] != ""
|
55
|
+
@cache.polipo_cmd_options['parentProxy'] = @options[:proxy]
|
56
|
+
end
|
57
|
+
if @options[:proxy_credentials] != ""
|
58
|
+
@cache.polipo_cmd_options['parentAuthCredentials'] = @options[:proxy_credentials]
|
51
59
|
end
|
52
60
|
|
53
|
-
|
54
|
-
|
61
|
+
@recipe.global["proxy_local"] = "127.0.0.1:#{@cache.polipo_port}"
|
62
|
+
@recipe.global["proxy_out"] = "#{@recipe.global['out_context']['proxy_cache']}:#{@cache.polipo_port}"
|
63
|
+
@recipe.global["proxy_in"] = "#{@recipe.global['in_context']['proxy_cache']}:#{@cache.polipo_port}"
|
64
|
+
elsif @options[:proxy] != ""
|
65
|
+
if @options[:proxy_credentials] != ""
|
66
|
+
proxy_url = "#{@options[:proxy_credentials]}@#{@options[:proxy]}"
|
67
|
+
else
|
68
|
+
proxy_url = "#{@options[:proxy]}"
|
55
69
|
end
|
70
|
+
@recipe.global["proxy_local"] = @recipe.global["proxy_out"] = @recipe.global["proxy_in"] = proxy_url
|
56
71
|
end
|
57
72
|
|
73
|
+
@recipe.resolve!
|
74
|
+
|
58
75
|
begin
|
59
76
|
Kameleon.ui.info("Creating kameleon build directory : #{@cwd}")
|
60
77
|
FileUtils.mkdir_p @cwd
|
@@ -74,8 +91,8 @@ module Kameleon
|
|
74
91
|
Kameleon.ui.debug("Building local context [local]")
|
75
92
|
@local_context = Context.new("local", "bash", @cwd, "", @cwd,
|
76
93
|
@recipe.env_files,
|
77
|
-
:
|
78
|
-
:lazyload =>
|
94
|
+
:proxy => @recipe.global["proxy_local"],
|
95
|
+
:lazyload => lazyload,
|
79
96
|
:fail_silently => false)
|
80
97
|
Kameleon.ui.debug("Building external context [out]")
|
81
98
|
@out_context = Context.new("out",
|
@@ -84,7 +101,7 @@ module Kameleon
|
|
84
101
|
@recipe.global["out_context"]["exec_prefix"],
|
85
102
|
@cwd,
|
86
103
|
@recipe.env_files,
|
87
|
-
:
|
104
|
+
:proxy => @recipe.global["proxy_out"],
|
88
105
|
:lazyload => lazyload,
|
89
106
|
:fail_silently => fail_silently)
|
90
107
|
|
@@ -95,7 +112,7 @@ module Kameleon
|
|
95
112
|
@recipe.global["in_context"]["exec_prefix"],
|
96
113
|
@cwd,
|
97
114
|
@recipe.env_files,
|
98
|
-
:
|
115
|
+
:proxy => @recipe.global["proxy_in"],
|
99
116
|
:lazyload => lazyload,
|
100
117
|
:fail_silently => fail_silently)
|
101
118
|
end
|
@@ -8,7 +8,6 @@ module Kameleon
|
|
8
8
|
class Persistent_cache
|
9
9
|
|
10
10
|
include Singleton
|
11
|
-
attr_reader :polipo_env
|
12
11
|
attr_reader :cache_dir
|
13
12
|
attr_reader :polipo_port
|
14
13
|
attr_writer :activated
|
@@ -21,26 +20,27 @@ module Kameleon
|
|
21
20
|
attr_accessor :recipe_files # FIXME have to check those.
|
22
21
|
attr_accessor :recipe_path
|
23
22
|
attr_accessor :archive_format
|
23
|
+
attr_accessor :polipo_cmd_options
|
24
24
|
|
25
25
|
def initialize()
|
26
26
|
## we must configure Polipo to be execute for the in and out context
|
27
27
|
## we have to start polipo in the out context for debootstrap step
|
28
28
|
|
29
|
-
@polipo_env = File.join(Kameleon.source_root,
|
30
|
-
"contrib",
|
31
|
-
"polipo_env.sh")
|
32
|
-
|
33
29
|
@polipo_process = nil
|
34
30
|
@polipo_port = find_unused_port
|
35
31
|
|
32
|
+
# :idleTime => "1",
|
36
33
|
@polipo_cmd_options = {:diskCacheRoot => "",
|
37
|
-
:
|
38
|
-
:
|
34
|
+
:maxDiskCacheEntrySize => "-1",
|
35
|
+
:disableIndexing => "false",
|
36
|
+
:disableServersList => "false",
|
37
|
+
:allowedClients => "0.0.0.0/0",
|
39
38
|
:proxyPort => @polipo_port,
|
40
39
|
:relaxTransparency =>"true",
|
41
40
|
:daemonise => false,
|
42
41
|
:proxyAddress => "0.0.0.0",
|
43
|
-
:logFile => File.join(Kameleon.env.build_path, 'polipo.log')
|
42
|
+
:logFile => File.join(Kameleon.env.build_path, 'polipo.log'),
|
43
|
+
:logLevel => "4",
|
44
44
|
}
|
45
45
|
|
46
46
|
@activated = false
|
@@ -196,7 +196,11 @@ module Kameleon
|
|
196
196
|
end
|
197
197
|
|
198
198
|
def stop()
|
199
|
-
|
199
|
+
begin
|
200
|
+
@polipo_process.poll_for_exit(120)
|
201
|
+
rescue ChildProcess::TimeoutError
|
202
|
+
@polipo_process.stop # tries increasingly harsher methods to kill the process.
|
203
|
+
end
|
200
204
|
Kameleon.ui.info("Stopping web proxy polipo")
|
201
205
|
Kameleon.ui.info("Finishing persistent cache with last files")
|
202
206
|
cache_metadata_dir = File.join(@cache_dir,"metadata")
|
data/lib/kameleon/recipe.rb
CHANGED
@@ -33,8 +33,11 @@ module Kameleon
|
|
33
33
|
"kameleon_recipe_name" => @name,
|
34
34
|
"kameleon_recipe_dir" => File.dirname(@path),
|
35
35
|
"kameleon_cwd" => File.join(Kameleon.env.build_path, @name),
|
36
|
-
"in_context" => {"cmd" => "/bin/bash", "proxy_cache" => "
|
37
|
-
"out_context" => {"cmd" => "/bin/bash", "proxy_cache" => "
|
36
|
+
"in_context" => {"cmd" => "/bin/bash", "proxy_cache" => "127.0.0.1"},
|
37
|
+
"out_context" => {"cmd" => "/bin/bash", "proxy_cache" => "127.0.0.1"},
|
38
|
+
"proxy_local" => "",
|
39
|
+
"proxy_out" => "",
|
40
|
+
"proxy_in" => "",
|
38
41
|
}
|
39
42
|
@aliases = {}
|
40
43
|
@checkpoint = nil
|
data/lib/kameleon/shell.rb
CHANGED
@@ -17,7 +17,7 @@ module Kameleon
|
|
17
17
|
@context_name = context.name
|
18
18
|
@local_workdir = context.local_workdir
|
19
19
|
@shell_workdir = context.workdir
|
20
|
-
@
|
20
|
+
@proxy = context.proxy
|
21
21
|
@env_files = context.env_files
|
22
22
|
@bash_scripts_dir = File.join("kameleon_scripts", @context_name)
|
23
23
|
@bashrc_file = File.join(@bash_scripts_dir, "bash_rc")
|
@@ -103,13 +103,9 @@ module Kameleon
|
|
103
103
|
if File.file?(@default_bashrc_file)
|
104
104
|
tpl = ERB.new(File.read(@default_bashrc_file))
|
105
105
|
bashrc_content = tpl.result(binding)
|
106
|
-
if @
|
107
|
-
|
108
|
-
|
109
|
-
else
|
110
|
-
tpl = ERB.new(File.read(@cache.polipo_env))
|
111
|
-
bashrc_content << "\n" + ERB.new(File.read(@cache.polipo_env)).result(binding)
|
112
|
-
end
|
106
|
+
if @proxy != "" then
|
107
|
+
tpl = ERB.new(File.read(File.join(Kameleon.source_root, "contrib", "proxy_env.sh")))
|
108
|
+
bashrc_content << "\n" + tpl.result(binding)
|
113
109
|
end
|
114
110
|
end
|
115
111
|
# Inject sigint handler
|
@@ -136,11 +132,12 @@ SCRIPT
|
|
136
132
|
end
|
137
133
|
shell_cmd << "export KAMELEON_WORKDIR=$PWD\n"
|
138
134
|
@env_files.each do |env_file|
|
135
|
+
resolved_erb = "\n" + ERB.new(File.read(env_file)).result(binding)
|
139
136
|
env_content = <<-SCRIPT
|
140
137
|
#====================================================
|
141
138
|
# Begin content of user script '#{env_file.basename}'
|
142
139
|
#====================================================
|
143
|
-
#{
|
140
|
+
#{resolved_erb}
|
144
141
|
#====================================================
|
145
142
|
# End content of user script '#{env_file.basename}'
|
146
143
|
#====================================================
|
data/lib/kameleon/utils.rb
CHANGED
@@ -13,8 +13,8 @@ module Kameleon
|
|
13
13
|
matches.each do |m|
|
14
14
|
unless m.nil?
|
15
15
|
path = resolve_simple_vars(m[1], yaml_path, initial_variables, recipe, kwargs)
|
16
|
-
resolved_path = recipe.resolve_data_path(path, yaml_path)
|
17
|
-
raw.gsub!(m[0], "
|
16
|
+
resolved_path = recipe.resolve_data_path(path.chomp('"'), yaml_path)
|
17
|
+
raw.gsub!(m[0].chomp('"'), "#{resolved_path}")
|
18
18
|
end
|
19
19
|
end
|
20
20
|
return raw
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.6.
|
1
|
+
2.6.5
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kameleon-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Salem Harrache
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2015-
|
15
|
+
date: 2015-09-14 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: childprocess
|
@@ -97,7 +97,7 @@ files:
|
|
97
97
|
- contrib/kameleon_bashrc.sh
|
98
98
|
- contrib/kameleon_exec_cmd.sh
|
99
99
|
- contrib/kameleon_exec_cmd_wrapper.sh
|
100
|
-
- contrib/
|
100
|
+
- contrib/proxy_env.sh
|
101
101
|
- contrib/scripts/VirtualBox_deploy.sh
|
102
102
|
- contrib/scripts/chroot_env
|
103
103
|
- contrib/scripts/create_passwd.py
|
data/contrib/polipo_env.sh
DELETED