vanagon 0.14.3 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/bin/build +1 -1
  3. data/bin/build_host_info +1 -1
  4. data/bin/inspect +1 -1
  5. data/bin/render +1 -1
  6. data/bin/ship +1 -1
  7. data/lib/vanagon/component/dsl.rb +4 -4
  8. data/lib/vanagon/component/source/git.rb +7 -7
  9. data/lib/vanagon/component/source/http.rb +2 -2
  10. data/lib/vanagon/component/source/local.rb +4 -4
  11. data/lib/vanagon/component.rb +10 -10
  12. data/lib/vanagon/driver.rb +8 -8
  13. data/lib/vanagon/engine/base.rb +1 -1
  14. data/lib/vanagon/engine/docker.rb +1 -1
  15. data/lib/vanagon/engine/ec2.rb +5 -5
  16. data/lib/vanagon/engine/hardware.rb +3 -3
  17. data/lib/vanagon/engine/pooler.rb +3 -3
  18. data/lib/vanagon/environment.rb +4 -4
  19. data/lib/vanagon/platform/deb.rb +10 -1
  20. data/lib/vanagon/platform/dsl.rb +14 -0
  21. data/lib/vanagon/platform/osx.rb +1 -0
  22. data/lib/vanagon/platform/rpm/aix.rb +1 -0
  23. data/lib/vanagon/platform/rpm/wrl.rb +1 -1
  24. data/lib/vanagon/platform/rpm.rb +0 -3
  25. data/lib/vanagon/platform/solaris_10.rb +3 -2
  26. data/lib/vanagon/platform.rb +54 -10
  27. data/lib/vanagon/project/dsl.rb +1 -1
  28. data/lib/vanagon/project.rb +25 -7
  29. data/lib/vanagon/utilities.rb +4 -4
  30. data/lib/vanagon.rb +2 -2
  31. data/resources/Makefile.erb +2 -2
  32. data/resources/deb/control.erb +3 -3
  33. data/resources/rpm/project.spec.erb +18 -8
  34. data/spec/lib/vanagon/component/dsl_spec.rb +10 -0
  35. data/spec/lib/vanagon/platform/osx_spec.rb +21 -0
  36. data/spec/lib/vanagon/platform/rpm/aix_spec.rb +1 -1
  37. data/spec/lib/vanagon/platform/solaris_10_spec.rb +29 -0
  38. data/spec/lib/vanagon/project/dsl_spec.rb +164 -16
  39. metadata +6 -2
@@ -1,8 +1,18 @@
1
1
  require 'vanagon/environment'
2
2
  require 'vanagon/platform/dsl'
3
+ require 'vanagon/utilities'
3
4
 
4
5
  class Vanagon
5
6
  class Platform
7
+ # Rubocop complains about Style/MixinUsage:
8
+ # "include is used at the top level. Use inside class or module."
9
+ # Moving this include to this level passes spec tests -- any deeper than this,
10
+ # and spec tests collapse. I think an unfortunate number of platforms rely
11
+ # on these utilities without an explicit `require` and that's something we
12
+ # should refactor at some point.
13
+ # - Ryan McKern 2017-12-27
14
+ include Vanagon::Utilities
15
+
6
16
  # Basic generic information related to a given instance of Platform.
7
17
  # e.g. The name we call it, the platform triplet (name-version-arch), etc.
8
18
  attr_accessor :name
@@ -33,8 +43,10 @@ class Vanagon
33
43
  attr_accessor :find
34
44
  attr_accessor :install
35
45
  attr_accessor :make
46
+ attr_accessor :mktemp
36
47
  attr_accessor :patch
37
48
  attr_accessor :rpmbuild # This is RedHat/EL/Fedora/SLES specific
49
+ attr_accessor :sed
38
50
  attr_accessor :sort
39
51
  attr_accessor :tar
40
52
  attr_accessor :shasum
@@ -117,11 +129,15 @@ class Vanagon
117
129
  # Freeform Hash of leftover settings
118
130
  attr_accessor :settings
119
131
 
132
+ attr_accessor :valid_operators
133
+
120
134
  # Platform names currently contain some information about the platform. Fields
121
135
  # within the name are delimited by the '-' character, and this regex can be used to
122
136
  # extract those fields.
123
137
  PLATFORM_REGEX = /^(.*)-(.*)-(.*)$/
124
138
 
