vanagon 0.3.19 → 0.4.0

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: 209125a16053b5957e7a0803765857938e3c9c3b
4
- data.tar.gz: 96431964ee62b54f27e24b5991d617be07b9e46e
3
+ metadata.gz: 8e9188b407a2cea5a4ad1beaa844e0f18abaa5da
4
+ data.tar.gz: 2f867ac9b05096dd35ce45d571af099faf0acc87
5
5
  SHA512:
6
- metadata.gz: 226ac385d96501d28837424a734aaa30e5ae374600c584cc5de76de22baef59b15ed4cd43f345f25abd1bef91fd1035dea7c2764ed8840bb81eab16189901aa7
7
- data.tar.gz: 4f4a9ff1c9a35dc4bd7fb3f6fd7636ebb581409851b5321810e8994541ed9535a4b2c75b9be984a3079d9b1be1caed5b1d7f9070e6679bc0cba5adb269bc4ce4
6
+ metadata.gz: c174fd00eb54d11bc40446b627c4cfaedfa1930b2d6c5a7edeb2a08148ca8e68abb63ad1d1b390fe940a221f37423128e21fb305a7c6f5d192bfef3f1a2e7109
7
+ data.tar.gz: ffd5a859ee33018f5b1fbb7e7d587681290a9eee4271c1ec5020936b0d0dfa91c5441e77ad8d53b4179d603cf1e7e01b8a3f777cf59347c1fae33ac08000fcdd
@@ -11,6 +11,7 @@ class Vanagon
11
11
  attr_accessor :settings, :platform, :patches, :requires, :service, :options
12
12
  attr_accessor :directories, :replaces, :provides, :cleanup_source, :environment
13
13
  attr_accessor :sources, :preinstall_actions, :postinstall_actions
14
+ attr_accessor :preremove_actions, :postremove_actions
14
15
 
15
16
  # Loads a given component from the configdir
16
17
  #
@@ -58,6 +59,8 @@ class Vanagon
58
59
  @sources = []
59
60
  @preinstall_actions = []
60
61
  @postinstall_actions = []
62
+ @preremove_actions = []
63
+ @postremove_actions = []
61
64
  end
62
65
 
63
66
  # Adds the given file to the list of files and returns @files.
@@ -232,6 +232,7 @@ class Vanagon
232
232
  def link(source, target)
233
233
  @component.install << "#{@component.platform.install} -d '#{File.dirname(target)}'"
234
234
  @component.install << "ln -s '#{source}' '#{target}'"
235
+ @component.add_file Vanagon::Common::Pathname.file(target)
235
236
  end
236
237
 
237
238
  # Sets the version for the component
@@ -289,18 +290,64 @@ class Vanagon
289
290
  @component.environment.merge!(env)
290
291
  end
291
292
 
292
- # Adds actions to run at the beginning of a package install
293
+ # Adds action to run during the preinstall phase of packaging
293
294
  #
294
- # @param action [String] Bourne shell compatible scriptlets to execute
295
- def add_preinstall_action(action)
296
- @component.preinstall_actions << action
295
+ # @param pkg_state [Array] the state in which the scripts should execute. Can be
296
+ # one or multiple of 'install' and 'upgrade'.
297
+ # @param scripts [Array] the Bourne shell compatible scriptlet(s) to execute
298
+ def add_preinstall_action(pkg_state, scripts)
299
+ pkg_state = Array(pkg_state)
300
+ scripts = Array(scripts)
301
+
302
+ if pkg_state.empty? || !(pkg_state - ["install", "upgrade"]).empty?
303
+ raise Vanagon::Error, "#{pkg_state} should be an array containing one or more of ['install', 'upgrade']"
304
+ end
305
+ @component.preinstall_actions << OpenStruct.new(:pkg_state => pkg_state, :scripts => scripts)
306
+ end
307
+
308
+ # Adds action to run during the postinstall phase of packaging
309
+ #
310
+ # @param pkg_state [Array] the state in which the scripts should execute. Can be
311
+ # one or multiple of 'install' and 'upgrade'.
312
+ # @param scripts [Array] the Bourne shell compatible scriptlet(s) to execute
313
+ def add_postinstall_action(pkg_state, scripts)
314
+ pkg_state = Array(pkg_state)
315
+ scripts = Array(scripts)
316
+
317
+ if pkg_state.empty? || !(pkg_state - ["install", "upgrade"]).empty?
318
+ raise Vanagon::Error, "#{pkg_state} should be an array containing one or more of ['install', 'upgrade']"
319
+ end
320
+ @component.postinstall_actions << OpenStruct.new(:pkg_state => pkg_state, :scripts => scripts)
297
321
  end
