simp-rake-helpers 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,11 @@
1
+ # ------------------------------------------------------------------------------
2
+ # Environment variables:
3
+ # SIMP_GEM_SERVERS | a space/comma delimited list of rubygem servers
4
+ # ------------------------------------------------------------------------------
5
+ # NOTE: SIMP Puppet rake tasks support ruby 2.0 and ruby 2.1
6
+ # ------------------------------------------------------------------------------
7
+ gem_sources = ENV.key?('SIMP_GEM_SERVERS') ? ENV['SIMP_GEM_SERVERS'].split(/[, ]+/) : ['https://rubygems.org']
8
+
9
+ gem_sources.each { |gem_source| source gem_source }
10
+
11
+ gem 'simp-rake-helpers', '~> 3.0'
@@ -0,0 +1,356 @@
1
+ %{lua:
2
+
3
+ --
4
+ -- When you build you must to pass this along so that we know how
5
+ -- to get the preliminary information.
6
+ -- This directory should hold the following items:
7
+ -- * 'build/rpm_metadata/requires' <- optional list of 'Requires', 'Provides',
8
+ -- and 'Obsoletes' to supplement those auto-generated in this spec file
9
+ -- * 'build/rpm_metadata/release' <- optional RPM release number to use in
10
+ -- lieu of number hard-coded in this spec file
11
+ -- * 'CHANGELOG' <- optional RPM formatted Changelog to use in lieu of minimal,
12
+ -- changelog entry auto-generated in this spec file
13
+ -- * 'metadata.json' <- required file that must contain the following metadata:
14
+ -- - 'name' - package name
15
+ -- - 'version' - package version
16
+ -- - 'license' - package license
17
+ -- - 'summary' - package summary
18
+ -- - 'source' - package source
19
+ --
20
+ -- Example:
21
+ -- rpmbuild -D 'pup_module_info_dir /home/user/project/puppet_module' -ba SPECS/specfile.spec
22
+ --
23
+ -- If this is not found, we will look in %{_sourcedir} for the files and fall
24
+ -- back to the current directory
25
+ --
26
+
27
+ src_dir = rpm.expand('%{pup_module_info_dir}')
28
+
29
+ if string.match(src_dir, '^%%') or (posix.stat(src_dir, 'type') ~= 'directory') then
30
+ src_dir = rpm.expand('%{_sourcedir}')
31
+
32
+ if (posix.stat((src_dir .. "/metadata.json"), 'type') ~= 'regular') then
33
+ src_dir = './'
34
+ end
35
+ end
36
+
37
+ -- These UNKNOWN entries should break the build if something bad happens
38
+
39
+ package_name = "UNKNOWN"
40
+ package_version = "UNKNOWN"
41
+ module_license = "UNKNOWN"
42
+
43
+ --
44
+ -- Default to 2016
45
+ -- This was done due to the change in naming scheme across all of the modules.
46
+ -- The '.1' bump is there for the SIMP 6 path changes
47
+ --
48
+
49
+ package_release = '2016.1'
50
+
51
+ }
52
+
53
+ %{lua:
54
+ -- Pull the Relevant Metadata out of the Puppet module metadata.json.
55
+
56
+ metadata = ''
57
+ metadata_file = io.open(src_dir .. "/metadata.json","r")
58
+ if metadata_file then
59
+ metadata = metadata_file:read("*all")
60
+
61
+ -- Ignore the first curly brace
62
+ metadata = metadata:gsub("{}?", '|', 1)
63
+
64
+ -- Ignore all keys that are below the first level
65
+ metadata = metadata:gsub("{.-}", '')
66
+ metadata = metadata:gsub("%[.-%]", '')
67
+ else
68
+ error("Could not open 'metadata.json'", 0)
69
+ end
70
+
71
+ -- This starts as an empty string so that we can build it later
72
+ module_requires = ''
73
+
74
+ }
75
+
76
+ %{lua:
77
+
78
+ -- Get the Module Name and put it in the correct format
79
+
80
+ local name_match = string.match(metadata, '"name":%s+"(.-)"%s*,')
81
+
82
+ module_author = ''
83
+ module_name = ''
84
+
85
+ if name_match then
86
+ package_name = ('pupmod-' .. name_match)
87
+
88
+ local i = 0
89
+ for str in string.gmatch(name_match,'[^-]+') do
90
+ if i == 0 then
91
+ module_author = str
92
+ else
93
+ if module_name == '' then
94
+ module_name = str
95
+ else
96
+ module_name = (module_name .. '-' .. str)
97
+ end
98
+ end
99
+
100
+ i = i+1
101
+ end
102
+ else
103
+ error("Could not find valid package name in 'metadata.json'", 0)
104
+ end
105
+
106
+ }
107
+
108
+ %{lua:
109
+
110
+ -- Get the Module Version
111
+
112
+ local version_match = string.match(metadata, '"version":%s+"(.-)"%s*,')
113
+
114
+ if version_match then
115
+ package_version = version_match
116
+ else
117
+ error("Could not find valid package version in 'metadata.json'", 0)
118
+ end
119
+
120
+ }
121
+
122
+ %{lua:
123
+
124
+ -- Get the Module License
125
+
126
+ local license_match = string.match(metadata, '"license":%s+"(.-)"%s*,')
127
+
128
+ if license_match then
129
+ module_license = license_match
130
+ else
131
+ error("Could not find valid package license in 'metadata.json'", 0)
132
+ end
133
+
134
+ }
135
+
136
+ %{lua:
137
+
138
+ -- Get the Module Summary
139
+
140
+ local summary_match = string.match(metadata, '"summary":%s+"(.-)"%s*,')
141
+
142
+ if summary_match then
143
+ module_summary = summary_match
144
+ else
145
+ error("Could not find valid package summary in 'metadata.json'", 0)
146
+ end
147
+
148
+ }
149
+
150
+ %{lua:
151
+
152
+ -- Get the Module Source line for the URL string
153
+
154
+ local source_match = string.match(metadata, '"source":%s+"(.-)"%s*,')
155
+
156
+ if source_match then
157
+ module_source = source_match
158
+ else
159
+ error("Could not find valid package source in 'metadata.json'", 0)
160
+ end
161
+
162
+ }
163
+
164
+ %{lua:
165
+
166
+ -- Snag the RPM-specific items out of the 'build/rpm_metadata' directory
167
+
168
+ -- First, the Release Number
169
+
170
+ rel_file = io.open(src_dir .. "/build/rpm_metadata/release", "r")
171
+
172
+ if not rel_file then
173
+ -- Need this for the SRPM case
174
+ rel_file = io.open(src_dir .. "/release", "r")
175
+ end
176
+
177
+ if rel_file then
178
+ for line in rel_file:lines() do
179
+ is_comment = string.match(line, "^%s*#")
180
+ is_blank = string.match(line, "^%s*$")
181
+
182
+ if not (is_comment or is_blank) then
183
+ package_release = line
184
+ break
185
+ end
186
+ end
187
+ end
188
+
189
+ }
190
+
191
+ %{lua:
192
+
193
+ -- Next, the Requirements
194
+ req_file = io.open(src_dir .. "/build/rpm_metadata/requires", "r")
195
+
196
+ if not req_file then
197
+ -- Need this for the SRPM case
198
+ req_file = io.open(src_dir .. "/requires", "r")
199
+ end
200
+
201
+ if req_file then
202
+ for line in req_file:lines() do
203
+ valid_line = (string.match(line, "^Requires: ") or string.match(line, "^Obsoletes: ") or string.match(line, "^Provides: "))
204
+
205
+ if valid_line then
206
+ module_requires = (module_requires .. "\n" .. line)
207
+ end
208
+ end
209
+ end
210
+ }
211
+
212
+ %define module_name %{lua: print(module_name)}
213
+ %define package_name %{lua: print(package_name)}
214
+
215
+ Summary: %{module_name} Puppet Module
216
+ Name: %{package_name}
217
+
218
+ Version: %{lua: print(package_version)}
219
+ Release: %{lua: print(package_release)}
220
+ License: %{lua: print(module_license)}
221
+ Group: Applications/System
222
+ Source0: %{package_name}-%{version}-%{release}.tar.gz
223
+ Source1: %{lua: print("metadata.json")}
224
+ %{lua:
225
+ -- Include our sources as appropriate
226
+ changelog = io.open(src_dir .. "/CHANGELOG","r")
227
+ if changelog then
228
+ print("Source2: " .. "CHANGELOG\n")
229
+ end
230
+
231
+ if rel_file then
232
+ print("Source3: " .. "release\n")
233
+ end
234
+ if req_file then
235
+ print("Source4: " .. "requires\n")
236
+ end
237
+ }
238
+ URL: %{lua: print(module_source)}
239
+ BuildRoot: %{_tmppath}/%{package_name}-%{version}-%{release}-buildroot
240
+ BuildArch: noarch
241
+
242
+ Requires(pre,preun,post,postun): simp-adapter >= 0.0.1
243
+
244
+ %if ("%{package_name}" != "pupmod-simp-simplib") && ("%{package_name}" != "pupmod-puppetlabs-stdlib")
245
+ Requires: pupmod-simp-simplib >= 1.2.6
246
+ %endif
247
+
248
+ %if "%{package_name}" != "pupmod-puppetlabs-stdlib"
249
+ Requires: pupmod-puppetlabs-stdlib >= 4.9.0
250
+ Requires: pupmod-puppetlabs-stdlib < 6.0.0
251
+ %endif
252
+
253
+ %{lua: print(module_requires)}
254
+
255
+ Provides: pupmod-%{lua: print(module_name)} = %{lua: print(package_version .. "-" .. package_release)}
256
+ Obsoletes: pupmod-%{lua: print(module_name)} < %{lua: print(package_version .. "-" .. package_release)}
257
+
258
+ %{lua:
259
+
260
+ -- This is a workaround for the 'simp-rsync' real RPM conflict but is
261
+ -- required by some external modules.
262
+ -- This should be removed when SIMP 6 is stable
263
+
264
+ author_rpm_name = module_author .. "-" .. module_name
265
+
266
+ if author_rpm_name ~= 'simp-rsync' then
267
+ print("Provides: " .. author_rpm_name .. " = " .. package_version .. "-" .. package_release .. "\n")
268
+ print("Obsoletes: " .. author_rpm_name .. " < " .. package_version .. "-" .. package_release .. "\n")
269
+ end
270
+ }
271
+
272
+ Prefix: /usr/share/simp/modules
273
+
274
+ %description
275
+ %{lua: print(module_summary)}
276
+
277
+ %prep
278
+ %setup -q -n %{package_name}-%{version}
279
+
280
+ %build
281
+
282
+ %install
283
+ [ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
284
+
285
+ mkdir -p %{buildroot}/%{prefix}
286
+
287
+ curdir=`pwd`
288
+ dirname=`basename $curdir`
289
+ cp -r ../$dirname %{buildroot}/%{prefix}/%{module_name}
290
+ rm -rf %{buildroot}/%{prefix}/%{module_name}/.git
291
+ rm -f %{buildroot}/%{prefix}/*.lock
292
+ rm -rf %{buildroot}/%{prefix}/spec/fixtures/modules
293
+ rm -rf %{buildroot}/%{prefix}/dist
294
+ rm -rf %{buildroot}/%{prefix}/junit
295
+ rm -rf %{buildroot}/%{prefix}/log
296
+
297
+ %clean
298
+ [ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
299
+
300
+ mkdir -p %{buildroot}/%{prefix}
301
+
302
+ %files
303
+ %defattr(0640,root,root,0750)
304
+ %{prefix}/%{module_name}
305
+
306
+ # when $1 = 1, this is an install
307
+ # when $1 = 2, this is an upgrade
308
+ %pre
309
+ /usr/local/sbin/simp_rpm_helper --rpm_dir=%{prefix}/%{module_name} --rpm_section='pre' --rpm_status=$1
310
+
311
+ # when $1 = 1, this is an install
312
+ # when $1 = 2, this is an upgrade
313
+ %post
314
+ /usr/local/sbin/simp_rpm_helper --rpm_dir=%{prefix}/%{module_name} --rpm_section='post' --rpm_status=$1
315
+
316
+ # when $1 = 1, this is the uninstall of the previous version during an upgrade
317
+ # when $1 = 0, this is the uninstall of the only version during an erase
318
+ %preun
319
+ /usr/local/sbin/simp_rpm_helper --rpm_dir=%{prefix}/%{module_name} --rpm_section='preun' --rpm_status=$1
320
+
321
+ # when $1 = 1, this is the uninstall of the previous version during an upgrade
322
+ # when $1 = 0, this is the uninstall of the only version during an erase
323
+ %postun
324
+ /usr/local/sbin/simp_rpm_helper --rpm_dir=%{prefix}/%{module_name} --rpm_section='postun' --rpm_status=$1
325
+
326
+ %changelog
327
+ %{lua:
328
+ -- Finally, the CHANGELOG
329
+
330
+ -- A default CHANGELOG in case we cannot find a real one
331
+
332
+ default_changelog = [===[
333
+ * $date Auto Changelog <auto@no.body> - $version-$release
334
+ - Latest release of $name
335
+ ]===]
336
+
337
+ default_lookup_table = {
338
+ date = os.date("%a %b %d %Y"),
339
+ version = package_version,
340
+ release = package_release,
341
+ name = package_name
342
+ }
343
+
344
+ changelog = io.open(src_dir .. "/CHANGELOG","r")
345
+ if changelog then
346
+ first_line = changelog:read()
347
+ if string.match(first_line, "^*%s+%a%a%a%s+%a%a%a%s+%d%d?%s+%d%d%d%d%s+.+") then
348
+ changelog:seek("set",0)
349
+ print(changelog:read("*all"))
350
+ else
351
+ print((default_changelog:gsub('$(%w+)', default_lookup_table)))
352
+ end
353
+ else
354
+ print((default_changelog:gsub('$(%w+)', default_lookup_table)))
355
+ end
356
+ }
@@ -6,8 +6,8 @@ class Simp::Rake::Helpers
6
6
 
7
7
  include Simp::Rake::Build::Constants
8
8
 
9
- def self.template
10
- simp_version = ENV.fetch('SIMP_BUILD_version', @simp_version)
9
+ def rpm_template(simp_version=nil)
10
+ simp_version = ENV.fetch('SIMP_BUILD_version', simp_version)
11
11
 
12
12
  if simp_version
13
13
  simp_main_version = simp_version.split('.').first
@@ -15,7 +15,7 @@ class Simp::Rake::Helpers
15
15
  simp_main_version = 'default'
16
16
  end
17
17
 
18
- template_file = File.join(File.dirname(__FILE__), 'rpm_spec', 'assets', "simp#{simp_main_version}.spec")
18
+ template_file = File.join(File.dirname(__FILE__), 'assets', 'rpm_spec', "simp#{simp_main_version}.spec")
19
19
 
20
20
  raise "Error: Could not find template for SIMP version #{simp_version}" unless File.exist?(template_file)
21
21
 
@@ -2,5 +2,5 @@ module Simp; end
2
2
  module Simp::Rake; end
3
3
 
4
4
  class Simp::Rake::Helpers
5
- VERSION = '3.0.1'
5
+ VERSION = '3.0.2'
6
6
  end
data/lib/simp/rake/pkg.rb CHANGED
@@ -13,6 +13,8 @@ module Simp; end
13
13
  module Simp::Rake
14
14
  class Pkg < ::Rake::TaskLib
15
15
 
16
+ include Simp::Rake::Helpers::RPMSpec
17
+
16
18
  # path to the project's directory. Usually `File.dirname(__FILE__)`
17
19
  attr_accessor :base_dir
18
20
 
@@ -36,7 +38,7 @@ module Simp::Rake
36
38
 
37
39
  attr_reader :spec_info
38
40
 
39
- def initialize( base_dir, unique_name=nil )
41
+ def initialize( base_dir, unique_name=nil, unique_namespace=nil, simp_version=nil )
40
42
  @base_dir = base_dir
41
43
  @pkg_name = File.basename(@base_dir)
42
44
  @pkg_dir = File.join(@base_dir, 'dist')
@@ -53,7 +55,7 @@ module Simp::Rake
53
55
  FileUtils.mkdir_p(@pkg_tmp_dir) unless File.directory?(@pkg_tmp_dir)
54
56
 
55
57
  @spec_tempfile = File.open(File.join(@pkg_tmp_dir, "#{@pkg_name}.spec"), 'w')
56
- @spec_tempfile.write(Simp::Rake::Helpers::RPMSpec.template)
58
+ @spec_tempfile.write(rpm_template(simp_version))
57
59
 
58
60
  @spec_file = @spec_tempfile.path
59
61
 
@@ -79,7 +81,13 @@ module Simp::Rake
79
81
 
80
82
  ::CLEAN.include( @clean_list )
81
83
 
82
- define
84
+ if unique_namespace
85
+ namespace unique_namespace.to_sym do
86
+ define
87
+ end
88
+ else
89
+ define
90
+ end
83
91
  end
84
92
 
85
93
  def define
@@ -109,7 +117,13 @@ module Simp::Rake
109
117
 
110
118
  if chroot
111
119
  @chroot_name = @chroot_name || "#{@spec_info[:name]}__#{ENV.fetch( 'USER', 'USER' )}"
120
+
121
+ if ENV['SIMP_PKG_rand_name'] && (ENV['SIMP_PKG_rand_name'] != 'no')
122
+ @chroot_name = @chroot_name + '__' + Time.now.strftime('%s%L')
123
+ end
124
+
112
125
  mock_cmd = mock_pre_check( chroot, @chroot_name, unique ) + " --root #{chroot}"
126
+
113
127
  # Need to do this in case there is already a directory in /tmp
114
128
  rand_dirname = (0...10).map { ('a'..'z').to_a[rand(26)] }.join
115
129
  rand_tmpdir = %(/tmp/#{rand_dirname}_tmp)
@@ -174,7 +188,7 @@ module Simp::Rake
174
188
  args.with_defaults(:chroot => nil)
175
189
  args.with_defaults(:unique => false)
176
190
 
177
- initialize_spec_info(args.chroot, args.unique)
191
+ initialize_spec_info(args[:chroot], args[:unique])
178
192
  end
179
193
 
180
194
  # :pkg:tar
@@ -186,12 +200,12 @@ module Simp::Rake
186
200
  this to work.
187
201
  EOM
188
202
  task :tar,[:chroot,:unique,:snapshot_release] => [:initialize_spec_info] do |t,args|
189
- args.with_defaults(:snapshot_release => false)
203
+ args.with_defaults(:snapshot_release => 'false')
190
204
  args.with_defaults(:chroot => nil)
191
- args.with_defaults(:unique => false)
205
+ args.with_defaults(:unique => 'false')
192
206
 
193
207
  l_date = ''
194
- if args.snapshot_release == 'true'
208
+ if args[:snapshot_release] == 'true'
195
209
  l_date = '.' + "#{TIMESTAMP}"
196
210
  @tar_dest = "#{@pkg_dir}/#{@full_pkg_name}#{l_date}.tar.gz"
197
211
  end
@@ -236,34 +250,22 @@ module Simp::Rake
236
250
  This can be very useful for parallel builds of all modules.
237
251
  * :snapshot_release - Add snapshot_release (date and time) to rpm version.
238
252
  Rpm spec file must have macro for this to work.
239
- EOM
240
- =begin
241
- This functionality has been (temporarily?) removed.
242
- Environment Variables
243
- SIMP_BUILD_VARIANTS - A comma delimted list of the target versions of Puppet/PE to build toward.
244
-
245
- Currently supported are 'pe', 'p4', 'pe-2015'.
246
253
 
247
- These will build for Puppet Enterprise, Puppet 4, and
248
- Puppet Enterprise 2015+ respectively.
249
-
250
- Anything after a dash '-' will be considered a VERSION.
251
-
252
- NOTE: Different RPM spec files may have different
253
- behaviors based on the value passed.
254
- =end
254
+ By default, the package will be built to support a SIMP-6.X file structure.
255
+ To build the package for a different version of SIMP, export SIMP_BUILD_version=<5.X,4.X>
256
+ EOM
255
257
  task :srpm,[:chroot,:unique,:snapshot_release] => [:tar] do |t,args|
256
- args.with_defaults(:unique => false)
257
- args.with_defaults(:snapshot_release => false)
258
+ args.with_defaults(:unique => 'false')
259
+ args.with_defaults(:snapshot_release => 'false')
258
260
 
259
261
  l_date = ''
260
- if args.snapshot_release == 'true'
262
+ if args[:snapshot_release] == 'true'
261
263
  l_date = '.' + "#{TIMESTAMP}"
262
264
  mocksnap = "-D 'snapshot_release #{l_date}'"
263
265
  @tar_dest = "#{@pkg_dir}/#{@full_pkg_name}#{l_date}.tar.gz"
264
266
  end
265
267
 
266
- mock_cmd = mock_pre_check( args.chroot, @chroot_name, args.unique )
268
+ mock_cmd = mock_pre_check( args[:chroot], @chroot_name, args[:unique] )
267
269
 
268
270
  srpms = Dir.glob(%(#{@pkg_dir}/#{@spec_info[:name]}-#{@spec_info[:version]}-#{@spec_info[:release]}#{l_date}.*src.rpm))
269
271
 
@@ -281,7 +283,7 @@ module Simp::Rake
281
283
  end
282
284
  end
283
285
 
284
- cmd = %Q(#{mock_cmd} --root #{args.chroot} #{mocksnap} --buildsrpm --spec #{@spec_file} --sources #{@pkg_dir})
286
+ cmd = %Q(#{mock_cmd} --root #{args[:chroot]} #{mocksnap} --buildsrpm --spec #{@spec_file} --sources #{@pkg_dir})
285
287
 
286
288
  sh cmd
287
289
  end
@@ -300,36 +302,21 @@ module Simp::Rake
300
302
  * :snapshot_release - Add snapshot_release (date and time) to rpm version.
301
303
  Rpm spec file must have macro for this to work.
302
304
 
305
+ By default, the package will be built to support a SIMP-6.X file structure.
306
+ To build the package for a different version of SIMP, export SIMP_BUILD_version=<5.X,4.X>
303
307
  EOM
304
- =begin
305
- This functionality has been (temporarily?) removed.
306
- Environment Variables
307
- SIMP_BUILD_VARIANTS - A comma delimted list of the target versions of Puppet/PE to build toward.
308
-
309
- Currently supported are 'pe', 'p4', 'pe-2015'.
310
-
311
- These will build for Puppet Enterprise, Puppet 4, and
312
- Puppet Enterprise 2015+ respectively.
313
-
314
- Anything after a dash '-' will be considered a VERSION.
315
-
316
- NOTE: Different RPM spec files may have different
317
- behaviors based on the value passed.
318
- =end
319
- task :rpm,[:chroot,:unique,:snapshot_release] do |t,args|
320
- args.with_defaults(:unique => false)
321
- args.with_defaults(:snapshot_release => false)
308
+ task :rpm,[:chroot,:unique,:snapshot_release] => [:srpm] do |t,args|
309
+ args.with_defaults(:unique => 'false')
310
+ args.with_defaults(:snapshot_release => 'false')
322
311
 
323
312
  l_date = ''
324
- if args.snapshot_release == 'true'
313
+ if args[:snapshot_release] == 'true'
325
314
  l_date = '.' + "#{TIMESTAMP}"
326
315
  mocksnap = "-D 'snapshot_release #{l_date}'"
327
316
  @tar_dest = "#{@pkg_dir}/#{@full_pkg_name}#{l_date}.tar.gz"
328
317
  end
329
318
 
330
- Rake::Task['pkg:srpm'].invoke(args.chroot,args.unique,args.snapshot_release)
331
-
332
- mock_cmd = mock_pre_check(args.chroot, @chroot_name, args.unique)
319
+ mock_cmd = mock_pre_check(args[:chroot], @chroot_name, args[:unique])
333
320
 
334
321
  rpms = Dir.glob(%(#{@pkg_dir}/#{@spec_info[:name]}-#{@spec_info[:version]}-#{@spec_info[:release]}#{l_date}.*rpm))
335
322
  srpms = rpms.select{|x| x =~ /src\.rpm$/}
@@ -340,7 +327,7 @@ module Simp::Rake
340
327
  basename = File.basename(srpm,'.src.rpm')
341
328
  rpm = File.join(dirname, basename, 'rpm')
342
329
  if require_rebuild?(rpm, srpm)
343
- cmd = %Q(#{mock_cmd} --root #{args.chroot} #{mocksnap} #{srpm})
330
+ cmd = %Q(#{mock_cmd} --root #{args[:chroot]} #{mocksnap} #{srpm})
344
331
 
345
332
  sh cmd
346
333
  end
@@ -348,7 +335,7 @@ module Simp::Rake
348
335
 
349
336
  # remote chroot unless told not to (saves LOTS of space during ISO builds)
350
337
  unless ENV['SIMP_RAKE_MOCK_cleanup'] == 'no'
351
- cmd = %Q(#{mock_cmd} --root #{args.chroot} --clean)
338
+ cmd = %Q(#{mock_cmd} --root #{args[:chroot]} --clean)
352
339
  sh cmd
353
340
  end
354
341
  end
@@ -365,7 +352,7 @@ module Simp::Rake
365
352
  task :scrub,[:chroot,:unique] do |t,args|
366
353
  args.with_defaults(:unique => false)
367
354
 
368
- mock_cmd = mock_pre_check( args.chroot, @chroot_name, args.unique, false )
355
+ mock_cmd = mock_pre_check( args[:chroot], @chroot_name, args[:unique], false )
369
356
  cmd = %Q(#{mock_cmd} --scrub=all)
370
357
  sh cmd
371
358
  end
@@ -422,18 +409,18 @@ module Simp::Rake
422
409
  "Error: No mock chroot provided. Your choices are:\n #{mock_configs.join("\n ")}"
423
410
  )
424
411
  end
412
+
425
413
  unless mock_configs.include?(chroot)
426
414
  raise(Exception,
427
415
  "Error: Invalid mock chroot provided. Your choices are:\n #{mock_configs.join("\n ")}"
428
416
  )
429
417
  end
430
418
 
431
- raise %Q(unique_ext must be a String ("#{unique_ext}" = #{unique_ext.class})) unless unique_ext.is_a? String
419
+ raise %Q(unique_ext must be a String ("#{unique_ext}" = #{unique_ext.class})) unless unique_ext.is_a?(String)
432
420
 
433
421
  # if true, restrict yum to the chroot's local yum cache (defaults to false)
434
422
  mock_offline = ENV.fetch( 'SIMP_RAKE_MOCK_OFFLINE', 'N' ).chomp.index( %r{^(1|Y|true|yes)$} ) || false
435
423
 
436
- #mock_cmd = "#{mock} -D 'pup_module_info_dir #{@spec_info_dir}' --quiet"
437
424
  mock_cmd = "#{mock} --quiet"
438
425
  mock_cmd += " --uniqueext=#{unique_ext}" if unique
439
426
  mock_cmd += ' --offline' if mock_offline