Delete kiwi compat mode
The compat mode allowed a kiwi v7 legacy argument translation and is obsolete since a long time
This commit is contained in:
parent
c5f932fb7f
commit
1da2886fd1
@ -45,7 +45,6 @@ SYNOPSIS
|
||||
[--config=<configfile>]
|
||||
[--kiwi-file=<kiwifile>]
|
||||
system <command> [<args>...]
|
||||
kiwi-ng compat <legacy_args>...
|
||||
kiwi-ng -v | --version
|
||||
kiwi-ng help
|
||||
|
||||
|
||||
@ -5,12 +5,7 @@ Building Linux System Appliances
|
||||
|
||||
.. note::
|
||||
This documentation covers {kiwi-product} |version|- the command line
|
||||
utility to build Linux system appliances. {kiwi} is stable and all
|
||||
new features, bugfixes, and improvements will be developed here.
|
||||
Versions older or equal to v7.x.x are out of maintenance and do
|
||||
not get any updates or bugfixes. If you still need this version,
|
||||
refer to the documentation for
|
||||
`{kiwi-legacy} <https://doc.opensuse.org/projects/kiwi/doc>`__
|
||||
utility to build Linux system appliances.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
@ -40,6 +35,7 @@ Building Linux System Appliances
|
||||
* `Build Tests TumbleWeed(ppc64le) <https://build.opensuse.org/project/show/Virtualization:Appliances:Images:Testing_ppc:tumbleweed>`__
|
||||
|
||||
* `Build Tests RawHide(x86) <https://build.opensuse.org/project/show/Virtualization:Appliances:Images:Testing_x86:rawhide>`__
|
||||
* `Build Tests RawHide(s390) <https://build.opensuse.org/project/show/Virtualization:Appliances:Images:Testing_s390:rawhide>`__
|
||||
|
||||
* `Build Tests Leap(x86) <https://build.opensuse.org/project/show/Virtualization:Appliances:Images:Testing_x86:leap>`__
|
||||
|
||||
|
||||
39
kiwi/cli.py
39
kiwi/cli.py
@ -52,8 +52,6 @@ usage: kiwi-ng -h | --help
|
||||
[--config=<configfile>]
|
||||
[--kiwi-file=<kiwifile>]
|
||||
system <command> [<args>...]
|
||||
kiwi-ng compat <legacy_args>...
|
||||
kiwi-ng --compat <legacy_args>...
|
||||
kiwi-ng -v | --version
|
||||
kiwi-ng help
|
||||
|
||||
@ -128,10 +126,8 @@ from docopt import docopt
|
||||
from kiwi.exceptions import (
|
||||
KiwiUnknownServiceName,
|
||||
KiwiCommandNotLoaded,
|
||||
KiwiLoadCommandUndefined,
|
||||
KiwiCompatError
|
||||
KiwiLoadCommandUndefined
|
||||
)
|
||||
from kiwi.path import Path
|
||||
from kiwi.version import __version__
|
||||
from kiwi.help import Help
|
||||
from kiwi.defaults import Defaults
|
||||
@ -179,38 +175,11 @@ class Cli:
|
||||
return 'system'
|
||||
elif self.all_args.get('result') is True:
|
||||
return 'result'
|
||||
elif self.all_args.get('--compat') is True:
|
||||
return 'compat'
|
||||
elif self.all_args.get('compat') is True:
|
||||
return 'compat'
|
||||
else:
|
||||
raise KiwiUnknownServiceName(
|
||||
'Unknown/Invalid Servicename'
|
||||
)
|
||||
|
||||
def invoke_kiwicompat(self, compat_args):
|
||||
"""
|
||||
Execute kiwicompat with provided legacy KIWI command line arguments
|
||||
|
||||
Example:
|
||||
|
||||
.. code:: python
|
||||
|
||||
invoke_kiwicompat(
|
||||
'--build', 'description', '--type', 'vmx',
|
||||
'-d', 'destination'
|
||||
)
|
||||
|
||||
:param list compat_args: legacy kiwi command arguments
|
||||
"""
|
||||
kiwicompat = Path.which('kiwicompat', access_mode=os.X_OK)
|
||||
try:
|
||||
os.execvp(kiwicompat, ['kiwicompat'] + compat_args)
|
||||
except Exception as e:
|
||||
raise KiwiCompatError(
|
||||
'%s: %s' % (type(e).__name__, format(e))
|
||||
)
|
||||
|
||||
def get_command(self):
|
||||
"""
|
||||
Extract selected command name
|
||||
@ -290,12 +259,6 @@ class Cli:
|
||||
service = self.get_servicename()
|
||||
command = self.get_command()
|
||||
|
||||
if service == 'compat':
|
||||
compat_arguments = self.all_args['<legacy_args>']
|
||||
if '--' in compat_arguments:
|
||||
compat_arguments.remove('--')
|
||||
return self.invoke_kiwicompat(compat_arguments)
|
||||
|
||||
if not command:
|
||||
raise KiwiLoadCommandUndefined(
|
||||
'No command specified for {0} service'.format(service)
|
||||
|
||||
@ -175,13 +175,6 @@ class KiwiCompressionFormatUnknown(KiwiError):
|
||||
"""
|
||||
|
||||
|
||||
class KiwiCompatError(KiwiError):
|
||||
"""
|
||||
Exception raised if the given kiwi compatibility command line
|
||||
could not be understood by the compat option parser.
|
||||
"""
|
||||
|
||||
|
||||
class KiwiConfigFileNotFound(KiwiError):
|
||||
"""
|
||||
Exception raised if no kiwi XML description was found.
|
||||
|
||||
@ -1,238 +0,0 @@
|
||||
"""
|
||||
usage: kiwicompat -h | --help
|
||||
kiwicompat --build=<description> --dest-dir=<destination>
|
||||
[--ignore-repos]
|
||||
[(--set-repo=<uri> [--set-repoalias=<alias>] [--set-repopriority=<priority>] [--set-repotype=<type>])]
|
||||
[(--add-repo=<uri> [--add-repoalias=<alias>] [--add-repopriority=<priority>] [--add-repotype=<type>])]...
|
||||
[--type=<image-type>]
|
||||
[--logfile=<filename>]
|
||||
[--add-profile=<profile-name>...]
|
||||
[--debug]
|
||||
kiwicompat --prepare=<description> --root=<image-root>
|
||||
[--recycle-root]
|
||||
[--logfile=<filename>]
|
||||
[--add-profile=<profile-name>...]
|
||||
[--ignore-repos]
|
||||
[(--set-repo=<uri> [--set-repoalias=<alias>] [--set-repopriority=<priority>] [--set-repotype=<type>])]
|
||||
[(--add-repo=<uri> [--add-repoalias=<alias>] [--add-repopriority=<priority>] [--add-repotype=<type>])]...
|
||||
[--debug]
|
||||
kiwicompat --create=<image-root> --dest-dir=<destination>
|
||||
[--ignore-repos]
|
||||
[(--set-repo=<uri> [--set-repoalias=<alias>] [--set-repopriority=<priority>] [--set-repotype=<type>])]
|
||||
[(--add-repo=<uri> [--add-repoalias=<alias>] [--add-repopriority=<priority>] [--add-repotype=<type>])]...
|
||||
[--type=<image-type>]
|
||||
[--logfile=<filename>]
|
||||
[--add-profile=<profile-name>...]
|
||||
[--debug]
|
||||
kiwicompat --upgrade=<image-root>
|
||||
[--add-package=<name>...]
|
||||
[--del-package=<name>...]
|
||||
[--logfile=<filename>]
|
||||
[--add-profile=<profile-name>...]
|
||||
[--debug]
|
||||
kiwicompat -v | --version
|
||||
|
||||
options:
|
||||
-p | --prepare
|
||||
-c | --create
|
||||
-b | --build
|
||||
-d | --dest-dir
|
||||
-t | --type
|
||||
-u | --upgrade
|
||||
-l | --logfile
|
||||
-v --version
|
||||
"""
|
||||
import os
|
||||
import logging
|
||||
from docopt import docopt
|
||||
from docopt import DocoptExit
|
||||
|
||||
# project
|
||||
from .path import Path
|
||||
|
||||
|
||||
class Cli:
|
||||
"""
|
||||
Compatibility class for old style kiwi calls
|
||||
"""
|
||||
def __init__(self):
|
||||
try:
|
||||
self.compat_args = docopt(
|
||||
__doc__, options_first=True
|
||||
)
|
||||
except DocoptExit as e:
|
||||
message_header = '\n'.join(
|
||||
[
|
||||
'The provided legacy kiwi commandline is invalid',
|
||||
'or not supported. Plase check the following usage',
|
||||
'information if you just mistyped the call:'
|
||||
]
|
||||
)
|
||||
message_footer = '\n'.join(
|
||||
[
|
||||
'In case of a correct legacy kiwi command but not',
|
||||
'supported by kiwicompat, please contact us via the',
|
||||
'github issue system at:\n',
|
||||
'https://github.com/OSInside/kiwi/issues'
|
||||
]
|
||||
)
|
||||
raise NotImplementedError(
|
||||
'%s\n\n%s\n\n%s' %
|
||||
(message_header, format(e), message_footer)
|
||||
)
|
||||
|
||||
|
||||
class Translate:
|
||||
def __init__(self, arguments):
|
||||
self.arguments = arguments
|
||||
|
||||
self.translated = []
|
||||
if self.arguments['--version']:
|
||||
self.translated.append('--version')
|
||||
if self.arguments['--logfile']:
|
||||
self.translated.append('--logfile')
|
||||
self.translated.append(self.arguments['--logfile'])
|
||||
if self.arguments['--debug']:
|
||||
self.translated.append('--debug')
|
||||
if self.arguments['--type']:
|
||||
self.translated.append('--type')
|
||||
self.translated.append(self.arguments['--type'])
|
||||
if self.arguments['--add-profile']:
|
||||
for profile in self.arguments['--add-profile']:
|
||||
self.translated.append('--profile')
|
||||
self.translated.append(profile)
|
||||
|
||||
if self.arguments['--create']:
|
||||
self.create(self.arguments['--create'])
|
||||
elif self.arguments['--prepare']:
|
||||
self.prepare(self.arguments['--prepare'])
|
||||
elif self.arguments['--upgrade']:
|
||||
self.upgrade(self.arguments['--upgrade'])
|
||||
elif self.arguments['--build']:
|
||||
self.build(self.arguments['--build'])
|
||||
|
||||
def build(self, description):
|
||||
self.translated.append('system')
|
||||
self.translated.append('build')
|
||||
self.translated.append('--description')
|
||||
self.translated.append(description)
|
||||
self.translated.append('--target-dir')
|
||||
self.translated.append(self.arguments['--dest-dir'])
|
||||
if self.arguments['--ignore-repos']:
|
||||
self.translated.append('--ignore-repos')
|
||||
self._set_add_repo_arguments()
|
||||
|
||||
def create(self, root):
|
||||
# Note:
|
||||
# --ignore-repos, --set-repo and --add-repo
|
||||
# options are allowed to be specified for compatibility reasons
|
||||
# but are not used in the next generation kiwi because the repo
|
||||
# information is persistently stored after the prepare step
|
||||
# has finished, which is not the case for the legacy kiwi
|
||||
# version
|
||||
self.translated.append('system')
|
||||
self.translated.append('create')
|
||||
self.translated.append('--root')
|
||||
self.translated.append(root)
|
||||
self.translated.append('--target-dir')
|
||||
self.translated.append(self.arguments['--dest-dir'])
|
||||
|
||||
def prepare(self, description):
|
||||
self.translated.append('system')
|
||||
self.translated.append('prepare')
|
||||
self.translated.append('--description')
|
||||
self.translated.append(description)
|
||||
self.translated.append('--root')
|
||||
self.translated.append(self.arguments['--root'])
|
||||
if self.arguments['--ignore-repos']:
|
||||
self.translated.append('--ignore-repos')
|
||||
if self.arguments['--recycle-root']:
|
||||
self.translated.append('--allow-existing-root')
|
||||
self._set_add_repo_arguments()
|
||||
|
||||
def upgrade(self, root):
|
||||
self.translated.append('system')
|
||||
self.translated.append('update')
|
||||
self.translated.append('--root')
|
||||
self.translated.append(root)
|
||||
if self.arguments['--add-package']:
|
||||
for add_package in self.arguments['--add-package']:
|
||||
self.translated.append('--add-package')
|
||||
self.translated.append(add_package)
|
||||
if self.arguments['--del-package']:
|
||||
for del_package in self.arguments['--del-package']:
|
||||
self.translated.append('--delete-package')
|
||||
self.translated.append(del_package)
|
||||
|
||||
def _set_add_repo_arguments(self):
|
||||
if self.arguments['--add-repo']:
|
||||
for index in range(0, len(self.arguments['--add-repo'])):
|
||||
repo_type = None
|
||||
repo_alias = None
|
||||
repo_prio = None
|
||||
try:
|
||||
repo_type = self.arguments['--add-repotype'][index]
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
repo_alias = self.arguments['--add-repoalias'][index]
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
repo_prio = self.arguments['--add-repopriority'][index]
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
self.translated.append('--add-repo')
|
||||
self.translated.append(self._repo_argument(
|
||||
self.arguments['--add-repo'][index],
|
||||
repo_type, repo_alias, repo_prio
|
||||
))
|
||||
|
||||
if self.arguments['--set-repo']:
|
||||
self.translated.append('--set-repo')
|
||||
self.translated.append(self._repo_argument(
|
||||
self.arguments['--set-repo'],
|
||||
self.arguments['--set-repotype'],
|
||||
self.arguments['--set-repoalias'],
|
||||
self.arguments['--set-repopriority']
|
||||
))
|
||||
|
||||
def _repo_argument(self, source, repo_type, alias, priority):
|
||||
if not repo_type:
|
||||
repo_type = ''
|
||||
if not alias:
|
||||
alias = ''
|
||||
if not priority:
|
||||
priority = ''
|
||||
return ','.join(
|
||||
[source, repo_type, alias, priority]
|
||||
)
|
||||
|
||||
|
||||
class Command:
|
||||
@staticmethod
|
||||
def execute(arguments):
|
||||
os.execvp(Command.lookup_kiwi(), ['kiwi'] + arguments)
|
||||
|
||||
@staticmethod
|
||||
def lookup_kiwi():
|
||||
for kiwi_name in ['kiwi-ng-3', 'kiwi-ng-2']:
|
||||
kiwi = Path.which(kiwi_name, access_mode=os.X_OK)
|
||||
if kiwi:
|
||||
return kiwi
|
||||
raise OSError('kiwi not found')
|
||||
|
||||
|
||||
def main():
|
||||
logging.basicConfig(format='%(message)s', level=logging.INFO)
|
||||
|
||||
try:
|
||||
app = Cli()
|
||||
arguments = Translate(app.compat_args)
|
||||
# logging.info('Calling: kiwi %s', ' '.join(arguments.translated))
|
||||
Command.execute(arguments.translated)
|
||||
except NotImplementedError as e:
|
||||
logging.error('KiwiCompatError: %s', format(e))
|
||||
except OSError as e:
|
||||
logging.error('KiwiCompatError: %s', format(e))
|
||||
@ -11,7 +11,6 @@ from kiwi.cli import Cli
|
||||
from kiwi.defaults import Defaults
|
||||
|
||||
from kiwi.exceptions import (
|
||||
KiwiCompatError,
|
||||
KiwiLoadCommandUndefined,
|
||||
KiwiCommandNotLoaded,
|
||||
KiwiUnknownServiceName
|
||||
@ -26,8 +25,6 @@ class TestCli:
|
||||
def setup(self):
|
||||
self.expected_global_args = {
|
||||
'help': False,
|
||||
'--compat': False,
|
||||
'compat': False,
|
||||
'--type': None,
|
||||
'image': False,
|
||||
'system': True,
|
||||
@ -36,7 +33,6 @@ class TestCli:
|
||||
'--logsocket': None,
|
||||
'--loglevel': None,
|
||||
'--color-output': False,
|
||||
'<legacy_args>': [],
|
||||
'--version': False,
|
||||
'--debug': False,
|
||||
'--debug-run-scripts-in-screen': False,
|
||||
@ -96,28 +92,6 @@ class TestCli:
|
||||
cli = Cli()
|
||||
assert cli.get_servicename() == 'system'
|
||||
|
||||
def test_get_servicename_compat_as_option(self):
|
||||
sys.argv = [
|
||||
sys.argv[0],
|
||||
'--compat', '--',
|
||||
'--build', 'description',
|
||||
'--type', 'oem',
|
||||
'-d', 'destination'
|
||||
]
|
||||
cli = Cli()
|
||||
assert cli.get_servicename() == 'compat'
|
||||
|
||||
def test_get_servicename_compat_as_service(self):
|
||||
sys.argv = [
|
||||
sys.argv[0],
|
||||
'compat',
|
||||
'--build', 'description',
|
||||
'--type', 'oem',
|
||||
'-d', 'destination'
|
||||
]
|
||||
cli = Cli()
|
||||
assert cli.get_servicename() == 'compat'
|
||||
|
||||
def test_warning_on_use_of_legacy_disk_type(self):
|
||||
sys.argv = [
|
||||
sys.argv[0],
|
||||
@ -170,29 +144,6 @@ class TestCli:
|
||||
def test_load_command(self):
|
||||
assert self.cli.load_command() == self.loaded_command
|
||||
|
||||
@patch('kiwi.cli.Cli.invoke_kiwicompat')
|
||||
def test_load_command_compat_mode(self, mock_compat):
|
||||
sys.argv = [
|
||||
sys.argv[0],
|
||||
'--compat', '--',
|
||||
'--build', 'description',
|
||||
'--type', 'oem',
|
||||
'-d', 'destination'
|
||||
]
|
||||
cli = Cli()
|
||||
cli.load_command()
|
||||
mock_compat.assert_called_once_with(
|
||||
['--build', 'description', '--type', 'oem', '-d', 'destination']
|
||||
)
|
||||
|
||||
@patch('kiwi.cli.Path.which')
|
||||
@patch('os.execvp')
|
||||
def test_invoke_kiwicompat_exec_failed(self, mock_exec, mock_which):
|
||||
mock_which.return_value = 'kiwicompat'
|
||||
mock_exec.side_effect = Exception
|
||||
with raises(KiwiCompatError):
|
||||
self.cli.invoke_kiwicompat([])
|
||||
|
||||
def test_load_command_unknown(self):
|
||||
self.cli.loaded = False
|
||||
self.cli.all_args['<command>'] = 'foo'
|
||||
|
||||
@ -1,185 +0,0 @@
|
||||
import sys
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from .test_helper import argv_kiwi_tests
|
||||
|
||||
import kiwi.kiwi_compat
|
||||
|
||||
|
||||
class TestKiwiCompat:
|
||||
def teardown(self):
|
||||
sys.argv = argv_kiwi_tests
|
||||
|
||||
def teardown_method(self, cls):
|
||||
self.teardown()
|
||||
|
||||
@patch('logging.error')
|
||||
def test_compat_mode_invalid_arguments(self, mock_log_error):
|
||||
sys.argv = [
|
||||
'kiwicompat', '--build'
|
||||
]
|
||||
kiwi.kiwi_compat.main()
|
||||
assert mock_log_error.called
|
||||
|
||||
@patch('os.execvp')
|
||||
@patch('kiwi.kiwi_compat.Path.which')
|
||||
@patch('logging.error')
|
||||
def test_compat_mode_exec_failed(self, mock_log_error, mock_which, mock_exec):
|
||||
mock_which.return_value = 'kiwi-ng'
|
||||
sys.argv = [
|
||||
'kiwicompat',
|
||||
'--create', 'root_dir',
|
||||
'--type', 'oem',
|
||||
'-d', 'destination'
|
||||
]
|
||||
mock_exec.side_effect = OSError('exec failed')
|
||||
kiwi.kiwi_compat.main()
|
||||
mock_log_error.assert_called_once_with(
|
||||
'KiwiCompatError: %s', 'exec failed'
|
||||
)
|
||||
|
||||
@patch('kiwi.kiwi_compat.Path.which')
|
||||
@patch('logging.error')
|
||||
def test_compat_mode_kiwi_not_found(self, mock_log_error, mock_which):
|
||||
mock_which.return_value = None
|
||||
sys.argv = [
|
||||
'kiwicompat',
|
||||
'--create', 'root_dir',
|
||||
'--type', 'oem',
|
||||
'-d', 'destination'
|
||||
]
|
||||
kiwi.kiwi_compat.main()
|
||||
mock_log_error.assert_called_once_with(
|
||||
'KiwiCompatError: %s', 'kiwi not found'
|
||||
)
|
||||
|
||||
@patch('os.execvp')
|
||||
@patch('kiwi.path.Path.which')
|
||||
def test_version_compat_mode(self, mock_which, mock_exec):
|
||||
mock_which.return_value = 'kiwi-ng'
|
||||
sys.argv = [
|
||||
'kiwicompat', '--version'
|
||||
]
|
||||
kiwi.kiwi_compat.main()
|
||||
mock_exec.assert_called_once_with(
|
||||
'kiwi-ng', ['kiwi', '--version']
|
||||
)
|
||||
|
||||
@patch('os.execvp')
|
||||
@patch('kiwi.kiwi_compat.Path.which')
|
||||
def test_build_compat_mode(self, mock_which, mock_exec):
|
||||
mock_which.return_value = 'kiwi-ng'
|
||||
sys.argv = [
|
||||
'kiwicompat',
|
||||
'--build', 'description',
|
||||
'--type', 'oem',
|
||||
'--ignore-repos',
|
||||
'--set-repo', 'repo_a',
|
||||
'--set-repoalias', 'a', '--set-repopriority', '1',
|
||||
'--set-repotype', 'rpm_md',
|
||||
'--add-repo', 'repo_b',
|
||||
'--add-repoalias', 'b', '--add-repopriority', '2',
|
||||
'--add-repotype', 'rpm_md',
|
||||
'--add-repo', 'repo_c',
|
||||
'--add-repoalias', 'c', '--add-repopriority', '3',
|
||||
'--add-repotype', 'rpm_md',
|
||||
'--logfile', 'logfile',
|
||||
'--add-profile', 'profile',
|
||||
'--debug',
|
||||
'-d', 'destination'
|
||||
]
|
||||
kiwi.kiwi_compat.main()
|
||||
mock_exec.assert_called_once_with(
|
||||
'kiwi-ng', [
|
||||
'kiwi',
|
||||
'--logfile', 'logfile',
|
||||
'--debug',
|
||||
'--type', 'oem',
|
||||
'--profile', 'profile',
|
||||
'system', 'build',
|
||||
'--description', 'description',
|
||||
'--target-dir', 'destination',
|
||||
'--ignore-repos',
|
||||
'--add-repo', 'repo_b,rpm_md,b,2',
|
||||
'--add-repo', 'repo_c,rpm_md,c,3',
|
||||
'--set-repo', 'repo_a,rpm_md,a,1'
|
||||
]
|
||||
)
|
||||
|
||||
@patch('os.execvp')
|
||||
@patch('kiwi.path.Path.which')
|
||||
def test_create_compat_mode(self, mock_which, mock_exec):
|
||||
mock_which.return_value = 'kiwi-ng'
|
||||
sys.argv = [
|
||||
'kiwicompat',
|
||||
'--create', 'root_dir',
|
||||
'--type', 'oem',
|
||||
'-d', 'destination'
|
||||
]
|
||||
kiwi.kiwi_compat.main()
|
||||
mock_exec.assert_called_once_with(
|
||||
'kiwi-ng', [
|
||||
'kiwi',
|
||||
'--type', 'oem',
|
||||
'system', 'create',
|
||||
'--root', 'root_dir',
|
||||
'--target-dir', 'destination'
|
||||
]
|
||||
)
|
||||
|
||||
@patch('os.execvp')
|
||||
@patch('kiwi.path.Path.which')
|
||||
def test_prepare_compat_mode(self, mock_which, mock_exec):
|
||||
mock_which.return_value = 'kiwi-ng'
|
||||
sys.argv = [
|
||||
'kiwicompat',
|
||||
'--prepare', 'description',
|
||||
'--root', 'root_dir',
|
||||
'--recycle-root',
|
||||
'--ignore-repos',
|
||||
'--set-repo', 'repo_a',
|
||||
'--set-repoalias', 'a', '--set-repopriority', '1',
|
||||
'--set-repotype', 'rpm_md',
|
||||
'--add-repo', 'repo_b',
|
||||
'--logfile', 'logfile',
|
||||
'--add-profile', 'profile',
|
||||
'--debug'
|
||||
]
|
||||
kiwi.kiwi_compat.main()
|
||||
mock_exec.assert_called_once_with(
|
||||
'kiwi-ng', [
|
||||
'kiwi',
|
||||
'--logfile', 'logfile',
|
||||
'--debug',
|
||||
'--profile', 'profile',
|
||||
'system', 'prepare',
|
||||
'--description', 'description',
|
||||
'--root', 'root_dir',
|
||||
'--ignore-repos',
|
||||
'--allow-existing-root',
|
||||
'--add-repo', 'repo_b,,,',
|
||||
'--set-repo', 'repo_a,rpm_md,a,1'
|
||||
]
|
||||
)
|
||||
|
||||
@patch('os.execvp')
|
||||
@patch('kiwi.path.Path.which')
|
||||
def test_upgrade_compat_mode(self, mock_which, mock_exec):
|
||||
mock_which.return_value = 'kiwi-ng'
|
||||
sys.argv = [
|
||||
'kiwicompat',
|
||||
'--upgrade', 'root_dir',
|
||||
'--add-package', 'foo',
|
||||
'--del-package', 'bar'
|
||||
]
|
||||
kiwi.kiwi_compat.main()
|
||||
mock_exec.assert_called_once_with(
|
||||
'kiwi-ng', [
|
||||
'kiwi',
|
||||
'system', 'update',
|
||||
'--root', 'root_dir',
|
||||
'--add-package', 'foo',
|
||||
'--delete-package', 'bar'
|
||||
]
|
||||
)
|
||||
Loading…
Reference in New Issue
Block a user