vanagon 0.9.1 → 0.9.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66a9286e3d7f89a5d145e4a5745cbb4d08ac9276
4
- data.tar.gz: 6e1cf377bd79799c726e583bd8401d81fc8e1475
3
+ metadata.gz: 0c9f345fa7806fdbe0b1cf43676acd3549f10ff7
4
+ data.tar.gz: d8e6a4740b1a1e914d7b788b745caea008823204
5
5
  SHA512:
6
- metadata.gz: 594d72e7506ae70075e34a690981f144b4d332204ceeee433462aaa82ec9611baf12f3e516d9283598532d4bc150b097b1d2fd2491f3d566feddb024cfb1e0bc
7
- data.tar.gz: f2387a452a90af391f7cff1a5e498bb2322cc4ce8729b6fa26c6c43166173a0dd44285814bb1a2ab0009ec8d5b3b720e1b7dc7167a9f8707c2725689d3669fc1
6
+ metadata.gz: 69d1ff1c24e3c71daf49454fa9a3bcdaf5faeb4caf611c4859106828e0e4e91f18337bd41500a0a9a56693f48f7ccff49fedd585678210fc8ebe6d43768ca15a
7
+ data.tar.gz: 1dd4036ebfa52ec377234567a91c9e838e01e63a262b56d480646b89b0562296cd8e3ca9d64783565b0e1f13c940636c2e276da7b1561eb348aa4f7784c02fac
data/bin/render ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ load File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "vanagon.rb"))
3
+
4
+ optparse = Vanagon::OptParse.new(
5
+ "#{File.basename(__FILE__)} <project-name> <platform-name> [options]",
6
+ [:workdir, :configdir, :engine]
7
+ )
8
+ options = optparse.parse! ARGV
9
+
10
+ project = ARGV[0]
11
+ platforms = ARGV[1]
12
+ targets = ARGV[2]
13
+
14
+ if project.nil? or platforms.nil?
15
+ warn "project and platform are both required arguments."
16
+ puts optparse
17
+ exit 1
18
+ end
19
+
20
+ platform_list = platforms.split(',')
21
+ target_list = []
22
+
23
+ platform_list.zip(target_list).each do |pair|
24
+ platform, target = pair
25
+ artifact = Vanagon::Driver.new(platform, project, options.merge({ :target => target }))
26
+ artifact.render
27
+ end
@@ -13,9 +13,10 @@ class Vanagon
13
13
  attr_accessor :platform, :project, :target, :workdir, :verbose, :preserve
14
14
  attr_accessor :timeout, :retry_count
15
15
 
16
- def initialize(platform, project, options = { :configdir => nil, :target => nil, :engine => nil, :components => nil, :skipcheck => false, :verbose => false, :preserve => false, :only_build => nil }) # rubocop:disable Metrics/AbcSize
16
+ def initialize(platform, project, options = { workdir: nil, configdir: nil, target: nil, engine: nil, components: nil, skipcheck: false, verbose: false, preserve: false, only_build: nil }) # rubocop:disable Metrics/AbcSize
17
17
  @verbose = options[:verbose]
18
18
  @preserve = options[:preserve]
19
+ @workdir = options[:workdir] || Dir.mktmpdir
19
20
 
20
21
  @@configdir = options[:configdir] || File.join(Dir.pwd, "configs")
21
22
  components = options[:components] || []
@@ -111,7 +112,7 @@ class Vanagon
111
112
  if @project.version.nil? or @project.version.empty?
112
113
  raise Vanagon::Error, "Project requires a version set, all is lost."
113
114
  end
114
- @workdir = Dir.mktmpdir
115
+
115
116
  @engine.startup(@workdir)
116
117
 
117
118
  puts "Target is #{@engine.target}"
@@ -135,6 +136,17 @@ class Vanagon
135
136
  end
136
137
  end
137
138
 
