Merge branch 'master' into f26

This commit is contained in:
Bruno Goncalves 2017-06-07 15:49:08 +02:00
commit b8ec84d374
4 changed files with 26 additions and 49 deletions

View file

@ -12,6 +12,7 @@ cyrus-sasl-lib
elfutils-libelf
expat
fedora-modular-release
fedora-modular-repos
filesystem
gawk
glib2

View file

@ -25,6 +25,7 @@ elfutils-libs
emacs-filesystem
expat
fedora-modular-release
fedora-modular-repos
filesystem
gawk
gc

View file

@ -101,53 +101,20 @@ class BaseRuntimeSetupDocker(Test, module_framework.CommonFunctions):
self.log.info("command '%s' succeeded with output:\n%s" %
(cmd, cmd_output))
def _configure_mock_microdnf(self):
"""
Configure mock chroot for microdnf so it carrys into the docker image
"""
def _set_dnf_conf(self):
filename = "/etc/dnf/dnf.conf"
path = "/var/lib/mock/" + self.mock_root + "/root" + filename
# fetch the dnf.conf file from the mock chroot that was conveniently
# created based on the yum.conf value in the mock configuration file
tmpdnfcfg = tempfile.NamedTemporaryFile(delete=False)
self._run_command('mock -r %s --copyout /etc/dnf/dnf.conf %s' %
(self.mockcfg, tmpdnfcfg.name))
conf = "EOF\n"
conf += "[main]\n"
conf += "gpgcheck=1\n"
conf += "installonly_limit=3\n"
conf += "clean_requirements_on_remove=True\n"
conf += "EOF\n"
with open(tmpdnfcfg.name, 'r') as dnffile:
contents = dnffile.read()
self.log.info(
"Contents of original dnf.conf generated by mock:\n%s" % contents)
cmd = "sudo tee %s << %s" % (path, conf)
self._run_command(cmd)
# load the dnf.conf file and remove the [main] section so only the
# repo section(s) remain
config = configparser.ConfigParser()
config.read(tmpdnfcfg.name)
self.log.info("Found the following configuration section(s): %s" %
' '.join(config.sections()))
if 'main' in config:
del config['main']
# write out the cleaned up repo configuration
tmpyumcfg = tempfile.NamedTemporaryFile(delete=False)
with open(tmpyumcfg.name, 'w') as repofile:
config.write(repofile, space_around_delimiters=False)
with open(tmpyumcfg.name, 'r') as yumfile:
contents = yumfile.read()
self.log.info("Contents of revised yum repo config:\n%s" % contents)
# copy the new yum repo configuration file into the mock chroot
self._run_command(
'mock -r %s --copyin %s /etc/yum.repos.d/build.repo' % (self.mockcfg, tmpyumcfg.name))
self._run_command(
'mock -r %s --chroot "chmod 644 /etc/yum.repos.d/build.repo"' % self.mockcfg)
# remove the temporary files
os.remove(tmpdnfcfg.name)
os.remove(tmpyumcfg.name)
# /etc/pki/rpm-gpg directory must exist or microdnf will explode
self._run_command(
'mock -r %s --chroot "mkdir -p -m=755 /etc/pki/rpm-gpg"' % self.mockcfg)
def testCreateDockerImage(self):
@ -165,8 +132,7 @@ class BaseRuntimeSetupDocker(Test, module_framework.CommonFunctions):
# Initialize chroot with mock
self._run_command('mock -r %s --init' % self.mockcfg)
# Configure mock chroot for microdnf so it carrys into the docker image
self._configure_mock_microdnf()
self._set_dnf_conf()
# check if "sudo" allows us to tar up the chroot without a password
# Note: this must be configured in "sudoers" to work!

View file

@ -278,6 +278,15 @@ class BaseRuntimeSmokeTest(module_framework.AvocadoTest):
except:
self.error("Could not remove %s" % lang["pkg"])
def test_dnf(self):
"""
Check if DNF is able to install a package
"""
package = "tar"
self.run("microdnf install dnf")
self.run("dnf install -y %s" % package)
self.run("dnf remove -y %s" % package)
self.run("microdnf remove dnf")
def _prepare_compiler_test_directory(self):