Skip to content

Commit

Permalink
Merge pull request #1623 from OSInside/microdnf-first-fixes
Browse files Browse the repository at this point in the history
Initial fixes for Micro DNF
  • Loading branch information
Conan-Kudo authored Nov 13, 2020
2 parents 6d2d10f + a0912d5 commit d47e5fb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 21 deletions.
5 changes: 1 addition & 4 deletions kiwi/package_manager/microdnf.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,9 @@ def process_install_requests_bootstrap(self, root_bind=None):
:rtype: namedtuple
"""
Command.run(
['microdnf'] + self.dnf_args + ['makecache']
)
bash_command = [
'microdnf'
] + self.dnf_args + [
] + ['--refresh'] + self.dnf_args + [
'--installroot', self.root_dir
] + self.custom_args + ['install'] + self.package_requests
self.cleanup_requests()
Expand Down
2 changes: 1 addition & 1 deletion kiwi/repository/dnf.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def post_init(self, custom_args=None):
)

self.dnf_args = [
'-c', self.runtime_dnf_config_file.name, '-y'
'--config', self.runtime_dnf_config_file.name, '-y'
] + self.custom_args

self.command_env = self._create_dnf_runtime_environment()
Expand Down
16 changes: 8 additions & 8 deletions test/unit/package_manager/dnf_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def setup(self):

repository.runtime_config = mock.Mock(
return_value={
'dnf_args': ['-c', '/root-dir/dnf.conf', '-y'],
'dnf_args': ['--config', '/root-dir/dnf.conf', '-y'],
'command_env': ['env']
}
)
Expand Down Expand Up @@ -43,14 +43,14 @@ def test_process_install_requests_bootstrap(self, mock_run, mock_call):
self.manager.request_collection('collection')
self.manager.process_install_requests_bootstrap()
mock_run.assert_called_once_with(
['dnf', '-c', '/root-dir/dnf.conf', '-y', 'makecache']
['dnf', '--config', '/root-dir/dnf.conf', '-y', 'makecache']
)
mock_call.assert_called_once_with(
[
'bash', '-c',
'dnf -c /root-dir/dnf.conf -y '
'dnf --config /root-dir/dnf.conf -y '
'--installroot /root-dir install vim && '
'dnf -c /root-dir/dnf.conf -y '
'dnf --config /root-dir/dnf.conf -y '
'--installroot /root-dir group install '
'"collection"'
], ['env']
Expand All @@ -65,9 +65,9 @@ def test_process_install_requests(self, mock_call):
mock_call.assert_called_once_with(
[
'bash', '-c',
'chroot /root-dir dnf -c /dnf.conf -y '
'chroot /root-dir dnf --config /dnf.conf -y '
'--exclude=skipme install vim && '
'chroot /root-dir dnf -c /dnf.conf -y '
'chroot /root-dir dnf --config /dnf.conf -y '
'--exclude=skipme group install '
'"collection"'
], ['env']
Expand Down Expand Up @@ -96,7 +96,7 @@ def test_process_delete_requests_no_force(self, mock_run, mock_call):
mock_call.assert_called_once_with(
[
'chroot', '/root-dir', 'dnf',
'-c', '/dnf.conf', '-y', 'autoremove', 'vim'
'--config', '/dnf.conf', '-y', 'autoremove', 'vim'
],
['env']
)
Expand All @@ -120,7 +120,7 @@ def test_update(self, mock_call):
mock_call.assert_called_once_with(
[
'chroot', '/root-dir', 'dnf',
'-c', '/dnf.conf', '-y', 'upgrade'
'--config', '/dnf.conf', '-y', 'upgrade'
], ['env']
)

Expand Down
13 changes: 5 additions & 8 deletions test/unit/package_manager/microdnf_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def setup(self):

repository.runtime_config = mock.Mock(
return_value={
'dnf_args': ['-c', '/root-dir/dnf.conf', '-y'],
'dnf_args': ['--config', '/root-dir/dnf.conf', '-y'],
'command_env': ['env']
}
)
Expand Down Expand Up @@ -42,13 +42,10 @@ def test_process_install_requests_bootstrap(self, mock_run, mock_call):
self.manager.request_package('vim')
self.manager.request_collection('collection')
self.manager.process_install_requests_bootstrap()
mock_run.assert_called_once_with(
['microdnf', '-c', '/root-dir/dnf.conf', '-y', 'makecache']
)
mock_call.assert_called_once_with(
[
'bash', '-c',
'microdnf -c /root-dir/dnf.conf -y '
'microdnf --refresh --config /root-dir/dnf.conf -y '
'--installroot /root-dir install vim'
], ['env']
)
Expand All @@ -62,7 +59,7 @@ def test_process_install_requests(self, mock_call):
mock_call.assert_called_once_with(
[
'bash', '-c',
'chroot /root-dir microdnf -c /dnf.conf -y '
'chroot /root-dir microdnf --config /dnf.conf -y '
'--exclude=skipme install vim'
], ['env']
)
Expand Down Expand Up @@ -90,7 +87,7 @@ def test_process_delete_requests_no_force(self, mock_run, mock_call):
mock_call.assert_called_once_with(
[
'chroot', '/root-dir', 'microdnf',
'-c', '/dnf.conf', '-y', 'remove', 'vim'
'--config', '/dnf.conf', '-y', 'remove', 'vim'
],
['env']
)
Expand All @@ -114,7 +111,7 @@ def test_update(self, mock_call):
mock_call.assert_called_once_with(
[
'chroot', '/root-dir', 'microdnf',
'-c', '/dnf.conf', '-y', 'upgrade'
'--config', '/dnf.conf', '-y', 'upgrade'
], ['env']
)

Expand Down

0 comments on commit d47e5fb

Please sign in to comment.