From: Daniel P. Berrangé <[email protected]> Passing warning flags to the C compiler results in incredibly long command lines, which in turns results in incredibly large CI log files. Our logs are so large that they often exceed the GitLab file limits.
We've cut out the irrelevant cruft from the logs and they're still too large. The only option left is to stop passing so many args to the compiler. Fortunately it is easy to achieve this with GCC/CLang as when seeing an argument "@somepath" they will treat each line in "somepath" as being an additional compiler argument. Putting the warning flags in a 'c-warnings.txt' file is fairly easy and a massive win. We don't loose anything from the CI logs as we print the full set of warning flags at the end of running 'meson'. Meanwhile for interactive builds the flags are visible in the c-warning.txt file in the build directory root. Signed-off-by: Daniel P. Berrangé <[email protected]> --- meson.build | 114 ++++++++++++++++++++------------------ scripts/meson-warnings.py | 9 +++ 2 files changed, 69 insertions(+), 54 deletions(-) create mode 100644 scripts/meson-warnings.py diff --git a/meson.build b/meson.build index d72c8e7a23..964d1fa4e1 100644 --- a/meson.build +++ b/meson.build @@ -232,6 +232,59 @@ libvirt_revision = arr_version[2].to_int() libvirt_lib_version = '@0@.@1@.@2@'.format(libvirt_so_version, libvirt_age, libvirt_revision) +# Where we look for daemons and admin binaries during configure + +libvirt_sbin_path = [] + +if host_machine.system() != 'windows' + libvirt_sbin_path += [ + '/sbin', + '/usr/sbin', + '/usr/local/sbin', + ] +endif + + +# required programs check + +required_programs = [ + 'perl', + 'python3', + 'xmllint', + 'xsltproc', +] + +foreach name : required_programs + prog = find_program(name, dirs: libvirt_sbin_path) + varname = name.underscorify() + set_variable('@0@_prog'.format(varname), prog) +endforeach + +# optional programs + +optional_programs = [ + 'augparse', + 'black', + 'flake8', + 'pdwtags', + 'pytest', +] + +missing_optional_programs = [] +foreach name : optional_programs + prog = find_program(name, required: false, dirs: libvirt_sbin_path) + varname = name.underscorify() + if prog.found() + prog_path = prog.full_path() + else + prog_path = name + missing_optional_programs += [ name ] + endif + + set_variable('@0@_prog'.format(varname), prog) +endforeach + + # check compile flags cc = meson.get_compiler('c') @@ -534,7 +587,13 @@ if get_option('warning_level') == '2' endif endif -add_project_arguments(supported_cc_flags, language: 'c') + +run_command([python3_prog, + 'scripts' / 'meson-warnings.py', + meson.current_build_dir() / 'c-warnings.txt'] + supported_cc_flags, + check: true) + +add_project_arguments('@' + meson.current_build_dir() / 'c-warnings.txt', language: 'c') if cc.has_argument('-Wsuggest-attribute=format') conf.set('WITH_SUGGEST_ATTRIBUTE_FORMAT', 1) @@ -809,59 +868,6 @@ endforeach conf.set('SIZEOF_LONG', cc.sizeof('long')) -# Where we look for daemons and admin binaries during configure - -libvirt_sbin_path = [] - -if host_machine.system() != 'windows' - libvirt_sbin_path += [ - '/sbin', - '/usr/sbin', - '/usr/local/sbin', - ] -endif - - -# required programs check - -required_programs = [ - 'perl', - 'python3', - 'xmllint', - 'xsltproc', -] - -foreach name : required_programs - prog = find_program(name, dirs: libvirt_sbin_path) - varname = name.underscorify() - set_variable('@0@_prog'.format(varname), prog) -endforeach - -# optional programs - -optional_programs = [ - 'augparse', - 'black', - 'flake8', - 'pdwtags', - 'pytest', -] - -missing_optional_programs = [] -foreach name : optional_programs - prog = find_program(name, required: false, dirs: libvirt_sbin_path) - varname = name.underscorify() - if prog.found() - prog_path = prog.full_path() - else - prog_path = name - missing_optional_programs += [ name ] - endif - - set_variable('@0@_prog'.format(varname), prog) -endforeach - - # early checks where lot of other packages depend on the result if not get_option('driver_remote').disabled() diff --git a/scripts/meson-warnings.py b/scripts/meson-warnings.py new file mode 100644 index 0000000000..27b0d45631 --- /dev/null +++ b/scripts/meson-warnings.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python3 + +import shutil +import sys + +with open(sys.argv[1], "w") as out: + for w in sys.argv[2:]: + print(w, file=out) + -- 2.52.0
