build.py: Add option for 7z multi-threading behavior

Fixes: QTCREATORBUG-25590
Change-Id: I4234928cfd4e2d76afe5acf76cd53eb1d67fa5a0
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Eike Ziller
2021-04-21 12:49:09 +02:00
parent 46fedb7697
commit 9d8be9ce58

View File

@@ -108,6 +108,9 @@ def get_arguments():
action='append', dest='config_args', default=[]) action='append', dest='config_args', default=[])
parser.add_argument('--zip-infix', help='Adds an infix to generated zip files, use e.g. for a build number.', parser.add_argument('--zip-infix', help='Adds an infix to generated zip files, use e.g. for a build number.',
default='') default='')
parser.add_argument('--zip-threads', help='Sets number of threads to use for 7z. Use "+" for turning threads on '
'without a specific number of threads. This is directly passed to the "-mmt" option of 7z.',
default='2')
args = parser.parse_args() args = parser.parse_args()
args.with_debug_info = args.build_type == 'RelWithDebInfo' args.with_debug_info = args.build_type == 'RelWithDebInfo'
@@ -247,26 +250,26 @@ def build_qtcreatorcdbext(args, paths):
def package_qtcreator(args, paths): def package_qtcreator(args, paths):
if not args.no_zip: if not args.no_zip:
if not args.no_qtcreator: if not args.no_qtcreator:
common.check_print_call(['7z', 'a', '-mmt2', common.check_print_call(['7z', 'a', '-mmt' + args.zip_threads,
os.path.join(paths.result, 'qtcreator' + args.zip_infix + '.7z'), os.path.join(paths.result, 'qtcreator' + args.zip_infix + '.7z'),
'*'], '*'],
paths.install) paths.install)
common.check_print_call(['7z', 'a', '-mmt2', common.check_print_call(['7z', 'a', '-mmt' + args.zip_threads,
os.path.join(paths.result, 'qtcreator' + args.zip_infix + '_dev.7z'), os.path.join(paths.result, 'qtcreator' + args.zip_infix + '_dev.7z'),
'*'], '*'],
paths.dev_install) paths.dev_install)
if args.with_debug_info: if args.with_debug_info:
common.check_print_call(['7z', 'a', '-mmt2', common.check_print_call(['7z', 'a', '-mmt' + args.zip_threads,
os.path.join(paths.result, 'qtcreator' + args.zip_infix + '-debug.7z'), os.path.join(paths.result, 'qtcreator' + args.zip_infix + '-debug.7z'),
'*'], '*'],
paths.debug_install) paths.debug_install)
if common.is_windows_platform(): if common.is_windows_platform():
common.check_print_call(['7z', 'a', '-mmt2', common.check_print_call(['7z', 'a', '-mmt' + args.zip_threads,
os.path.join(paths.result, 'wininterrupt' + args.zip_infix + '.7z'), os.path.join(paths.result, 'wininterrupt' + args.zip_infix + '.7z'),
'*'], '*'],
paths.wininterrupt_install) paths.wininterrupt_install)
if not args.no_cdb: if not args.no_cdb:
common.check_print_call(['7z', 'a', '-mmt2', common.check_print_call(['7z', 'a', '-mmt' + args.zip_threads,
os.path.join(paths.result, 'qtcreatorcdbext' + args.zip_infix + '.7z'), os.path.join(paths.result, 'qtcreatorcdbext' + args.zip_infix + '.7z'),
'*'], '*'],
paths.qtcreatorcdbext_install) paths.qtcreatorcdbext_install)