@@ -332,12 +332,13 @@ def parser():
332
332
parser .add_argument (
333
333
"--tiny" ,
334
334
action = "store_true" ,
335
- help = "Use Linux tiny configuration. Incompatible with --config "
335
+ help = "Use Linux tiny configuration. Incompatible with --configs "
336
336
"argument."
337
337
)
338
338
parser .add_argument (
339
- "--config" ,
340
- help = "Give a path to specific configuration file. Incompatible with "
339
+ "--configs" ,
340
+ nargs = "+" , # if --config, need to give at least one .config
341
+ help = "Give a path to specific configuration files. Incompatible with "
341
342
"--tiny argument."
342
343
)
343
344
parser .add_argument (
@@ -366,7 +367,7 @@ def parser():
366
367
"--unit_testing" ,
367
368
action = "store_true" ,
368
369
help = "Optional. Run the unit testing of the compilation script. Prevent"
369
- " any compilation to happen. Will disable --tiny, --config , "
370
+ " any compilation to happen. Will disable --tiny, --configs , "
370
371
"--linux_version, --silent, --fetch_kernel and incremental "
371
372
"feature during runtime."
372
373
)
@@ -399,9 +400,25 @@ def check_precondition_and_warning(args):
399
400
# precondition
400
401
if args .nbcontainer <= 0 :
401
402
raise ValueError ("You can't run less than 1 container for compilation." )
403
+
404
+ # If we get more that 1 .config, the argument args.nbcontainer
405
+ # will be ignored and the number of containers to create should be
406
+ # as much as the number of given configuration files. Hence, the
407
+ # following condition should be enough:
408
+ # if args.nbcontainer is more than the default value
409
+ # and we got more than one config file
410
+ # | raise Warning("You do not need to set nbcontainer if you\
411
+ # | give many configuration files")
412
+ # +----
413
+ # The default value for args.nbcontainer is 1. Even if the user
414
+ # does not give this argument, it will be set to 1 automatically.
415
+ if args .nbcontainer > 1 and len (args .configs ) > 1 :
416
+ raise Warning (
417
+ "You do not need to set nbcontainer if you give many configuration\
418
+ files" )
402
419
if args .incremental < 0 :
403
420
raise ValueError ("You can't use incremental with negative value." )
404
- if args .tiny and (args .config is not None ):
421
+ if args .tiny and (args .configs is not None ):
405
422
raise NotImplementedError (
406
423
"You can't use tiny and config parameter at the same time."
407
424
)
@@ -413,7 +430,7 @@ def check_precondition_and_warning(args):
413
430
if args .unit_testing :
414
431
args .incremental = 0
415
432
args .tiny = None
416
- args .config = None
433
+ args .configs = None
417
434
args .silent = None
418
435
419
436
# not implemented yet
@@ -440,9 +457,10 @@ def check_precondition_and_warning(args):
440
457
"out to date, or you could crash if you don't have the image." )
441
458
if args .tiny :
442
459
print ("You are using tiny configuration." )
443
- if args .config is not None :
444
- print ("You are using your specific configuration : {}" .format (
445
- args .config ))
460
+ if args .configs is not None :
461
+ print ("You are using the following configuration(s):" )
462
+ for conf in args .configs :
463
+ print ("\t * {}" .format (conf ))
446
464
if args .seed is not None :
447
465
print ("You are using your specific set of seed options" )
448
466
if args .unit_testing :
@@ -835,7 +853,14 @@ def compilation(image, args):
835
853
:param args: parsed argument options
836
854
:type args: `argparse.Namespace`_
837
855
"""
838
- for i in range (args .nbcontainer ):
856
+ nbcontainer = args .nbcontainer
857
+ nbconfigs = len (args .configs )
858
+ # One does not care about nbcontainer as far as one gets more than
859
+ # one configs.
860
+ if nbconfigs > 1 :
861
+ nbcontainer = nbconfigs
862
+
863
+ for i in range (nbcontainer ):
839
864
if not args .silent :
840
865
set_prompt_color ("Light_Blue" )
841
866
print ("\n =============== Docker number " , i , " ===============" )
@@ -844,7 +869,7 @@ def compilation(image, args):
844
869
image ,
845
870
args .incremental ,
846
871
args .tiny ,
847
- args .config ,
872
+ args .configs [ i ] ,
848
873
args .seed ,
849
874
args .silent ,
850
875
args .number_cpu ,
@@ -855,7 +880,7 @@ def compilation(image, args):
855
880
fetch_logs (container_id , args .logs , args .silent )
856
881
delete_docker_container (container_id )
857
882
if not args .silent :
858
- feedback_user (args . nbcontainer , args .incremental )
883
+ feedback_user (nbcontainer , args .incremental )
859
884
860
885
861
886
def run_unit_testing (image ):
0 commit comments