Tweak live_build mock handling to work with templates

mock is changing the config files to be based on templates,
which breaks how we generate the live build mock config. This
should work with both the old and new config files.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2019-09-23 16:00:08 -07:00
parent b32449f72a
commit 8be0541ce7

View File

@ -12,14 +12,14 @@ sub run {
my $lcsubv = lc($subv); my $lcsubv = lc($subv);
# install the tools we need # install the tools we need
assert_script_run "dnf -y install mock git pykickstart tar", 120; assert_script_run "dnf -y install mock git pykickstart tar", 120;
# base mock config on original
assert_script_run "echo \"include('/etc/mock/fedora-${version}-${arch}.cfg')\" > /etc/mock/openqa.cfg";
# make the update/task repo and the serial device available inside the mock root # make the update/task repo and the serial device available inside the mock root
assert_script_run 'echo "config_opts[\'plugin_conf\'][\'bind_mount_enable\'] = True" > /etc/mock/openqa.cfg'; assert_script_run 'echo "config_opts[\'plugin_conf\'][\'bind_mount_enable\'] = True" >> /etc/mock/openqa.cfg';
assert_script_run 'echo "config_opts[\'plugin_conf\'][\'bind_mount_opts\'][\'dirs\'].append((\'/opt/update_repo\', \'/opt/update_repo\'))" >> /etc/mock/openqa.cfg'; assert_script_run 'echo "config_opts[\'plugin_conf\'][\'bind_mount_opts\'][\'dirs\'].append((\'/opt/update_repo\', \'/opt/update_repo\'))" >> /etc/mock/openqa.cfg';
assert_script_run 'echo "config_opts[\'plugin_conf\'][\'bind_mount_opts\'][\'dirs\'].append((\'/dev/' . $serialdev . '\', \'/dev/' . $serialdev . '\'))" >> /etc/mock/openqa.cfg'; assert_script_run 'echo "config_opts[\'plugin_conf\'][\'bind_mount_opts\'][\'dirs\'].append((\'/dev/' . $serialdev . '\', \'/dev/' . $serialdev . '\'))" >> /etc/mock/openqa.cfg';
# now append the whole 'stock' config except for the final """ line # add the side repo to the config
assert_script_run "head -n-1 /etc/mock/fedora-${version}-${arch}.cfg >> /etc/mock/openqa.cfg"; assert_script_run 'printf "config_opts[\'yum.conf\'] += \"\"\"\n[advisory]\nname=Advisory repo\nbaseurl=file:///opt/update_repo\nenabled=1\nmetadata_expire=3600\ngpgcheck=0\n\"\"\"" >> /etc/mock/openqa.cfg';
# now add the side repo to the config
assert_script_run 'printf "[advisory]\nname=Advisory repo\nbaseurl=file:///opt/update_repo\nenabled=1\nmetadata_expire=3600\ngpgcheck=0\n\"\"\"" >> /etc/mock/openqa.cfg';
# replace metalink with mirrorlist so we don't get slow mirrors # replace metalink with mirrorlist so we don't get slow mirrors
repos_mirrorlist("/etc/mock/openqa.cfg"); repos_mirrorlist("/etc/mock/openqa.cfg");
# upload the config so we can check it's OK # upload the config so we can check it's OK