139
+ VERSION_REGEX = /^([=<>]+)\s*([^<>=]*)$/
140
+
125
141
  # Loads a given platform from the configdir
126
142
  #
127
143
  # @param name [String] the name of the platform
@@ -133,10 +149,10 @@ class Vanagon
133
149
  dsl = Vanagon::Platform::DSL.new(name)
134
150
  dsl.instance_eval(File.read(platfile), platfile, 1)
135
151
  dsl._platform
136
- rescue => e
137
- $stderr.puts "Error loading platform '#{name}' using '#{platfile}':"
138
- $stderr.puts e
139
- $stderr.puts e.backtrace.join("\n")
152
+ rescue StandardError => e
153
+ warn "Error loading platform '#{name}' using '#{platfile}':"
154
+ warn e
155
+ warn e.backtrace.join("\n")
140
156
  raise e
141
157
  end
142
158
 
@@ -212,17 +228,20 @@ class Vanagon
212
228
  @environment = Vanagon::Environment.new
213
229
  @provisioning = []
214
230
  @install ||= "install"
231
+ @mktemp ||= "mktemp -d -p /var/tmp"
215
232
  @target_user ||= "root"
216
233
  @find ||= "find"
234
+ @sed ||= "sed"
217
235
  @sort ||= "sort"
218
236
  @copy ||= "cp"
219
237
  @shasum ||= "sha1sum"
220
238
 
221
239
  # Our first attempt at defining metadata about a platform
222
240
  @cross_compiled ||= false
241
+ @valid_operators ||= ['<', '>', '<=', '>=', '=']
223
242
  end
224
243
 
225
- def shell
244
+ def shell # rubocop:disable Lint/DuplicateMethods
226
245
  @shell ||= "/bin/bash"
227
246
  end
228
247
 
@@ -239,7 +258,7 @@ class Vanagon
239
258
  # @param target_repo [String] optional repo target for built packages defined
240
259
  # at the project level
241
260
  # @return [String] relative path to where packages should be output to
242
- def output_dir(target_repo = "")
261
+ def output_dir(target_repo = "") # rubocop:disable Lint/DuplicateMethods
243
262
  @output_dir ||= File.join(@os_name, @os_version, target_repo, @architecture)
244
263
  end
245
264
 
@@ -250,7 +269,7 @@ class Vanagon
250
269
  # @param target_repo [String] optional repo target for built source packages
251
270
  # defined at the project level
252
271
  # @return [String] relative path to where source packages should be output to
253
- def source_output_dir(target_repo = "")
272
+ def source_output_dir(target_repo = "") # rubocop:disable Lint/DuplicateMethods
254
273
  @source_output_dir ||= output_dir(target_repo)
255
274
  end
256
275
 
@@ -267,7 +286,7 @@ class Vanagon
267
286
  # Also has the side effect of setting the @os_name instance attribute
268
287
  #
269
288
  # @return [String] the operating system name as specified in the platform
270
- def os_name
289
+ def os_name # rubocop:disable Lint/DuplicateMethods
271
290
  @os_name ||= @name.match(PLATFORM_REGEX)[1]
272
291
  end
273
292
 
@@ -275,7 +294,7 @@ class Vanagon
275
294
  # Also has the side effect of setting the @os_version instance attribute
276
295
  #
277
296
  # @return [String] the operating system version as specified in the platform
278
- def os_version
297
+ def os_version # rubocop:disable Lint/DuplicateMethods
279
298
  @os_version ||= @name.match(PLATFORM_REGEX)[2]
280
299
  end
281
300
 
@@ -283,7 +302,7 @@ class Vanagon
283
302
  # Also has the side effect of setting the @architecture instance attribute
284
303
  #
285
304
  # @return [String] the architecture of the platform
286
- def architecture
305
+ def architecture # rubocop:disable Lint/DuplicateMethods
287
306
  @architecture ||= @name.match(PLATFORM_REGEX)[3]
288
307
  end
289
308
 
@@ -472,5 +491,30 @@ class Vanagon
472
491
  provisioning << command
473
492
  provisioning.flatten!
474
493
  end
