User:Scop/MockTips

From FedoraProject

Jump to: navigation, search

Speeding up

  • /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 LZ4 compression for root cache:
      config_opts['plugin_conf']['root_cache_opts']['compress_program'] = "lz4"
      config_opts['plugin_conf']['root_cache_opts']['extension'] = ".lz4"
  • 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 '__spec_build_template #!%{__spec_build_shell}\\"$'\n'"alias make=\"%__make\" cmake=\"%__cmake\"\\"$'\n'"%{__spec_build_pre}\\"$'\n'"%{nil}' --define '___build_template #!%{___build_shell}\\"$'\n'"alias make=\"%__make\" cmake=\"%__cmake\"\\"$'\n'"%{___build_pre}\\"$'\n'"%{nil}'"
  • See generated reports in the chroot's /tmp