from __future__ import print_function
import os
+import random
import re
import sys
import glob
hlp = hlp % ", ".join(ALL_FEATURES)
parent_parser2.add_argument('-x', '--without', metavar='FEATURE', nargs='+', default=set(),
action=CollectCommaSeparatedArgsAction, help=hlp)
+ parent_parser2.add_argument('--with-randomly', metavar='FEATURE', nargs='+', default=set(),
+ action=CollectCommaSeparatedArgsAction, help=hlp)
parent_parser2.add_argument('-l', '--leave-system', action='store_true',
help='At the end of the command do not destroy vagrant system. Default behavior is '
'destroying the system.')
execute('vagrant destroy', cwd=path, interactive=True)
+def _coin_toss():
+ if random.randint(0, 65535) % 2 == 0:
+ return True
+ return False
+
+
def _get_features(args):
features = set(vars(args)['with'])
# distcheck is not compatible with defaults so do not add defaults
features = features.union(DEFAULT_FEATURES)
- nofeatures = set(args.without)
- features = features.difference(nofeatures)
-
- if hasattr(args, 'ccache_dir') and args.ccache_dir:
- features.add('ccache')
-
# if we build native packages then some features are required and some not
if 'native-pkg' in features:
features.add('docs')
if args.command == 'build':
features.discard('unittest')
+ nofeatures = set(args.without)
+ features = features.difference(nofeatures)
+
+ for i in args.with_randomly:
+ if _coin_toss():
+ features.add(i)
+ log.info(f'Feature enabled through coin toss: {i}')
+ else:
+ features.discard(i)
+ log.info(f'Feature disabled through coin toss: {i}')
+
+ if hasattr(args, 'ccache_dir') and args.ccache_dir:
+ features.add('ccache')
+
return sorted(features)