494
+
495
+ # version strings for dependencies, conflicts, replaces, etc need some munging
496
+ # based on platform.
497
+ #
498
+ # @param version_string operator(<,>,=,<=,>=) and version to be munged, like
499
+ # '<1.2.3'
500
+ # @param default [deprecated] default operator to use if version string doesn't
501
+ # contain an operator
502
+ def version_munger(version_string, default: '=')
503
+ match = version_string.match(VERSION_REGEX)
504
+
505
+ if match.nil?
506
+ warn "Passing a version without an operator is deprecated!"
507
+ operator = default
508
+ version = version_string
509
+ end
510
+ operator ||= match[1]
511
+ version ||= match[2]
512
+ fail "Operator '#{operator}' is invalid" unless validate_operator(operator)
513
+ "#{operator} #{version}"
514
+ end
515
+
516
+ def validate_operator(operator_string)
517
+ valid_operators.include?(operator_string)
518
+ end
475
519
  end
476
520
  end
@@ -251,7 +251,7 @@ class Vanagon
251
251
  #
252
252
  # @param name [String] name of component to add. must be present in configdir/components and named $name.rb currently
253
253
  def component(name)
254
- $stderr.puts "Loading #{name}" if @project.settings[:verbose]
254
+ warn "Loading #{name}" if @project.settings[:verbose]
255
255
  if @include_components.empty? or @include_components.include?(name)
256
256
  component = Vanagon::Component.load_component(name, File.join(Vanagon::Driver.configdir, "components"), @project.settings, @project.platform)
257
257
  @project.components << component
@@ -103,10 +103,10 @@ class Vanagon
103
103
  dsl = Vanagon::Project::DSL.new(name, platform, include_components)
104
104
  dsl.instance_eval(File.read(projfile), projfile, 1)
105
105
  dsl._project
106
- rescue => e
107
- $stderr.puts "Error loading project '#{name}' using '#{projfile}':"
108
- $stderr.puts e
109
- $stderr.puts e.backtrace.join("\n")
106
+ rescue StandardError => e
107
+ warn "Error loading project '#{name}' using '#{projfile}':"
108
+ warn e
109
+ warn e.backtrace.join("\n")
110
110
  raise e
111
111
  end
112
112
 
@@ -231,7 +231,13 @@ class Vanagon
231
231
  replaces = []
232
232
  replaces.push @replaces.flatten
233
233
  replaces.push components.flat_map(&:replaces)
234
- replaces.flatten.uniq
234
+ replaces.flatten!
235
+ replaces.each do |replace|
236
+ # TODO: Make this a more reasonable default before 1.0.0
237
+ # but in the interim, maintain the current behavior
238
+ replace.version = @platform.version_munger(replace.version, default: '<') if replace.version
239
+ end
240
+ replaces.uniq
235
241
  end
236
242
 
237
243
  def has_replaces?
@@ -242,7 +248,13 @@ class Vanagon
242
248
  def get_conflicts
243
249
  conflicts = components.flat_map(&:conflicts) + @conflicts
244
250
  # Mash the whole thing down into a flat Array
245
- conflicts.flatten.uniq
251
+ conflicts.flatten!
252
+ conflicts.each do |conflict|
253
+ # TODO: Make this a more reasonable default before 1.0.0
254
+ # but in the interim, maintain the current behavior
255
+ conflict.version = @platform.version_munger(conflict.version, default: '<') if conflict.version
256
+ end
257
+ conflicts.uniq
246
258
  end
247
259
 
248
260
  def has_conflicts?
@@ -272,7 +284,13 @@ class Vanagon
272
284
  provides = []
273
285
  provides.push @provides.flatten
274
286
  provides.push components.flat_map(&:provides)
275
- provides.flatten.uniq
287
+ provides.flatten!
288
+ provides.each do |provide|
289
+ # TODO: Make this a more reasonable default before 1.0.0
290
+ # but in the interim, maintain the current behavior
291
+ provide.version = @platform.version_munger(provide.version, default: '>=') if provide.version
292
+ end
293
+ provides.uniq
276
294
  end
277
295
 
278
296
  def has_provides?
@@ -139,7 +139,7 @@ class Vanagon
139
139
  begin
140
140
  yield
141
141
  return true
142
- rescue => e
142
+ rescue StandardError => e
143
143
  warn 'An error was encountered evaluating block. Retrying..'
144
144
  error = e
145
145
  end
@@ -213,7 +213,7 @@ class Vanagon
213
213
  # output of the command if return_command_output is true
214
214
  # @raise [RuntimeError] If there is no target given or the command fails an exception is raised