139
+ def render
140
+ # Simple sanity check for the project
141
+ if @project.version.nil? or @project.version.empty?
142
+ raise Vanagon::Error, "Project requires a version set, all is lost."
143
+ end
144
+
145
+ puts "rendering Makefile"
146
+ retry_task { @project.fetch_sources(@workdir) }
147
+ @project.make_makefile(@workdir)
148
+ end
149
+
138
150
  def prepare(workdir = nil) # rubocop:disable Metrics/AbcSize
139
151
  @workdir = workdir ? FileUtils.mkdir_p(workdir).first : Dir.mktmpdir
140
152
  @engine.startup(@workdir)
@@ -2,16 +2,102 @@ require 'vanagon/platform/dsl'
2
2
 
3
3
  class Vanagon
4
4
  class Platform
5
- attr_accessor :make, :servicedir, :defaultdir, :provisioning, :num_cores
6
- attr_accessor :tar, :build_dependencies, :name, :vmpooler_template
7
- attr_accessor :abs_resource_name, :cflags, :ldflags, :settings
8
- attr_accessor :servicetype, :patch, :architecture, :codename, :os_name
9
- attr_accessor :os_version, :docker_image, :ssh_port, :rpmbuild, :install
10
- attr_accessor :platform_triple, :target_user, :package_type, :find, :sort
11
- attr_accessor :build_hosts, :copy, :cross_compiled, :aws_ami
12
- attr_accessor :aws_user_data, :aws_shutdown_behavior, :aws_key_name
13
- attr_accessor :aws_region, :aws_key, :aws_instance_type, :aws_vpc_id
14
- attr_accessor :aws_subnet_id, :output_dir
5
+ # Basic generic information related to a given instance of Platform.
6
+ # e.g. The name we call it, the platform triplet (name-version-arch), etc.
7
+ attr_accessor :name
8
+ attr_accessor :platform_triple
9
+ attr_accessor :architecture
10
+ attr_accessor :os_name
11
+ attr_accessor :os_version
12
+ attr_accessor :codename # this is Debian/Ubuntu specific
13
+
14
+ # The name of the sort of package type that a given platform expects,
15
+ # e.g. msi, rpm,
16
+ attr_accessor :package_type
17
+
18
+ # The name of the sort of init system that a given platform uses
19
+ attr_accessor :servicetype
20
+ # Where does a given platform expect to find init scripts/service files?
21
+ # e.g. /etc/init.d, /usr/lib/systemd/system
22
+ attr_accessor :servicedir
23
+ # Where does a given platform's init system expect to find
24
+ # something resembling 'defaults' files. Most likely to apply
25
+ # to Linux systems that use SysV-ish, upstart, or systemd init systems.
26
+ attr_accessor :defaultdir
27
+
28
+ # Each of these holds the path or name of the command in question,
29
+ # e.g. `copy = "/usr/local/bin/gcp"`, or `copy = "cp"
30
+ attr_accessor :copy
31
+ attr_accessor :find
32
+ attr_accessor :install
33
+ attr_accessor :make
34
+ attr_accessor :patch
35
+ attr_accessor :rpmbuild # This is RedHat/EL/Fedora/SLES specific
36
+ attr_accessor :sort
37
+ attr_accessor :tar
38
+
39
+ # Hold a string containing the values that a given platform
40
+ # should use when a Makefile is run - resolves to the CFLAGS
41
+ # and LDFLAGS variables. Should also be extended to support
42
+ # CXXFLAGS and CPPFLAGS ASAP.
43
+ attr_accessor :cflags
44
+ attr_accessor :ldflags
45
+
46
+ # Stores an Array of OpenStructs, each representing a complete
47
+ # command to be run to install external the needed toolchains
48
+ # and build dependencies for a given target platform.
49
+ attr_accessor :build_dependencies
50
+
51
+ # Stores the local path where retrieved artifacts will be saved.
52
+ attr_accessor :output_dir
53
+
54
+ # Username to use when connecting to a build target
55
+ attr_accessor :target_user
56
+
57
+ # Stores an Array of Strings, which will be passed
58
+ # in as a shell script as part of the provisioning step
59
+ # for a given build target
60
+ attr_accessor :provisioning
61
+
62
+ # Determines if a platform should be treated as
63
+ # cross-compiled or natively compiled.
64
+ attr_accessor :cross_compiled
65
+
66
+ # A string, containing the script that will be executed on
67
+ # the remote build target to determine how many CPU cores
68
+ # are available on that platform. Vanagon will use that count
69
+ # to determine how many build threads should be initialized
70
+ # for compilations.
71
+ attr_accessor :num_cores
72
+
73
+ # Generic engine
74
+ attr_accessor :ssh_port
75
+
76
+ # Hardware engine specific
77
+ attr_accessor :build_hosts
78
+
79
+ # Always-Be-Scheduling engine specific
80
+ attr_accessor :abs_resource_name
81
+
82
+ # VMpooler engine specific
83
+ attr_accessor :vmpooler_template
84
+
85
+ # Docker engine specific
86
+ attr_accessor :docker_image
87
+
88
+ # AWS engine specific
89
+ attr_accessor :aws_ami
90
+ attr_accessor :aws_user_data
91
+ attr_accessor :aws_shutdown_behavior
92
+ attr_accessor :aws_key_name
93
+ attr_accessor :aws_region
94
+ attr_accessor :aws_key
95
+ attr_accessor :aws_instance_type
96
+ attr_accessor :aws_vpc_id
97
+ attr_accessor :aws_subnet_id
98
+
99
+ # Freeform Hash of leftover settings
100
+ attr_accessor :settings
15
101
 
