createrepo: Allow disabling SQLite database

This is an optimization for Yum. DNF does not care at all.

The behaviour is configurable, but the default depends on gather
backend, as that is what users should be using to consume the packages
from the repo.

Fixes: https://pagure.io/pungi/issue/951
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2018-05-18 10:17:41 +02:00
parent 1afb709404
commit b4e746aa71
7 changed files with 73 additions and 1 deletions

View file

@ -481,6 +481,24 @@ class StatusTest(unittest.TestCase):
self.assertTrue(self.compose.notifier.send.call_count, 1)
def test_no_database_with_dnf_backend(self):
self.compose.conf['gather_backend'] = 'dnf'
self.assertFalse(self.compose.should_create_yum_database)
def test_no_database_with_dnf_backend_config_override(self):
self.compose.conf['gather_backend'] = 'dnf'
self.compose.conf['createrepo_database'] = True
self.assertTrue(self.compose.should_create_yum_database)
def test_no_database_with_yum_backend(self):
self.compose.conf['gather_backend'] = 'yum'
self.assertTrue(self.compose.should_create_yum_database)
def test_no_database_with_yum_backend_config_override(self):
self.compose.conf['gather_backend'] = 'yum'
self.compose.conf['createrepo_database'] = False
self.assertFalse(self.compose.should_create_yum_database)
if __name__ == "__main__":
unittest.main()