215
215
  def remote_ssh_command(target, command, port = 22, return_command_output: false)
216
- $stderr.puts "Executing '#{command}' on '#{target}'"
216
+ warn "Executing '#{command}' on '#{target}'"
217
217
  if return_command_output
218
218
  ret = %x(#{ssh_command(port)} -T #{target} '#{command.gsub("'", "'\\\\''")}').chomp
219
219
  if $CHILD_STATUS.success?
@@ -236,7 +236,7 @@ class Vanagon
236
236
  # @raise [RuntimeError] If the command fails an exception is raised
237
237
  def local_command(command, return_command_output: false)
238
238
  clean_environment do
239
- $stderr.puts "Executing '#{command}' locally"
239
+ warn "Executing '#{command}' locally"
240
240
  if return_command_output
241
241
  ret = %x(#{command}).chomp
242
242
  if $CHILD_STATUS.success?
@@ -280,7 +280,7 @@ class Vanagon
280
280
  outfile ||= File.join(Dir.mktmpdir, File.basename(erbfile).sub(File.extname(erbfile), ""))
281
281
  output = erb_string(erbfile, opts[:binding])
282
282
  File.open(outfile, 'w') { |f| f.write output }
283
- $stderr.puts "Generated: #{outfile}"
283
+ warn "Generated: #{outfile}"
284
284
  FileUtils.rm_rf erbfile if remove_orig
285
285
  outfile
286
286
  end
data/lib/vanagon.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'time'
2
2
 
3
- LIBDIR = File.expand_path(File.dirname(__FILE__))
4
- VANAGON_ROOT = File.join(File.expand_path(File.dirname(__FILE__)), "..")
3
+ LIBDIR = __dir__
4
+ VANAGON_ROOT = File.join(__dir__, "..")
5
5
  BUILD_TIME = Time.now.iso8601
6
6
  VANAGON_VERSION = Gem.loaded_specs["vanagon"].version.to_s
7
7
 
@@ -4,7 +4,7 @@ SHELL = <%= @platform.shell %>
4
4
  export <%= var %>
5
5
  <%- end -%>
6
6
 
7
- tempdir := $(shell mktemp -d -p /var/tmp 2>/dev/null || mktemp -d -t 'tmp')
7
+ tempdir := $(shell <%= @platform.mktemp %> 2>/dev/null)
8
8
  workdir := $(PWD)
9
9
 
10
10
  all: file-list-before-build <%= package_name %>
@@ -31,7 +31,7 @@ file-list-after-build: <%= @components.map {|comp| comp.name }.join(" ") %>
31
31
 
32
32
  file-list: file-list-before-build <%= @name %>-project
33
33
  comm -23 file-list-after-build file-list-before-build > file-list
34
- comm -23 file-list-after-build file-list-before-build | sed -e 's/\(^.*[[:space:]].*$$\)/"\1"/g' > file-list-for-rpm
34
+ comm -23 file-list-after-build file-list-before-build | <%= @platform.sed %> -e 's/\(^.*[[:space:]].*$$\)/"\1"/g' > file-list-for-rpm
35
35
 
36
36
  <%- if @version_file -%>
37
37
  <%= @version_file.path %>:
@@ -11,11 +11,11 @@ Architecture: <%= @noarch ? 'all' : 'any' %>
11
11
  Section: admin
12
12
  Priority: optional
13
13
  <%- unless get_replaces.empty? -%>
14
- Replaces: <%= get_replaces.map { |replace| "#{replace.replacement} #{replace.version ? "(<< #{replace.version})" : ""}" }.join(", ") %>
15
- Breaks: <%= get_replaces.map { |replace| "#{replace.replacement} #{replace.version ? "(<< #{replace.version})" : ""}" }.join(", ") %>
14
+ Replaces: <%= get_replaces.map { |replace| "#{replace.replacement} #{replace.version ? "(#{replace.version})" : ""}" }.join(", ") %>
15
+ Breaks: <%= get_replaces.map { |replace| "#{replace.replacement} #{replace.version ? "(#{replace.version})" : ""}" }.join(", ") %>
16
16
  <%- end -%>
17
17
  <%- unless get_conflicts.empty? -%>
18
- Conflicts: <%= get_conflicts.map { |conflict| "#{conflict.pkgname} #{conflict.version ? "(<< #{conflict.version})" : ""}" }.join(", ") %>
18
+ Conflicts: <%= get_conflicts.map { |conflict| "#{conflict.pkgname} #{conflict.version ? "(#{conflict.version})" : ""}" }.join(", ") %>
19
19
  <%- end -%>
20
20
  <%- unless get_requires.empty? -%>
21
21
  Depends: <%= get_requires.join(", ") %>
@@ -14,15 +14,25 @@
14
14
  /usr/lib64/rpm/brp-strip-static-archive %{__strip} \
15
15
  /usr/lib64/rpm/brp-strip-comment-note %{__strip} %{__objdump} \
16
16
  %{nil}
17
+ <%- elsif !@platform.is_aix? -%>
18
+ # enable more stripping. This was failing on cisco wrlinux and AIX. We may want
19
+ # to get this worked out eventually, but for now let's just skip these for
20
+ # those platforms
21
+ %global __debug_package %{nil}
22
+ # to resolve: "ERROR: No build ID note found"
23
+ %undefine _missing_build_ids_terminate_build
24
+ # To avoid files installed but not packaged errors
25
+ %global __os_install_post %{__os_install_post} \
26
+ rm -rf %{buildroot}/usr/lib/debug
17
27
  <%- end -%>
18
28
 
19
29
  # Turn off the brp-python-bytecompile script
20
- %global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
30
+ %global __os_install_post %(echo '%{__os_install_post}' | <%= @platform.sed %> -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
21
31
  <% if @platform.is_cross_compiled_linux? -%>
22
32
  # Disable brp-strip-static-archive, which on EL platforms causes
23
33
  # cross-compiled static libs to end up with "no machine" as their
24
34
  # architure, breaking builds:
25
- %global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-strip-static-archive[[:space:]].*$!!g')
35
+ %global __os_install_post %(echo '%{__os_install_post}' | <%= @platform.sed %> -e 's!/usr/lib[^[:space:]]*/brp-strip-static-archive[[:space:]].*$!!g')
26
36
  <% end -%>
27
37
 
28
38
  <% @package_overrides.each do |var| %>
@@ -86,15 +96,15 @@ Requires: chkconfig
86
96
  <%- end -%>
87
97
 
88
98
  <%- get_replaces.each do |replace| -%>
89
- Obsoletes: <%= replace.replacement %><%= replace.version ? " < #{replace.version}" : "" %>
99
+ Obsoletes: <%= replace.replacement %><%= replace.version ? " #{replace.version}" : "" %>
90
100
  <%- end -%>
91
101
 
92
102
  <%- get_conflicts.each do |conflict| -%>
93
- Conflicts: <%= conflict.pkgname %><%= conflict.version ? " < #{conflict.version}" : "" %>
103
+ Conflicts: <%= conflict.pkgname %><%= conflict.version ? " #{conflict.version}" : "" %>
94
104
  <%- end -%>
95
105
 
96
106
  <%- get_provides.each do |prov| -%>
97
- Provides: <%= prov.provide %><%= prov.version ? " >= #{prov.version}" : "" %>
107
+ Provides: <%= prov.provide %><%= prov.version ? " #{prov.version}" : "" %>
98
108
  <%- end -%>
99
109
 
100
110
  %description
@@ -136,7 +146,7 @@ install -d %{buildroot}
136
146
  # automatically does this implicitly, but RPMv5 is more strict and you
137
147
  # need to list the dirs for them to be packaged properly.
138
148
  <%- get_directories.map {|d| "%{buildroot}#{d.path}"}.each do |dir| -%>
139
- find <%= dir %> -type d | sed -e "s#%{buildroot}##" | sed -e 's/\(^.*\s.*$\)/"\1"/g' >> dir-list-rpm
149
+ find <%= dir %> -type d | <%= @platform.sed %> -e "s#%{buildroot}##" | <%= @platform.sed %> -e 's/\(^.*\s.*$\)/"\1"/g' >> dir-list-rpm
140
150
  <%- end -%>
141
151
  cat dir-list-rpm | sort | uniq >> %{SOURCE1}
142
152
  <%- end -%>
@@ -145,13 +155,13 @@ install -d %{buildroot}
145
155
  # %files section separately because rpm3 on aix errors on duplicate files in
146
156
  # the package.
147
157
  <%- (get_directories + get_files + get_configfiles).map do |filething| -%>
148
- PATH=/opt/freeware/bin:$PATH sed -i 's|^<%= filething.path.include?(" ") ? %Q["#{filething.path}"] : filething.path %>$||g' %{SOURCE1}
158
+ PATH=/opt/freeware/bin:$PATH <%= @platform.sed %> -i 's|^<%= filething.path.include?(" ") ? %Q["#{filething.path}"] : filething.path %>$||g' %{SOURCE1}
149
159
  <%- end -%>
150
160
 
151
161
  # Here we turn all dirs in the file-list into %dir entries to avoid duplicate files
152
162
  while read entry; do
153
163
  if [ -n "$entry" -a -d "$entry" -a ! -L "$entry" ]; then
154
- PATH=/opt/freeware/bin:$PATH sed -i "s|^\($entry\)\$|%dir \1|g" %{SOURCE1}
164
+ PATH=/opt/freeware/bin:$PATH <%= @platform.sed %> -i "s|^\($entry\)\$|%dir \1|g" %{SOURCE1}
155
165
  fi
156
166
  done < %{SOURCE1}
157
167
 
@@ -366,6 +366,16 @@ end" }
366
366
  expect(comp._component.conflicts.first.pkgname).to eq('thing1')
367
367
  expect(comp._component.conflicts.first.version).to eq('1.2.3')
368
368
  end
369
+
370
+ it "doesn't add a version operator if it's already there" do
371
+ operators = ['<', '>', '=', '<=', '>=']
372
+ operators.each do |operator|
373
+ comp = Vanagon::Component::DSL.new('conflicts-test', {}, {})
374
+ comp.conflicts('thing1', "#{operator}1.2.3")
375
+ expect(comp._component.conflicts.first.pkgname).to eq('thing1')
376
+ expect(comp._component.conflicts.first.version).to eq("#{operator}1.2.3")
377
+ end
378
+ end
369
379
  end
370
380
 
371
381
  describe '#add_actions' do
@@ -0,0 +1,21 @@
1
+ require 'vanagon/platform'
2
+
3
+ describe "Vanagon::Platform::OSX" do
4
+ let(:block) {
5
+ %Q[ platform "osx-10.12-x86_64" do |plat|
6
+ end
7
+ ]
8
+ }
9
+ let(:plat) { Vanagon::Platform::DSL.new('osx-10.12-x86_64') }
10
+
11
+ before do
12
+ plat.instance_eval(block)
13
+ end
14
+
15
+ describe "osx has a different mktemp" do
16
+ it "uses the right mktemp options" do
17
+ expect(plat._platform.send(:mktemp)).to eq("mktemp -d -t 'tmp'")
18
+ end
19
+ end
20
+ end
21
+
@@ -20,7 +20,7 @@ describe "Vanagon::Platform::RPM::AIX" do
20
20
 
21
21
  describe "aix puts commands in weird places" do
22
22
  it "uses /opt/freeware/bin everwhere" do
23
- ['tar', 'patch', 'install'].each do |cmd|
23
+ ['tar', 'patch', 'install', 'sed'].each do |cmd|
24
24
  expect(plat._platform.send(cmd.to_sym)).to eq(File.join('/opt/freeware/bin', cmd))
25
25
  end
26
26
  end
@@ -0,0 +1,29 @@
1
+ require 'vanagon/platform'
2
+
3
+ describe "Vanagon::Platform::Solaris10" do
4
+ let(:block) {
5
+ %Q[ platform "solaris-10-i386" do |plat|
6
+ end
7
+ ]
8
+ }
9
+ let(:plat) { Vanagon::Platform::DSL.new('solaris-10-i386') }
10
+
11
+ before do
12
+ plat.instance_eval(block)
13
+ end
14
+
15
+ describe "solaris10 has weird paths for gnu commands" do
16
+ it "has some in /opt/csw/bin" do
17
+ ['make', 'sed'].each do |cmd|
18
+ expect(plat._platform.send(cmd.to_sym)).to eq(File.join('/opt/csw/bin', "g#{cmd}"))
19
+ end
20
+ end
21
+ it "uses /usr/sfw/bin/gtar" do
22
+ expect(plat._platform.send(:tar)).to eq('/usr/sfw/bin/gtar')
23
+ end
24
+ it "uses /usr/bin/gpatch" do
25
+ expect(plat._platform.send(:patch)).to eq('/usr/bin/gpatch')
26
+ end
27
+ end
28
+ end
29
+