298
322
 
299
- # Adds actions to run at the end of a package install
323
+ # Adds action to run during the preremoval phase of packaging
300
324
  #
301
- # @param action [String] Bourne shell compatible scriptlets to execute
302
- def add_postinstall_action(action)
303
- @component.postinstall_actions << action
325
+ # @param pkg_state [Array] the state in which the scripts should execute. Can be
326
+ # one or multiple of 'removal' and 'upgrade'.
327
+ # @param scripts [Array] the Bourne shell compatible scriptlet(s) to execute
328
+ def add_preremove_action(pkg_state, scripts)
329
+ pkg_state = Array(pkg_state)
330
+ scripts = Array(scripts)
331
+
332
+ if pkg_state.empty? || !(pkg_state - ["upgrade", "removal"]).empty?
333
+ raise Vanagon::Error, "#{pkg_state} should be an array containing one or more of ['removal', 'upgrade']"
334
+ end
335
+ @component.preremove_actions << OpenStruct.new(:pkg_state => pkg_state, :scripts => scripts)
336
+ end
337
+
338
+ # Adds action to run during the postremoval phase of packaging
339
+ #
340
+ # @param pkg_state [Array] the state in which the scripts should execute. Can be
341
+ # one or multiple of 'removal' and 'upgrade'.
342
+ # @param scripts [Array] the Bourne shell compatible scriptlet(s) to execute
343
+ def add_postremove_action(pkg_state, scripts)
344
+ pkg_state = Array(pkg_state)
345
+ scripts = Array(scripts)
346
+
347
+ if pkg_state.empty? || !(pkg_state - ["upgrade", "removal"]).empty?
348
+ raise Vanagon::Error, "#{pkg_state} should be an array containing one or more of ['removal', 'upgrade']"
349
+ end
350
+ @component.postremove_actions << OpenStruct.new(:pkg_state => pkg_state, :scripts => scripts)
304
351
  end
305
352
  end
306
353
  end
@@ -21,21 +21,33 @@ class Vanagon
21
21
 
22
22
  def self.rewrite(url, protocol)
23
23
  rule = @@rewrite_rule[protocol]
24
+
24
25
  if rule
25
- if rule.is_a?(Proc) and rule.arity == 1
26
- return rule.call(url)
26
+ if rule.is_a?(Proc)
27
+ return proc_rewrite(rule, url)
27
28
  elsif rule.is_a?(String)
28
- target_match = url.match(/.*\/([^\/]*)$/)
29
- if target_match
30
- target = target_match[1]
31
- return File.join(rule, target)
32
- else
33
- raise Vanagon::Error, "Unable to apply url rewrite to '#{url}', expected to find at least one '/' in the url."
34
- end
35
- else
29
+ return string_rewrite(rule, url)
36
30
  end
31
+ end
32
+
33
+ return url
34
+ end
35
+
36
+ def self.proc_rewrite(rule, url)
37
+ if rule.arity == 1
38
+ rule.call(url)
39
+ else
40
+ raise Vanagon::Error, "Unable to use provided rewrite rule. Expected Proc with one argument, Proc has #{rule.arity} arguments"
41
+ end
42
+ end
43
+
44
+ def self.string_rewrite(rule, url)
45
+ target_match = url.match(/.*\/([^\/]*)$/)
46
+ if target_match
47
+ target = target_match[1]
48
+ return File.join(rule, target)
37
49
  else
38
- return url
50
+ raise Vanagon::Error, "Unable to apply url rewrite to '#{url}', expected to find at least one '/' in the url."
39
51
  end
40
52
  end
41
53
 
@@ -13,7 +13,7 @@ class Vanagon
13
13
  ARCHIVE_EXTENSIONS = '.tar.gz', '.tgz'
14
14
 
15
15
  # Extensions for files we aren't going to unpack during the build
16
- NON_ARCHIVE_EXTENSIONS = '.gem', '.ru', '.txt', '.conf', '.ini', '.gpg', '.rb', '.sh', '.csh'
16
+ NON_ARCHIVE_EXTENSIONS = '.gem', '.ru', '.txt', '.conf', '.ini', '.gpg', '.rb', '.sh', '.csh', '.xml'
17
17
 
18
18
  # Constructor for the Http source type
19
19
  #
@@ -37,7 +37,7 @@ class Vanagon
37
37
  '{"' + @platform.vmpooler_template + '":"1"}',
