From Fedora Project Wiki
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
Some tips for speeding up mock via its configuration:
== Speeding up ==


<ul>
<ul>
Line 11: Line 11:
"""</pre></li>
"""</pre></li>
     <li>Compress ccache: <pre>config_opts['plugin_conf']['ccache_opts']['compress'] = True</pre></li>
     <li>Compress ccache: <pre>config_opts['plugin_conf']['ccache_opts']['compress'] = True</pre></li>
     <li>Use lzo compression for root cache:
     <li>Use LZ4 compression for root cache:
       <pre>config_opts['plugin_conf']['root_cache_opts']['compress_program'] = "lzop"
       <pre>config_opts['plugin_conf']['root_cache_opts']['compress_program'] = "lz4"
config_opts['plugin_conf']['root_cache_opts']['extension'] = ".lzo"</pre></li>
config_opts['plugin_conf']['root_cache_opts']['extension'] = ".lz4"</pre></li>
     </ul>
     </ul>
   </li>
   </li>
Line 32: Line 32:


* Set up a shell alias and use it instead of plain mock (everything on one line):
* 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>
<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 '__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}'"</pre>


* See generated reports in the chroot's <code>/tmp</code>
* See generated reports in the chroot's <code>/tmp</code>

Latest revision as of 17:40, 2 February 2014

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