Skip to content

Commit

Permalink
Drop use_for_bootstrap attribute and code
Browse files Browse the repository at this point in the history
There was an attribute named use_for_bootstrap and dedicated
to debootstrap. Since we delete all of debootstrap the attribute
and code should go away
  • Loading branch information
schaefi committed Jul 30, 2024
1 parent be28741 commit 70e4a41
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 150 deletions.
12 changes: 3 additions & 9 deletions kiwi/repository/apt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []

Expand Down Expand Up @@ -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
Expand All @@ -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
"""
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions kiwi/repository/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions kiwi/repository/dnf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 1 addition & 3 deletions kiwi/repository/dnf4.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
"""
Expand Down
4 changes: 1 addition & 3 deletions kiwi/repository/dnf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
"""
Expand Down
4 changes: 1 addition & 3 deletions kiwi/repository/pacman.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
"""
Expand Down
4 changes: 1 addition & 3 deletions kiwi/repository/zypper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
"""
Expand Down
24 changes: 2 additions & 22 deletions kiwi/schema/kiwi.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -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? &
Expand All @@ -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 {
Expand Down Expand Up @@ -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" ]
Expand Down
23 changes: 1 addition & 22 deletions kiwi/schema/kiwi.rng
Original file line number Diff line number Diff line change
Expand Up @@ -1728,24 +1728,6 @@ be a simple repository url</a:documentation>
</choice>
</attribute>
</define>
<define name="k.repository.use_for_bootstrap.attribute">
<attribute name="use_for_bootstrap">
<a:documentation>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.</a:documentation>
<data type="boolean"/>
</attribute>
<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>
<sch:pattern id="single_deboostrap_repo">
<sch:rule context="image">
<sch:assert test="count(repository[@use_for_bootstrap='true'])&lt;=1">There can only be a single repository set for bootstrap ('use_for_bootstrap' attribute)</sch:assert>
</sch:rule>
</sch:pattern>
</define>
<define name="k.repository.attlist">
<interleave>
<optional>
Expand Down Expand Up @@ -1793,9 +1775,6 @@ last one is picked.</a:documentation>
<optional>
<ref name="k.repository.username.attribute"/>
</optional>
<optional>
<ref name="k.repository.use_for_bootstrap.attribute"/>
</optional>
</interleave>
</define>
<define name="k.repository">
Expand Down Expand Up @@ -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</a:documentation>
alternative bootstrap method</a:documentation>
</attribute>
<sch:pattern id="bootstrap_package" is-a="packages_type">
<sch:param name="attr" value="bootstrap_package"/>
Expand Down
5 changes: 1 addition & 4 deletions kiwi/system/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions kiwi/system/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
29 changes: 3 additions & 26 deletions kiwi/tasks/system_prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -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
Expand Down
17 changes: 1 addition & 16 deletions kiwi/xml_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_)
Expand All @@ -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_(
Expand Down Expand Up @@ -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_:
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions test/unit/system/prepare_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 == [
Expand Down
2 changes: 1 addition & 1 deletion test/unit/system/setup_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
Loading

0 comments on commit 70e4a41

Please sign in to comment.