38
38
  { 'X-AUTH-TOKEN' => @token }
39
39
  )
40
- if response and response["ok"]
40
+ if response["ok"]
41
41
  @target = response[@platform.vmpooler_template]['hostname'] + '.' + response['domain']
42
42
  Vanagon::Driver.logger.info "Reserving #{@target} (#{@platform.vmpooler_template}) [#{@token ? 'token used' : 'no token used'}]"
43
43
 
@@ -49,7 +49,7 @@ class Vanagon
49
49
  }
50
50
  }
51
51
 
52
- response_tag = Vanagon::Utilities.http_request(
52
+ Vanagon::Utilities.http_request(
53
53
  "#{@pooler}/vm/#{response[@platform.vmpooler_template]['hostname']}",
54
54
  'PUT',
55
55
  tags.to_json,
@@ -146,7 +146,7 @@ class Vanagon
146
146
  # @return [true, false] true if it is a redhat variety or uses rpm
147
147
  # under the hood, false otherwise
148
148
  def is_rpm?
149
- return !!@name.match(/^(aix|cisco-wrlinux|el|eos|fedora|huaweios|nxos|sles)-.*$/)
149
+ return !!@name.match(/^(aix|cisco-wrlinux|el|eos|fedora|huaweios|sles)-.*$/)
150
150
  end
151
151
 
152
152
  # Utility matcher to determine is the platform is an enterprise linux variety
@@ -191,13 +191,6 @@ class Vanagon
191
191
  return !!@name.match(/^huaweios-.*$/)
192
192
  end
193
193
 
194
- # Utility matcher to determine is the platform is an nxos variety
195
- #
196
- # @return [true, false] true if it is an nxos variety, false otherwise
197
- def is_nxos?
198
- return !!@name.match(/^nxos-.*$/)
199
- end
200
-
201
194
  # Utility matcher to determine is the platform is a cisco-wrlinux
202
195
  # variety
203
196
  #
@@ -28,7 +28,7 @@ class Vanagon
28
28
  FileUtils.mkdir_p(deb_dir)
29
29
 
30
30
  # Lots of templates here
31
- ["changelog", "conffiles", "control", "docs", "dirs", "install", "postinst", "postrm", "prerm", "rules"].each do |deb_file|
31
+ ["changelog", "conffiles", "control", "docs", "dirs", "install", "preinst", "postinst", "postrm", "prerm", "rules"].each do |deb_file|
32
32
  erb_file(File.join(VANAGON_ROOT, "templates/deb/#{deb_file}.erb"), File.join(deb_dir, deb_file), false, { :binding => binding })
33
33
  end
34
34
 
@@ -54,6 +54,53 @@ class Vanagon
54
54
  File.join("deb", @codename, target_repo)
55
55
  end
56
56
 
57
+ # Returns the string to add a target repo to the platforms' provisioning
58
+ #
59
+ # @param definition [URI] A URI to a deb or list file
60
+ # @return [String] The command to add the repo target to the system
61
+ def add_repo_target(definition)
62
+ if File.extname(definition.path) == '.deb'
63
+ # repo definition is an deb (like puppetlabs-release)
64
+ "curl -o local.deb '#{definition}' && dpkg -i local.deb; rm -f local.deb"
65
+ else
66
+ reponame = "#{SecureRandom.hex}-#{File.basename(definition.path)}"
67
+ reponame = "#{reponame}.list" if File.extname(reponame) != '.list'
68
+ "curl -o '/etc/apt/sources.list.d/#{reponame}' '#{definition}'"
69
+ end
70
+ end
71
+
72
+ # Returns the string to add a gpg key to the platforms' provisioning
73
+ #
74
+ # @param gpg_key [URI] A URI to the gpg key
75
+ # @return [String] The command to add the gpg key to the system
76
+ def add_gpg_key(gpg_key)
77
+ gpgname = "#{SecureRandom.hex}-#{File.basename(gpg_key.path)}"
78
+ gpgname = "#{gpgname}.gpg" if gpgname !~ /\.gpg$/
79
+ "curl -o '/etc/apt/trusted.gpg.d/#{gpgname}' '#{gpg_key}'"
80
+ end
81
+
82
+ # Returns the commands to add a given repo target and optionally a gpg key to the build system
83
+ #
84
+ # @param definition [String] URI to the repo (.deb or .list)
85
+ # @param gpg_key [String, nil] URI to a gpg key for the repo
86
+ def add_repository(definition, gpg_key = nil)
87
+ # i.e., definition = http://builds.delivery.puppetlabs.net/puppet-agent/0.2.1/repo_configs/deb/pl-puppet-agent-0.2.1-wheezy.list
88
+ # parse the definition and gpg_key if set to ensure they are both valid URIs
89
+ definition = URI.parse(definition)
90
+ gpg_key = URI.parse(gpg_key) if gpg_key
91
+ provisioning = ["apt-get -qq update && apt-get -qq install curl"]
92
+
93
+ if definition.scheme =~ /^(http|ftp)/
94
+ provisioning << add_repo_target(definition)
95
+ end
96
+
97
+ if gpg_key
98
+ provisioning << add_gpg_key(gpg_key)
99
+ end
100
+
101
+ provisioning << "apt-get -qq update"
102
+ end
103
+
57
104
  # Constructor. Sets up some defaults for the debian platform and calls the parent constructor
58
105
  #
59
106
  # @param name [String] name of the platform
@@ -1,5 +1,7 @@
1
1
  require 'vanagon/platform/deb'
2
2
  require 'vanagon/platform/rpm'
3
+ require 'vanagon/platform/rpm/aix'
4
+ require 'vanagon/platform/rpm/sles'
3
5
  require 'vanagon/platform/rpm/wrl'
4
6
  require 'vanagon/platform/swix'
5
7
  require 'vanagon/platform/osx'
@@ -25,8 +27,12 @@ class Vanagon
25
27
  # @param block [Proc] DSL definition of the platform to call
26
28
  def platform(name, &block)
27
29
  @platform = case name
28
- when /^(aix|cisco-wrlinux|el|fedora|nxos|sles)-/
30
+ when /^aix-/
31
+ Vanagon::Platform::RPM::AIX.new(@name)
32
+ when /^(cisco-wrlinux|el|fedora)-/
29
33
  Vanagon::Platform::RPM.new(@name)
34
+ when /^sles-/
35
+ Vanagon::Platform::RPM::SLES.new(@name)
30
36
  when /^huaweios-/
31
37
  Vanagon::Platform::RPM::WRL.new(@name)
32
38
  when /^(cumulus|debian|ubuntu)-/
@@ -118,6 +124,7 @@ class Vanagon
118
124
  # @param command [String] Command to enable the target machine to build packages for the platform
119
125
  def provision_with(command)
120
126
  @platform.provisioning << command
127
+ @platform.provisioning.flatten!
121
128
  end
122
129
 
123
130
  # Set the command to install any needed build dependencies for the target machine
@@ -198,83 +205,28 @@ class Vanagon
198
205
  #
199
206
  # @param definition [String] the repo setup file, must be a valid uri, fetched with curl
200
207
  # @param gpg_key [String] optional gpg key to be fetched via curl and installed
208
+ # @deprecated Please use the add_build_repository DSL method instead. apt_repo will be removed in a future vanagon release.
201
209
  def apt_repo(definition, gpg_key = nil)
202
- # i.e., definition = http://builds.delivery.puppetlabs.net/puppet-agent/0.2.1/repo_configs/deb/pl-puppet-agent-0.2.1-wheezy.list
203
- # parse the definition and gpg_key if set to ensure they are both valid URIs
204
- definition = URI.parse definition
205
- gpg_key = URI.parse gpg_key if gpg_key
206
-
207
- self.provision_with "apt-get -qq update && apt-get -qq install curl"
208
- if definition.scheme =~ /^(http|ftp)/
209
- if File.extname(definition.path) == '.deb'
210
- # repo definition is an deb (like puppetlabs-release)
211
- self.provision_with "curl -o local.deb '#{definition}' && dpkg -i local.deb; rm -f local.deb"
212
- else
213
- reponame = "#{SecureRandom.hex}-#{File.basename(definition.path)}"
214
- reponame = "#{reponame}.list" if File.extname(reponame) != '.list'
215
- self.provision_with "curl -o '/etc/apt/sources.list.d/#{reponame}' '#{definition}'"
216
- end
217
- end
218
-
219
- if gpg_key
220
- gpgname = "#{SecureRandom.hex}-#{File.basename(gpg_key.path)}"
221
- gpgname = "#{gpgname}.gpg" if gpgname !~ /\.gpg$/
222
- self.provision_with "curl -o '/etc/apt/trusted.gpg.d/#{gpgname}' '#{gpg_key}'"
223
- end
224
-
225
- self.provision_with "apt-get -qq update"
210
+ warn "Please use the add_build_repository DSL method instead. apt_repo will be removed in a future vanagon release."
211
+ self.add_build_repository(definition, gpg_key)
226
212
  end
227
213
 
228
214
  # Helper to setup a yum repository on a target system
229
215
  #
230
216
  # @param definition [String] the repo setup URI or RPM file
217
+ # @deprecated Please use the add_build_repository DSL method instead. yum_repo will be removed in a future vanagon release.
231
218
  def yum_repo(definition)
232
- definition = URI.parse definition
233
-
234
- self.provision_with "rpm -q curl > /dev/null || yum -y install curl"
235
- if definition.scheme =~ /^(http|ftp)/
236
- if File.extname(definition.path) == '.rpm'
237
- # repo definition is an rpm (like puppetlabs-release)
238
- if @platform.os_version.to_i < 6
239
- # This can likely be done with just rpm itself (minus curl) however
240
- # with a http_proxy curl has many more options avavailable for
241
- # usage than rpm raw does. So for the most compatibility, we have
242
- # chosen curl.
243
- self.provision_with "curl -o local.rpm '#{definition}'; rpm -Uvh local.rpm; rm -f local.rpm"
244
- else
245
- self.provision_with "yum localinstall -y '#{definition}'"
246
- end
247
- else
248
- reponame = "#{SecureRandom.hex}-#{File.basename(definition.path)}"
249
- reponame = "#{reponame}.repo" if File.extname(reponame) != '.repo'
250
- if @platform.is_nxos? or @platform.is_cisco_wrlinux?
251
- self.provision_with "curl -o '/etc/yum/repos.d/#{reponame}' '#{definition}'"
252
- else
253
- self.provision_with "curl -o '/etc/yum.repos.d/#{reponame}' '#{definition}'"
254
- end
255
- end
256
- end
219
+ warn "Please use the add_build_repository DSL method instead. yum_repo will be removed in a future vanagon release."
220
+ self.add_build_repository(definition)
257
221
  end
258
222
 
259
223
  # Helper to setup a zypper repository on a target system
260
224
  #
261
225
  # @param definition [String] the repo setup URI or RPM file
226
+ # @deprecated Please use the add_build_repository DSL method instead. zypper_repo will be removed in a future vanagon release.
262
227
  def zypper_repo(definition)
263
- definition = URI.parse definition
264
- if @platform.os_version == '10'
265
- flag = 'sa'
266
- else
267
- flag = 'ar'
268
- end
269
- self.provision_with "yes | zypper -n --no-gpg-checks install curl"
270
- if definition.scheme =~ /^(http|ftp)/
271
- if File.extname(definition.path) == '.rpm'
272
- # repo definition is an rpm (like puppetlabs-release)
273
- self.provision_with "curl -o local.rpm '#{definition}'; rpm -Uvh local.rpm; rm -f local.rpm"
274
- else
275
- self.provision_with "yes | zypper -n --no-gpg-checks #{flag} -t YUM --repo '#{definition}'"
276
- end
277
- end
228
+ warn "Please use the add_build_repository DSL method instead. zypper_repo will be removed in a future vanagon release."
229
+ self.add_build_repository(definition)
278
230
  end
279
231
 
280
232
  # Generic adder for build repositories
@@ -7,6 +7,21 @@ class Vanagon
7
7
  # @return [Array] list of commands required to build a osx package for the given project from a tarball
8
8
  def generate_package(project)
9
9
  target_dir = project.repo ? output_dir(project.repo) : output_dir
10
+
11
+ # Here we maintain backward compatibility with older vanagon versions
12
+ # that did this by default. This shim should get removed at some point
13
+ # in favor of just letting the makefile deliver the bill-of-materials
14
+ # to the correct directory. This shouldn't be required at all then.
15
+ if project.bill_of_materials.nil?
16
+ bom_install = [# Move bill-of-materials into a docdir
17
+ "mkdir -p $(tempdir)/osx/build/root/#{project.name}-#{project.version}/usr/local/share/doc/#{project.name}",
18
+ "mv $(tempdir)/osx/build/root/#{project.name}-#{project.version}/bill-of-materials $(tempdir)/osx/build/root/#{project.name}-#{project.version}/usr/local/share/doc/#{project.name}/bill-of-materials",]
19
+
20
+ else
21
+ bom_install = []
22
+ end
23
+
24
+
10
25
  # Setup build directories
11
26
  ["bash -c 'mkdir -p $(tempdir)/osx/build/{dmg,pkg,scripts,resources,root,payload,plugins}'",
12
27
  "mkdir -p $(tempdir)/osx/build/root/#{project.name}-#{project.version}",
@@ -17,9 +32,7 @@ class Vanagon
17
32
  # Unpack the project
18
33
  "gunzip -c #{project.name}-#{project.version}.tar.gz | '#{@tar}' -C '$(tempdir)/osx/build/root/#{project.name}-#{project.version}' --strip-components 1 -xf -",
19
34
 
20
- # Move bill-of-materials into a docdir
21
- "mkdir -p $(tempdir)/osx/build/root/#{project.name}-#{project.version}/usr/local/share/doc/#{project.name}",
22
- "mv $(tempdir)/osx/build/root/#{project.name}-#{project.version}/bill-of-materials $(tempdir)/osx/build/root/#{project.name}-#{project.version}/usr/local/share/doc/#{project.name}/bill-of-materials",
35
+ bom_install,
23
36
 
24
37
  # Package the project
25
38
  "(cd $(tempdir)/osx/build/; #{@pkgbuild} --root root/#{project.name}-#{project.version} \
@@ -39,7 +52,7 @@ class Vanagon
39
52
  "(cd $(tempdir)/osx/build/; #{@hdiutil} create -volname #{project.name}-#{project.version} \
40
53
  -srcfolder pkg/ dmg/#{project.package_name})",
41
54
  "mkdir -p output/#{target_dir}",
42
- "cp $(tempdir)/osx/build/dmg/#{project.package_name} ./output/#{target_dir}"]
55
+ "cp $(tempdir)/osx/build/dmg/#{project.package_name} ./output/#{target_dir}"].flatten.compact
43
56
  end
44
57
 
45
58
  # Method to generate the files required to build a osx package for the project
@@ -48,10 +48,29 @@ class Vanagon
48
48
  defines = %(--define '_topdir $(tempdir)/rpmbuild' )
49
49
  # RPM doesn't allow dashes in the os_name. This was added to
50
50
  # convert cisco-wrlinux to cisco_wrlinux
51
- unless is_aix?
52
- defines << %(--define 'dist .#{@os_name.gsub('-', '_')}#{@os_version}' )
51
+ defines << %(--define 'dist .#{@os_name.gsub('-', '_')}#{@os_version}' )
52
+ end
53
+
54
+ def add_repository(definition)
55
+ definition = URI.parse(definition)
56
+
57
+ commands = ["rpm -q curl > /dev/null || yum -y install curl"]
58
+ if definition.scheme =~ /^(http|ftp)/
59
+ if File.extname(definition.path) == '.rpm'
60
+ # repo definition is an rpm (like puppetlabs-release)
61
+ commands << "curl -o local.rpm '#{definition}'; rpm -Uvh local.rpm; rm -f local.rpm"
62
+ else
63
+ reponame = "#{SecureRandom.hex}-#{File.basename(definition.path)}"
64
+ reponame = "#{reponame}.repo" if File.extname(reponame) != '.repo'
65
+ if is_cisco_wrlinux?
66
+ commands << "curl -o '/etc/yum/repos.d/#{reponame}' '#{definition}'"
67
+ else
68
+ commands << "curl -o '/etc/yum.repos.d/#{reponame}' '#{definition}'"
69
+ end
70
+ end
53
71
  end
54
- defines
72
+
73
+ commands
55
74
  end
56
75
 
57
76
  # Constructor. Sets up some defaults for the rpm platform and calls the parent constructor
@@ -60,15 +79,11 @@ class Vanagon
60
79
  # @return [Vanagon::Platform::RPM] the rpm derived platform with the given name
61
80
  def initialize(name)
62
81
  @name = name
63
- @make = "/usr/bin/make"
64
- @tar = "tar"
65
- @patch = "/usr/bin/patch"
66
- @num_cores = "/bin/grep -c 'processor' /proc/cpuinfo"
67
- if is_aix?
68
- @num_cores = "lsdev -Cc processor |wc -l"
69
- @install = "/opt/freeware/bin/install"
70
- end
71
- @rpmbuild = "/usr/bin/rpmbuild"
82
+ @make ||= "/usr/bin/make"
83
+ @tar ||= "tar"
84
+ @patch ||= "/usr/bin/patch"
85
+ @num_cores ||= "/bin/grep -c 'processor' /proc/cpuinfo"
86
+ @rpmbuild ||= "/usr/bin/rpmbuild"
72
87
  super(name)
73
88
  end
74
89
  end