The location of the rpm database is no longer a standard path one can trust. Some distributions put it to /var/lib others to /usr/lib. This introduces the problem of dealing with different locations between the bootstrapping (host rpm) phase and the image installation (image rpm) phase. This commit implements a solution based on an intermediate rpm database configuration. KIWI creates the macros.kiwi file inside of the image root which is read by any call of rpm in the inner and outer system. During bootstrap phase the rpm dbpath from the host system is used and later in the install phase the dbpath from the rpm package as it was installed by the target image distribution is used. In case of a dbpath difference the database is automatically moved to the new location by setting the _dbpath_rebuild macro to the correct location. At the end the custom KIWI macro is deleted. As this process allows custom macro defintions during the KIWI run it also serves as the base for a solution to Issue #771 which will be done in a follow up request to this commit. Also the workaround for bsc#1112357 which uses a static dbpath to store an optionally given signing key will be addressed with this commit. The macro setup happens before the import_trusted_keys method which makes any specification for a strict dbpath obsolete. Last the implementation deletes the obsolete dump_reload_package_database code. rpm is able to automatically do the conversion of different db versions such that the code in kiwi is obsolete. In addition that code only worked for rather old db versions. The public API has not changed though, but the method is marked obsolete and does nothing anymore. In addition to the deletion of obsolete code a new API method post_process_install_requests_bootstrap has been introduced to handle actions required after bootstrap and before installing of packages from inside the new image
53 lines
1.5 KiB
Python
53 lines
1.5 KiB
Python
import mock
|
|
|
|
from .test_helper import raises
|
|
|
|
from kiwi.repository.base import RepositoryBase
|
|
|
|
|
|
class TestRepositoryBase(object):
|
|
def setup(self):
|
|
root_bind = mock.Mock()
|
|
self.repo = RepositoryBase(root_bind)
|
|
self.repo.root_dir = 'root-dir'
|
|
self.repo.shared_location = 'shared-dir'
|
|
|
|
@raises(NotImplementedError)
|
|
def test_use_default_location(self):
|
|
self.repo.use_default_location()
|
|
|
|
@raises(NotImplementedError)
|
|
def test_runtime_config(self):
|
|
self.repo.runtime_config()
|
|
|
|
@raises(NotImplementedError)
|
|
def test_add_repo(self):
|
|
self.repo.add_repo(
|
|
'name', 'uri', 'type', 'prio', 'dist', ['components'],
|
|
'user', 'secret', 'credentials-file', False, False
|
|
)
|
|
|
|
@raises(NotImplementedError)
|
|
def test_setup_package_database_configuration(self):
|
|
self.repo.setup_package_database_configuration()
|
|
|
|
@raises(NotImplementedError)
|
|
def test_import_trusted_keys(self):
|
|
self.repo.import_trusted_keys(['key-file.asc'])
|
|
|
|
@raises(NotImplementedError)
|
|
def test_delete_repo(self):
|
|
self.repo.delete_repo('name')
|
|
|
|
@raises(NotImplementedError)
|
|
def test_delete_all_repos(self):
|
|
self.repo.delete_all_repos()
|
|
|
|
@raises(NotImplementedError)
|
|
def test_cleanup_unused_repos(self):
|
|
self.repo.cleanup_unused_repos()
|
|
|
|
@raises(NotImplementedError)
|
|
def test_delete_repo_cache(self):
|
|
self.repo.delete_repo_cache('foo')
|