From Fedora Project Wiki
No edit summary
(+scan-build)
Line 25: Line 25:
   </li>
   </li>
</ul>
</ul>
== Using [http://clang-analyzer.llvm.org/scan-build.html scan-build] for unmodified packages ==
* Add /usr/bin/scan-build to per-chroot config files' <code>chroot_setup_cmd</code> for which you want to use it, for example:
<pre>config_opts['chroot_setup_cmd'] = 'install @buildsys-build /usr/bin/scan-build'</pre>
* Set up a shell alias and use it instead of plain mock (everything on one line):
<pre>alias mock-scan-build="mock --define '__scan_build /usr/bin/scan-build' --define '_configure %__scan_build ./configure' --define '__cmake %__scan_build %{_bindir}/cmake' --define '__make %__scan_build %{_bindir}/make' --define '___build_template #!%{___build_shell}\\"$'\n'"alias make=\"%__make\" cmake=\"%__cmake\"\\"$'\n'"%{___build_pre}\\"$'\n'"%{nil}'"</pre>
* See generated reports in the chroot's <code>/tmp</code>

Revision as of 09:46, 31 December 2013

Some tips for speeding up mock via its configuration:

  • /etc/mock/site-defaults.cfg
    • Disable the package state plugin:
      config_opts['plugin_conf']['package_state_enable'] = False
    • Parallelize builds:
      config_opts['macros']['%_smp_mflags'] = "-j17"
    • Improve ccache hits between package version builds (may break -debuginfos!):
      config_opts['files']['etc/profile.d/zz-local.sh'] = """
      unset CCACHE_HASHDIR
      """
    • Compress ccache:
      config_opts['plugin_conf']['ccache_opts']['compress'] = True
    • Use lzo compression for root cache:
      config_opts['plugin_conf']['root_cache_opts']['compress_program'] = "lzop"
      config_opts['plugin_conf']['root_cache_opts']['extension'] = ".lzo"
  • Per-repo config files
    • Parallelize (de)compression within rpmbuild:
      config_opts['chroot_setup_cmd'] = 'install @buildsys-build /usr/bin/pigz /usr/bin/lbzip2'
      config_opts['macros']['%__gzip'] = '/usr/bin/pigz'
      config_opts['macros']['%__bzip2'] = '/usr/bin/lbzip2'

Using scan-build for unmodified packages

  • Add /usr/bin/scan-build to per-chroot config files' chroot_setup_cmd for which you want to use it, for example:
config_opts['chroot_setup_cmd'] = 'install @buildsys-build /usr/bin/scan-build'
  • Set up a shell alias and use it instead of plain mock (everything on one line):
alias mock-scan-build="mock --define '__scan_build /usr/bin/scan-build' --define '_configure %__scan_build ./configure' --define '__cmake %__scan_build %{_bindir}/cmake' --define '__make %__scan_build %{_bindir}/make' --define '___build_template #!%{___build_shell}\\"$'\n'"alias make=\"%__make\" cmake=\"%__cmake\"\\"$'\n'"%{___build_pre}\\"$'\n'"%{nil}'"
  • See generated reports in the chroot's /tmp