diff --git a/kiwi/repository/apt.py b/kiwi/repository/apt.py index 294dc6ba168..f981d53ffa8 100644 --- a/kiwi/repository/apt.py +++ b/kiwi/repository/apt.py @@ -72,7 +72,6 @@ def post_init(self, custom_args: List = []) -> None: self.distribution: str = '' self.distribution_path: str = '' - self.debootstrap_repo_set = False self.repo_names: List = [] self.components: List = [] @@ -139,8 +138,7 @@ def add_repo( prio: int = None, dist: str = None, components: str = None, user: str = None, secret: str = None, credentials_file: str = None, repo_gpgcheck: bool = None, pkg_gpgcheck: bool = None, - sourcetype: str = None, use_for_bootstrap: bool = False, - customization_script: str = None + sourcetype: str = None, customization_script: str = None ) -> None: """ Add apt_get repository @@ -157,8 +155,6 @@ def add_repo( :param bool repo_gpgcheck: enable repository signature validation :param bool pkg_gpgcheck: unused :param str sourcetype: unused - :param bool use_for_bootstrap: use this repository for the - debootstrap call :param str customization_script: custom script called after the repo file was created """ @@ -190,10 +186,8 @@ def add_repo( else: # create a debian distributon repository setup for the # specified distributon name and components - if not self.debootstrap_repo_set: - self.distribution = dist - self.distribution_path = uri - self.debootstrap_repo_set = use_for_bootstrap + self.distribution = dist + self.distribution_path = uri repo_details += 'Suites: ' + dist + os.linesep repo_details += 'Components: ' + components + os.linesep if repo_gpgcheck is False: diff --git a/kiwi/repository/base.py b/kiwi/repository/base.py index e7dbdfda7c7..3af266aee1c 100644 --- a/kiwi/repository/base.py +++ b/kiwi/repository/base.py @@ -77,7 +77,7 @@ def add_repo( self, name: str, uri: str, repo_type: str, prio: int, dist: str, components: str, user: str, secret: str, credentials_file: str, repo_gpgcheck: bool, pkg_gpgcheck: bool, sourcetype: str, - use_for_bootstrap: bool = False, customization_script: str = None + customization_script: str = None ) -> None: """ Add repository @@ -96,7 +96,6 @@ def add_repo( :param bool repo_gpgcheck: unused :param bool pkg_gpgcheck: unused :param str sourcetype: unused - :param bool use_for_bootstrap: unused :param str customization_script: unused """ raise NotImplementedError diff --git a/kiwi/repository/dnf.py b/kiwi/repository/dnf.py index bd0d17bc8d5..f7f2c84ce76 100644 --- a/kiwi/repository/dnf.py +++ b/kiwi/repository/dnf.py @@ -51,8 +51,7 @@ def add_repo( prio: int = None, dist: str = None, components: str = None, user: str = None, secret: str = None, credentials_file: str = None, repo_gpgcheck: bool = False, pkg_gpgcheck: bool = False, - sourcetype: str = None, use_for_bootstrap: bool = False, - customization_script: str = None + sourcetype: str = None, customization_script: str = None ) -> None: pass # pragma: no cover diff --git a/kiwi/repository/dnf4.py b/kiwi/repository/dnf4.py index c2eed578579..542d8e10921 100644 --- a/kiwi/repository/dnf4.py +++ b/kiwi/repository/dnf4.py @@ -192,8 +192,7 @@ def add_repo( prio: int = None, dist: str = None, components: str = None, user: str = None, secret: str = None, credentials_file: str = None, repo_gpgcheck: bool = False, pkg_gpgcheck: bool = False, - sourcetype: str = None, use_for_bootstrap: bool = False, - customization_script: str = None + sourcetype: str = None, customization_script: str = None ) -> None: """ Add dnf repository @@ -211,7 +210,6 @@ def add_repo( :param bool pkg_gpgcheck: enable package signature validation :param str sourcetype: source type, one of 'baseurl', 'metalink' or 'mirrorlist' - :param bool use_for_bootstrap: unused :param str customization_script: custom script called after the repo file was created """ diff --git a/kiwi/repository/dnf5.py b/kiwi/repository/dnf5.py index d6734ac43fc..a02b6f55544 100644 --- a/kiwi/repository/dnf5.py +++ b/kiwi/repository/dnf5.py @@ -192,8 +192,7 @@ def add_repo( prio: int = None, dist: str = None, components: str = None, user: str = None, secret: str = None, credentials_file: str = None, repo_gpgcheck: bool = False, pkg_gpgcheck: bool = False, - sourcetype: str = None, use_for_bootstrap: bool = False, - customization_script: str = None + sourcetype: str = None, customization_script: str = None ) -> None: """ Add dnf repository @@ -211,7 +210,6 @@ def add_repo( :param bool pkg_gpgcheck: enable package signature validation :param str sourcetype: source type, one of 'baseurl', 'metalink' or 'mirrorlist' - :param bool use_for_bootstrap: unused :param str customization_script: custom script called after the repo file was created """ diff --git a/kiwi/repository/pacman.py b/kiwi/repository/pacman.py index edc6a50e8a4..85eb4bed3bc 100644 --- a/kiwi/repository/pacman.py +++ b/kiwi/repository/pacman.py @@ -115,8 +115,7 @@ def add_repo( prio: int = None, dist: str = None, components: str = None, user: str = None, secret: str = None, credentials_file: str = None, repo_gpgcheck: bool = False, pkg_gpgcheck: bool = False, - sourcetype: str = None, use_for_bootstrap: bool = False, - customization_script: str = None + sourcetype: str = None, customization_script: str = None ) -> None: """ Add pacman repository @@ -133,7 +132,6 @@ def add_repo( :param bool repo_gpgcheck: enable database signature validation :param bool pkg_gpgcheck: enable package signature validation :param str sourcetype: unused - :param bool use_for_bootstrap: unused :param str customization_script: custom script called after the repo file was created """ diff --git a/kiwi/repository/zypper.py b/kiwi/repository/zypper.py index 7f53bebcb4c..93a80b86c5a 100644 --- a/kiwi/repository/zypper.py +++ b/kiwi/repository/zypper.py @@ -252,8 +252,7 @@ def add_repo( prio: int = None, dist: str = None, components: str = None, user: str = None, secret: str = None, credentials_file: str = None, repo_gpgcheck: bool = False, pkg_gpgcheck: bool = False, - sourcetype: str = None, use_for_bootstrap: bool = False, - customization_script: str = None + sourcetype: str = None, customization_script: str = None ) -> None: """ Add zypper repository @@ -270,7 +269,6 @@ def add_repo( :param bool repo_gpgcheck: enable repository signature validation :param bool pkg_gpgcheck: enable package signature validation :param str sourcetype: unused - :param boot use_for_bootstrap: unused :param str customization_script: custom script called after the repo file was created """ diff --git a/kiwi/schema/kiwi.rnc b/kiwi/schema/kiwi.rnc index 3185e28448b..607367b513e 100644 --- a/kiwi/schema/kiwi.rnc +++ b/kiwi/schema/kiwi.rnc @@ -1135,25 +1135,6 @@ div { attribute sourcetype { "baseurl" | "metalink" | "mirrorlist" } - k.repository.use_for_bootstrap.attribute = - ## Specify whether this repository should be the one used for - ## bootstrapping or not. False by default. Only a single repository - ## is allowed to be used for bootstrapping. If none is set the - ## last one is picked. - attribute use_for_bootstrap { xsd:boolean } - >> sch:pattern [ id = "use_for_bootstrap" is-a = "repo_type" - sch:param [ name = "attr" value = "use_for_bootstrap" ] - sch:param [ name = "types" value = "apt-deb" ] - ] - >> sch:pattern [ id = "single_deboostrap_repo" - sch:rule [ context = "image" - sch:assert [ - test = "count(repository[@use_for_bootstrap='true'])<=1" - "There can only be a single repository set for " - "bootstrap ('use_for_bootstrap' attribute)" - ] - ] - ] k.repository.attlist = k.repository.type.attribute? & k.repository.profiles.attribute? & @@ -1171,8 +1152,7 @@ div { k.repository.package_gpgcheck.attribute? & k.repository.priority.attribute? & k.repository.password.attribute? & - k.repository.username.attribute? & - k.repository.use_for_bootstrap.attribute? + k.repository.username.attribute? k.repository = ## The Name of the Repository element repository { @@ -3545,7 +3525,7 @@ div { ## The tarball will be unpacked and used as the bootstrap ## rootfs to begin with. The feature is currently only ## available with the apt package manager to allow an - ## alternative bootstrap method for debootstrap + ## alternative bootstrap method attribute bootstrap_package { text } >> sch:pattern [ id = "bootstrap_package" is-a = "packages_type" sch:param [ name = "attr" value = "bootstrap_package" ] diff --git a/kiwi/schema/kiwi.rng b/kiwi/schema/kiwi.rng index d9f451f312c..44b209fb03c 100644 --- a/kiwi/schema/kiwi.rng +++ b/kiwi/schema/kiwi.rng @@ -1728,24 +1728,6 @@ be a simple repository url - - - Specify whether this repository should be the one used for -bootstrapping or not. False by default. Only a single repository -is allowed to be used for bootstrapping. If none is set the -last one is picked. - - - - - - - - - There can only be a single repository set for bootstrap ('use_for_bootstrap' attribute) - - - @@ -1793,9 +1775,6 @@ last one is picked. - - - @@ -5354,7 +5333,7 @@ in /var/cache/kiwi/bootstrap/PACKAGE_NAME.ARCH.tar.xz The tarball will be unpacked and used as the bootstrap rootfs to begin with. The feature is currently only available with the apt package manager to allow an -alternative bootstrap method for debootstrap +alternative bootstrap method diff --git a/kiwi/system/prepare.py b/kiwi/system/prepare.py index 3fd007b2006..50f7aa635be 100644 --- a/kiwi/system/prepare.py +++ b/kiwi/system/prepare.py @@ -170,8 +170,6 @@ def setup_repositories( xml_repo ) repo_sourcetype = xml_repo.get_sourcetype() - repo_use_for_bootstrap = \ - True if xml_repo.get_use_for_bootstrap() else False log.info( 'Setting up repository %s', Uri.print_sensitive(repo_source) ) @@ -211,8 +209,7 @@ def setup_repositories( repo_type, repo_priority, repo_dist, repo_components, repo_user, repo_secret, uri.credentials_file_name(), repo_repository_gpgcheck, repo_package_gpgcheck, - repo_sourcetype, repo_use_for_bootstrap, - repo_customization_script + repo_sourcetype, repo_customization_script ) if clear_cache: repo.delete_repo_cache(repo_alias) diff --git a/kiwi/system/setup.py b/kiwi/system/setup.py index 741500711f9..6098fd3bb4f 100644 --- a/kiwi/system/setup.py +++ b/kiwi/system/setup.py @@ -161,7 +161,6 @@ def import_repositories_marked_as_imageinclude(self) -> None: xml_repo ) repo_sourcetype = xml_repo.get_sourcetype() - repo_use_for_bootstrap = False uri = Uri(repo_source, repo_type) repo_source_translated = uri.translate( check_build_environment=False @@ -185,8 +184,7 @@ def import_repositories_marked_as_imageinclude(self) -> None: repo_type, repo_priority, repo_dist, repo_components, repo_user, repo_secret, uri.credentials_file_name(), repo_repository_gpgcheck, repo_package_gpgcheck, - repo_sourcetype, repo_use_for_bootstrap, - repo_customization_script + repo_sourcetype, repo_customization_script ) def import_cdroot_files(self, target_dir: str) -> None: diff --git a/kiwi/tasks/system_prepare.py b/kiwi/tasks/system_prepare.py index 87151a42642..829a458a71b 100644 --- a/kiwi/tasks/system_prepare.py +++ b/kiwi/tasks/system_prepare.py @@ -128,9 +128,6 @@ from kiwi.system.setup import SystemSetup from kiwi.defaults import Defaults from kiwi.system.profile import Profile -from kiwi.command import Command - -from kiwi.exceptions import KiwiCommandError log = logging.getLogger('kiwi') @@ -252,29 +249,9 @@ def process(self): ] + self.xml_state.get_repositories_signing_keys(), self.global_args['--target-arch'] ) as manager: - run_bootstrap = True - if self.xml_state.get_package_manager() == 'apt' and \ - self.command_args['--allow-existing-root']: - # try to call apt-get inside of the existing root. - # If the call succeeds we skip calling debootstrap again - # and assume the root to be ok to proceed with apt-get - # if it fails, treat the root as dirty and give the - # bootstrap a try - try: - Command.run( - ['chroot', abs_root_path, 'apt-get', '--version'] - ) - run_bootstrap = False - log.warning( - 'debootstrap will only be called once, skipped' - ) - except KiwiCommandError: - run_bootstrap = True - - if run_bootstrap: - system.install_bootstrap( - manager, self.command_args['--add-bootstrap-package'] - ) + system.install_bootstrap( + manager, self.command_args['--add-bootstrap-package'] + ) setup = SystemSetup( self.xml_state, abs_root_path diff --git a/kiwi/xml_parse.py b/kiwi/xml_parse.py index b3ec3e3b1a6..d6168ed8383 100644 --- a/kiwi/xml_parse.py +++ b/kiwi/xml_parse.py @@ -2442,7 +2442,7 @@ class repository(k_source): """The Name of the Repository""" subclass = None superclass = k_source - def __init__(self, source=None, type_=None, profiles=None, arch=None, alias=None, sourcetype=None, components=None, distribution=None, imageinclude=None, imageonly=None, repository_gpgcheck=None, customize=None, package_gpgcheck=None, priority=None, password=None, username=None, use_for_bootstrap=None): + def __init__(self, source=None, type_=None, profiles=None, arch=None, alias=None, sourcetype=None, components=None, distribution=None, imageinclude=None, imageonly=None, repository_gpgcheck=None, customize=None, package_gpgcheck=None, priority=None, password=None, username=None): self.original_tagname_ = None super(repository, self).__init__(source, ) self.type_ = _cast(None, type_) @@ -2460,7 +2460,6 @@ def __init__(self, source=None, type_=None, profiles=None, arch=None, alias=None self.priority = _cast(int, priority) self.password = _cast(None, password) self.username = _cast(None, username) - self.use_for_bootstrap = _cast(bool, use_for_bootstrap) def factory(*args_, **kwargs_): if CurrentSubclassModule_ is not None: subclass = getSubclassFromModule_( @@ -2502,8 +2501,6 @@ def get_password(self): return self.password def set_password(self, password): self.password = password def get_username(self): return self.username def set_username(self, username): self.username = username - def get_use_for_bootstrap(self): return self.use_for_bootstrap - def set_use_for_bootstrap(self, use_for_bootstrap): self.use_for_bootstrap = use_for_bootstrap def validate_arch_name(self, value): # Validate type arch-name, a restriction on xs:token. if value is not None and Validate_simpletypes_: @@ -2593,9 +2590,6 @@ def exportAttributes(self, outfile, level, already_processed, namespaceprefix_=' if self.username is not None and 'username' not in already_processed: already_processed.add('username') outfile.write(' username=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.username), input_name='username')), )) - if self.use_for_bootstrap is not None and 'use_for_bootstrap' not in already_processed: - already_processed.add('use_for_bootstrap') - outfile.write(' use_for_bootstrap="%s"' % self.gds_format_boolean(self.use_for_bootstrap, input_name='use_for_bootstrap')) def exportChildren(self, outfile, level, namespaceprefix_='', name_='repository', fromsubclass_=False, pretty_print=True): super(repository, self).exportChildren(outfile, level, namespaceprefix_, name_, True, pretty_print=pretty_print) def build(self, node): @@ -2695,15 +2689,6 @@ def buildAttributes(self, node, attrs, already_processed): if value is not None and 'username' not in already_processed: already_processed.add('username') self.username = value - value = find_attr_value_('use_for_bootstrap', node) - if value is not None and 'use_for_bootstrap' not in already_processed: - already_processed.add('use_for_bootstrap') - if value in ('true', '1'): - self.use_for_bootstrap = True - elif value in ('false', '0'): - self.use_for_bootstrap = False - else: - raise_parse_error(node, 'Bad boolean attribute') super(repository, self).buildAttributes(node, attrs, already_processed) def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): super(repository, self).buildChildren(child_, node, nodeName_, True) diff --git a/test/unit/system/prepare_test.py b/test/unit/system/prepare_test.py index 15dc32de13c..d1aa572c199 100644 --- a/test/unit/system/prepare_test.py +++ b/test/unit/system/prepare_test.py @@ -287,12 +287,12 @@ def test_setup_repositories( call( 'uri-alias', 'uri', None, 42, None, None, None, None, 'credentials-file', None, None, - 'baseurl', False, None + 'baseurl', None ), call( 'uri-alias', 'uri', 'rpm-md', None, None, None, None, None, 'credentials-file', None, None, - None, False, '../data/script' + None, '../data/script' ) ] assert repo.delete_repo_cache.call_args_list == [ diff --git a/test/unit/system/setup_test.py b/test/unit/system/setup_test.py index 7799bcb2043..4fe2d43e077 100644 --- a/test/unit/system/setup_test.py +++ b/test/unit/system/setup_test.py @@ -1678,7 +1678,7 @@ def test_import_repositories_marked_as_imageinclude( self.setup_with_real_xml.import_repositories_marked_as_imageinclude() assert repo.add_repo.call_args_list[0] == call( 'uri-alias', 'uri', 'rpm-md', None, None, None, None, None, - 'kiwiRepoCredentials', None, None, None, False, '../data/script' + 'kiwiRepoCredentials', None, None, None, '../data/script' ) @patch('os.path.exists') diff --git a/test/unit/tasks/system_prepare_test.py b/test/unit/tasks/system_prepare_test.py index 11b17537ef9..37e03665919 100644 --- a/test/unit/tasks/system_prepare_test.py +++ b/test/unit/tasks/system_prepare_test.py @@ -10,8 +10,6 @@ from ..test_helper import argv_kiwi_tests -from kiwi.exceptions import KiwiCommandError - from kiwi.tasks.system_prepare import SystemPrepareTask @@ -181,33 +179,6 @@ def test_process_system_prepare(self, mock_SystemPrepare, mock_keys): ) assert system_prepare.clean_package_manager_leftovers.called - @patch('kiwi.xml_state.XMLState.get_package_manager') - @patch('kiwi.tasks.system_prepare.SystemPrepare') - def test_process_system_prepare_run_debootstrap_only_once( - self, mock_SystemPrepare, mock_get_package_manager - ): - manager = MagicMock() - system_prepare = Mock() - system_prepare.setup_repositories = Mock( - return_value=manager - ) - mock_SystemPrepare.return_value.__enter__.return_value = system_prepare - self._init_command_args() - mock_get_package_manager.return_value = 'apt' - self.task.command_args['--allow-existing-root'] = True - - # debootstrap must be called if chroot with apt-get failed - self.command.run.side_effect = KiwiCommandError('error') - self.task.process() - assert system_prepare.install_bootstrap.called - - # debootstrap must not be called if chroot looks good - self.command.run.side_effect = None - system_prepare.install_bootstrap.reset_mock() - with self._caplog.at_level(logging.WARNING): - self.task.process() - assert not system_prepare.install_bootstrap.called - @patch('kiwi.xml_state.XMLState.get_repositories_signing_keys') @patch('kiwi.tasks.system_prepare.SystemPrepare') def test_process_system_prepare_add_package(