From: Matt McCutchen Date: Fri, 18 Sep 2020 14:39:56 +0000 (-0400) Subject: Add mock configuration for building against the local dnf repository X-Git-Url: https://mattmccutchen.net/utils/utils.git/commitdiff_plain/8c4150947c51cf62201a47c15c45f11888a23f8f Add mock configuration for building against the local dnf repository configuration. --- diff --git a/mock/host.cfg b/mock/host.cfg new file mode 100644 index 0000000..fe983c6 --- /dev/null +++ b/mock/host.cfg @@ -0,0 +1,56 @@ +# Mock configuration file to build against the local system's dnf repository +# configuration. +# https://mattmccutchen.net/utils/#rpm +# +# This file contains some settings tuned for building in Qubes OS template-based +# VMs, but you can easily change them for other environments. + +config_opts['root'] = 'host' +# TODO: Can we detect this automatically? +config_opts['target_arch'] = 'x86_64' + +# Try without root cache? +config_opts['plugin_conf']['root_cache_enable'] = False + +# For now, we are sharing the host yum cache. If we want a separate one, we +# can enable this plugin. +config_opts['plugin_conf']['yum_cache_enable'] = False + +# We do not need the "bootstrap" feature since the host's RPM stack is the same +# as the target's. +config_opts['use_bootstrap'] = False + +config_opts['dnf_common_opts'] = [ + + # Share the host dnf configuration. + '--config=/etc/dnf/dnf.conf', + '--setopt=reposdir=/etc/yum.repos.d', + + # And the releasever. + '--releasever=/', + + # And the cache. Binding this with the bind_mount plugin does not work since + # it is considered a "user mount" and doesn't get mounted in time. + '--setopt=cachedir=/var/cache/dnf', + + # qubes-hooks signals Qubes OS about changes to the real VM. We don't want to + # run it for changes to a mock environment. + '--disableplugin=qubes-hooks', + + # If we build the same package several times in a row on the same run of a VM + # (a common case if there is a problem on the first try), avoid downloading + # the build dependencies multiple times. I think a real VM transaction could + # lose the packages, but that should be uncommon and not worth worrying about + # now. VM restart provides a reasonable lifespan for us to clear the cache. + '--setopt=keepcache=1', + + # Looks like we need this. Fedora's mock configs put it in the generated + # dnf.conf. + '--assumeyes', +] + +# /var/cache/mock shouldn't be used for anything important right now, but if we +# want to make it persistent, the plan is to make it a symlink to /home/mock-cache . + +# mock raises an error if this is not set. +config_opts['dnf.conf'] = 'THIS IS A SYNTAX ERROR; THIS FILE SHOULD NOT BE USED'