vanagon 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vanagon/component/source/http.rb +21 -17
- data/lib/vanagon/driver.rb +17 -7
- data/lib/vanagon/platform.rb +18 -1
- data/lib/vanagon/platform/dsl.rb +7 -0
- data/lib/vanagon/project/dsl.rb +7 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e69b827c87e42df5740b868926ede94d03ffe23
|
4
|
+
data.tar.gz: 48063c4f0fff9db3c8c40b8eaf55930d930ff516
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba1e2146ea55742e934e53b59807042e569a048d9a8f215f7ee3acbeb9026772659d836cefb0ffb15924c13085c2a676cfe25b3d41200c92826d34cda7b46b70
|
7
|
+
data.tar.gz: dc76822ffe4ea4bcf888ead30e16de669ea021211a6b0fe9d11bbda772f2f35887947a4e3e932f994ffd97e0ec8d62bc00eded1fe02362c852bf5cb0fc2566b1
|
@@ -30,7 +30,7 @@ class Vanagon
|
|
30
30
|
# Download the source from the url specified. Sets the full path to the
|
31
31
|
# file as @file and the @extension for the file as a side effect.
|
32
32
|
def fetch
|
33
|
-
@file = download
|
33
|
+
@file = download(@url)
|
34
34
|
@extension = get_extension
|
35
35
|
end
|
36
36
|
|
@@ -46,26 +46,30 @@ class Vanagon
|
|
46
46
|
end
|
47
47
|
|
48
48
|
# Downloads the file from @url into the @workdir
|
49
|
-
#
|
49
|
+
# @param target_url [String, URI, Addressable::URI] url of an http source to retrieve with GET
|
50
50
|
# @raise [RuntimeError, Vanagon::Error] an exception is raised if the URI scheme cannot be handled
|
51
|
-
def download
|
52
|
-
uri = URI.parse(
|
53
|
-
target_file
|
54
|
-
puts "Downloading file '#{target_file}' from url '#{@url}'"
|
55
|
-
case uri.scheme
|
56
|
-
when 'http', 'https'
|
57
|
-
Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
|
58
|
-
request = Net::HTTP::Get.new(uri)
|
51
|
+
def download(target_url, target_file = nil)
|
52
|
+
uri = URI.parse(target_url.to_s)
|
53
|
+
target_file ||= File.basename(uri.path)
|
59
54
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
55
|
+
puts "Downloading file '#{target_file}' from url '#{target_url}'"
|
56
|
+
|
57
|
+
Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
|
58
|
+
http.request(Net::HTTP::Get.new(uri)) do |response|
|
59
|
+
case response
|
60
|
+
when Net::HTTPRedirection
|
61
|
+
# By parsing the location header, we get either an absolute
|
62
|
+
# URI or a URI with a relative `path`. Adding it to `uri`
|
63
|
+
# should correctly update the relative `path` or overwrite
|
64
|
+
# the entire URI if it's absolute.
|
65
|
+
location = URI.parse(response.header['location'])
|
66
|
+
download(uri + location, target_file)
|
67
|
+
when Net::HTTPSuccess
|
64
68
|
open(File.join(@workdir, target_file), 'w') do |io|
|
65
|
-
response.read_body
|
66
|
-
io.write(chunk)
|
67
|
-
end
|
69
|
+
response.read_body { |chunk| io.write(chunk) }
|
68
70
|
end
|
71
|
+
else
|
72
|
+
fail "Error: #{response.code.to_s}. Unable to get source from #{target_url}"
|
69
73
|
end
|
70
74
|
end
|
71
75
|
end
|
data/lib/vanagon/driver.rb
CHANGED
@@ -27,17 +27,27 @@ class Vanagon
|
|
27
27
|
@project.settings[:skipcheck] = options[:skipcheck]
|
28
28
|
loginit('vanagon_hosts.log')
|
29
29
|
|
30
|
-
|
31
|
-
engine = 'base' if target
|
32
|
-
# Hardware has explicit teardown to unlock the node
|
33
|
-
engine = 'hardware' if @platform.build_hosts
|
34
|
-
require "vanagon/engine/#{engine}"
|
35
|
-
@engine = Object.const_get("Vanagon::Engine::#{engine.capitalize}").new(@platform, target)
|
36
|
-
|
30
|
+
load_engine(engine, @platform, target)
|
37
31
|
rescue LoadError => e
|
38
32
|
raise Vanagon::Error.wrap(e, "Could not load the desired engine '#{engine}'")
|
39
33
|
end
|
40
34
|
|
35
|
+
def load_engine(engine_type, platform, target)
|
36
|
+
if platform.build_hosts
|
37
|
+
engine_type = 'hardware'
|
38
|
+
elsif target
|
39
|
+
engine_type = 'base'
|
40
|
+
end
|
41
|
+
load_engine_object(engine_type, platform, target)
|
42
|
+
end
|
43
|
+
|
44
|
+
def load_engine_object(engine_type, platform, target)
|
45
|
+
require "vanagon/engine/#{engine_type}"
|
46
|
+
@engine = Object::const_get("Vanagon::Engine::#{engine_type.capitalize}").new(platform, target)
|
47
|
+
rescue
|
48
|
+
fail "No such engine '#{engine_type.capitalize}'"
|
49
|
+
end
|
50
|
+
|
41
51
|
def cleanup_workdir
|
42
52
|
FileUtils.rm_rf(@workdir)
|
43
53
|
end
|
data/lib/vanagon/platform.rb
CHANGED
@@ -6,7 +6,7 @@ class Vanagon
|
|
6
6
|
attr_accessor :build_dependencies, :name, :vmpooler_template, :cflags, :ldflags, :settings
|
7
7
|
attr_accessor :servicetype, :patch, :architecture, :codename, :os_name, :os_version
|
8
8
|
attr_accessor :docker_image, :ssh_port, :rpmbuild, :install, :platform_triple
|
9
|
-
attr_accessor :target_user, :package_type, :find, :sort, :build_hosts, :copy
|
9
|
+
attr_accessor :target_user, :package_type, :find, :sort, :build_hosts, :copy, :cross_compiled
|
10
10
|
|
11
11
|
# Platform names currently contain some information about the platform. Fields
|
12
12
|
# within the name are delimited by the '-' character, and this regex can be used to
|
@@ -105,6 +105,7 @@ class Vanagon
|
|
105
105
|
@find ||= "find"
|
106
106
|
@sort ||= "sort"
|
107
107
|
@copy ||= "cp"
|
108
|
+
@cross_compiled ||= false
|
108
109
|
end
|
109
110
|
|
110
111
|
# This allows instance variables to be accessed using the hash lookup syntax
|
@@ -239,5 +240,21 @@ class Vanagon
|
|
239
240
|
def is_linux?
|
240
241
|
return (!is_windows? && !is_unix?)
|
241
242
|
end
|
243
|
+
|
244
|
+
# Utility matcher to determine if the platform is a cross-compiled variety
|
245
|
+
#
|
246
|
+
# @return [true, false] true if it is a cross-compiled variety, false otherwise
|
247
|
+
def is_cross_compiled?
|
248
|
+
return @cross_compiled
|
249
|
+
end
|
250
|
+
|
251
|
+
# Utility matcher to determine if the platform is a cross-compiled Linux variety.
|
252
|
+
# Many of the customizations needed to cross-compile for Linux are similar, so it's
|
253
|
+
# useful to group them together vs. other cross-compiled OSes.
|
254
|
+
#
|
255
|
+
# @return [true, false] true if it is a cross-compiled Linux variety, false otherwise
|
256
|
+
def is_cross_compiled_linux?
|
257
|
+
return (is_cross_compiled? && is_linux?)
|
258
|
+
end
|
242
259
|
end
|
243
260
|
end
|
data/lib/vanagon/platform/dsl.rb
CHANGED
@@ -121,6 +121,13 @@ class Vanagon
|
|
121
121
|
@platform.copy = copy_cmd
|
122
122
|
end
|
123
123
|
|
124
|
+
# Set the cross_compiled flag for the platform
|
125
|
+
#
|
126
|
+
# @param cxx_flag [Boolean] True if this is a cross-compiled platform
|
127
|
+
def cross_compiled(cxx_flag)
|
128
|
+
@platform.cross_compiled = cxx_flag
|
129
|
+
end
|
130
|
+
|
124
131
|
# Set the path to rpmbuild for the platform
|
125
132
|
#
|
126
133
|
# @param rpmbuild_cmd [String] Full path to rpmbuild with arguments to be used by default
|
data/lib/vanagon/project/dsl.rb
CHANGED
@@ -85,6 +85,13 @@ class Vanagon
|
|
85
85
|
@project.homepage = page
|
86
86
|
end
|
87
87
|
|
88
|
+
# Sets the timeout for the project retry logic
|
89
|
+
#
|
90
|
+
# @param page [Integer] timeout in seconds
|
91
|
+
def timeout(to)
|
92
|
+
@project.timeout = to
|
93
|
+
end
|
94
|
+
|
88
95
|
# Sets the run time requirements for the project. Mainly for use in packaging.
|
89
96
|
#
|
90
97
|
# @param req [String] of requirements of the project
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vanagon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -203,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
203
|
version: '0'
|
204
204
|
requirements: []
|
205
205
|
rubyforge_project:
|
206
|
-
rubygems_version: 2.
|
206
|
+
rubygems_version: 2.4.6
|
207
207
|
signing_key:
|
208
208
|
specification_version: 3
|
209
209
|
summary: All of your packages will fit into this van with this one simple trick.
|