16
102
  # Platform names currently contain some information about the platform. Fields
17
103
  # within the name are delimited by the '-' character, and this regex can be used to
@@ -221,11 +307,22 @@ class Vanagon
221
307
  return !!@name.match(/^cisco-wrlinux-.*$/)
222
308
  end
223
309
 
224
- # Utility matcher to determine is the platform is an osx variety
310
+ # Utility matcher to determine if the platform is an osx variety
225
311
  #
312
+ # @deprecated Please use is_macos? instead
226
313
  # @return [true, false] true if it is an osx variety, false otherwise
227
314
  def is_osx?
228
- return !!@name.match(/^osx-.*$/)
315
+ warn "is_osx? is a deprecated method, please use #is_macos? instead."
316
+ is_macos?
317
+ end
318
+
319
+ # Utility matcher to determine if the platform is a macos or osx variety
320
+ # is_osx is a deprecated method that calls is_macos
321
+ # We still match for osx currently but this will change
322
+ #
323
+ # @return [true, false] true if it is a macos or osx variety, false otherwise
324
+ def is_macos?
325
+ !!(@name =~ /^macos-.*$/ || @name =~ /^osx-.*$/)
229
326
  end
230
327
 
231
328
  # Utility matcher to determine is the platform is a solaris variety
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.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-09 00:00:00.000000000 Z
11
+ date: 2017-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git
@@ -59,6 +59,7 @@ executables:
59
59
  - build
60
60
  - inspect
61
61
  - ship
62
+ - render
62
63
  - repo
63
64
  - devkit
64
65
  - build_host_info
@@ -71,6 +72,7 @@ files:
71
72
  - bin/build_host_info
72
73
  - bin/devkit
73
74
  - bin/inspect
75
+ - bin/render
74
76
  - bin/repo
75
77
  - bin/ship
76
78
  - lib/git/basic_submodules.rb
@@ -233,7 +235,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
233
235
  version: '0'
234
236
  requirements: []
235
237
  rubyforge_project:
236
- rubygems_version: 2.5.2
238
+ rubygems_version: 2.2.5
237
239
  signing_key:
238
240
  specification_version: 3
239
241
  summary: All of your packages will fit into this van with this one simple trick.