@@ -241,6 +241,7 @@ def main():
241
241
"even number of arguments" ))
242
242
243
243
if args .prep_only :
244
+ os .makedirs ("workingdir" , exists_ok = True )
244
245
package (args , url , name , archives , "./workingdir" , infile_dict )
245
246
else :
246
247
with tempfile .TemporaryDirectory () as workingdir :
@@ -249,25 +250,25 @@ def main():
249
250
250
251
def package (args , url , name , archives , workingdir , infile_dict ):
251
252
"""Entry point for building a package with autospec."""
252
- conf = config .Config ()
253
+ conf = config .Config (args . target )
253
254
check_requirements (args .git )
254
- package = build .Build (workingdir )
255
+ package = build .Build ()
255
256
256
257
#
257
258
# First, download the tarball, extract it and then do a set
258
259
# of static analysis on the content of the tarball.
259
260
#
260
261
filemanager = files .FileManager (conf , package )
261
- content = tarball .Content (url , name , args .version , archives , conf )
262
- content .process (args . target , filemanager )
263
- conf .create_versions (package . download_path , content .multi_version )
262
+ content = tarball .Content (url , name , args .version , archives , conf , workingdir )
263
+ content .process (filemanager )
264
+ conf .create_versions (content .multi_version )
264
265
conf .content = content # hack to avoid recursive dependency on init
265
266
# Search up one level from here to capture multiple versions
266
267
_dir = content .path
267
268
268
269
if args .license_only :
269
270
try :
270
- with open (os .path .join (package .download_path ,
271
+ with open (os .path .join (conf .download_path ,
271
272
content .name + ".license" ), "r" ) as dotlic :
272
273
for word in dotlic .read ().split ():
273
274
if ":" not in word :
@@ -282,20 +283,20 @@ def package(args, url, name, archives, workingdir, infile_dict):
282
283
conf .config_file = args .config
283
284
requirements = buildreq .Requirements (content .url )
284
285
requirements .set_build_req ()
285
- conf .parse_config_files (package . download_path , args .bump , filemanager , content .version , requirements )
286
+ conf .parse_config_files (args .bump , filemanager , content .version , requirements )
286
287
conf .setup_patterns (conf .failed_pattern_dir )
287
- conf .parse_existing_spec (package . download_path , content .name )
288
+ conf .parse_existing_spec (content .name )
288
289
289
290
if args .prep_only :
290
291
write_prep (conf , workingdir , content )
291
292
exit (0 )
292
293
293
- requirements .scan_for_configure (_dir , content .name , package . download_path , conf )
294
+ requirements .scan_for_configure (_dir , content .name , conf )
294
295
specdescription .scan_for_description (content .name , _dir , conf .license_translations , conf .license_blacklist )
295
296
# Start one directory higher so we scan *all* versions for licenses
296
297
license .scan_for_licenses (os .path .dirname (_dir ), conf , content .name )
297
- commitmessage .scan_for_changes (package .download_path , _dir , conf .transforms )
298
- add_sources (package .download_path , archives , content )
298
+ commitmessage .scan_for_changes (conf .download_path , _dir , conf .transforms )
299
+ add_sources (conf .download_path , archives , content )
299
300
check .scan_for_tests (_dir , conf , requirements , content )
300
301
301
302
#
@@ -323,14 +324,14 @@ def package(args, url, name, archives, workingdir, infile_dict):
323
324
324
325
if args .integrity :
325
326
interactive_mode = not args .non_interactive
326
- pkg_integrity .check (url , package . download_path , conf , interactive = interactive_mode )
327
+ pkg_integrity .check (url , conf , interactive = interactive_mode )
327
328
pkg_integrity .load_specfile (specfile )
328
329
329
- specfile .write_spec (package . download_path )
330
+ specfile .write_spec ()
330
331
while 1 :
331
332
package .package (filemanager , args .mock_config , args .mock_opts , conf , requirements , content , args .cleanup )
332
333
filemanager .load_specfile (specfile )
333
- specfile .write_spec (package . download_path )
334
+ specfile .write_spec ()
334
335
filemanager .newfiles_printed = 0
335
336
mock_chroot = "/var/lib/mock/clear-{}/root/builddir/build/BUILDROOT/" \
336
337
"{}-{}-{}.x86_64" .format (package .uniqueext ,
@@ -344,12 +345,12 @@ def package(args, url, name, archives, workingdir, infile_dict):
344
345
if package .round > 20 or package .must_restart == 0 :
345
346
break
346
347
347
- save_mock_logs (package .download_path , package .round )
348
+ save_mock_logs (conf .download_path , package .round )
348
349
349
- check .check_regression (package .download_path , conf .config_opts ['skip_tests' ])
350
+ check .check_regression (conf .download_path , conf .config_opts ['skip_tests' ])
350
351
351
352
if package .success == 0 :
352
- conf .create_buildreq_cache (package . download_path , content .version , requirements .buildreqs_cache )
353
+ conf .create_buildreq_cache (content .version , requirements .buildreqs_cache )
353
354
print_fatal ("Build failed, aborting" )
354
355
sys .exit (1 )
355
356
elif os .path .isfile ("README.clear" ):
@@ -363,20 +364,20 @@ def package(args, url, name, archives, workingdir, infile_dict):
363
364
except Exception :
364
365
pass
365
366
366
- examine_abi (package .download_path , content .name )
367
+ examine_abi (conf .download_path , content .name )
367
368
if os .path .exists ("/var/lib/rpm" ):
368
369
pkg_scan .get_whatrequires (content .name , conf .yum_conf )
369
370
370
- write_out (package .download_path + "/release" , content .release + "\n " )
371
+ write_out (conf .download_path + "/release" , content .release + "\n " )
371
372
372
373
# record logcheck output
373
- logcheck (package .download_path )
374
+ logcheck (conf .download_path )
374
375
375
- commitmessage .guess_commit_message (pkg_integrity .IMPORTED , conf , content , package )
376
- conf .create_buildreq_cache (package . download_path , content .version , requirements .buildreqs_cache )
376
+ commitmessage .guess_commit_message (pkg_integrity .IMPORTED , conf , content )
377
+ conf .create_buildreq_cache (content .version , requirements .buildreqs_cache )
377
378
378
379
if args .git :
379
- git .commit_to_git (package . download_path , conf , content .name , package .success )
380
+ git .commit_to_git (conf , content .name , package .success )
380
381
else :
381
382
print ("To commit your changes, git add the relevant files and "
382
383
"run 'git commit -F commitmsg'" )
0 commit comments