Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions tmt/package_managers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,16 +540,6 @@ def create_repository(self, directory: Path) -> CommandOutput:
"""
return self.guest.execute(self.engine.create_repository(directory))

def install_from_repository(
self,
*installables: Installable,
options: Optional[Options] = None,
) -> CommandOutput:
"""
Install packages from a repository
"""
return self.install(*installables, options=options)

def install_local(
self,
*installables: Installable,
Expand All @@ -560,16 +550,6 @@ def install_local(
"""
return self.install(*installables, options=options)

def install_from_url(
self,
*installables: Installable,
options: Optional[Options] = None,
) -> CommandOutput:
"""
Install packages stored on a remote URL
"""
return self.install(*installables, options=options)

def enable_copr(self, *repositories: str) -> None:
"""
Enable requested copr repositories
Expand Down
15 changes: 4 additions & 11 deletions tmt/package_managers/apk.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ def _reduce_to_packages(self, *installables: Installable) -> ReducedPackages:
packages.append(self.path_to_package(installable))

else:
raise GeneralError(f"Package specification '{installable}' is not supported.")
raise tmt.utils.PrepareError(
f"Package manager 'apk' does not support installing from a remote "
f"URL '{installable}'."
)
Comment thread
AthreyVinay marked this conversation as resolved.

return packages

Expand Down Expand Up @@ -206,13 +209,3 @@ def install_local(
options.allow_untrusted = True
options.check_first = False
return self.install(*installables, options=options)

def install_from_url(
self,
*installables: Installable,
options: Optional[Options] = None,
) -> CommandOutput:
raise tmt.utils.PrepareError(
f'Package manager "{self.guest.facts.package_manager}" '
'does not support installing from a remote URL.'
)
32 changes: 1 addition & 31 deletions tmt/package_managers/bootc.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ def install(

if missing_installables:
self.engine.install(*missing_installables, options=options)
return self.build_container() or CommandOutput(stdout=None, stderr=None)

return CommandOutput(stdout=None, stderr=None)

Expand All @@ -329,7 +328,7 @@ def reinstall(
) -> CommandOutput:
self.engine.reinstall(*installables, options=options)

return self.build_container() or CommandOutput(stdout=None, stderr=None)
return CommandOutput(stdout=None, stderr=None)

def install_debuginfo(
self,
Expand All @@ -339,35 +338,6 @@ def install_debuginfo(
self.engine.install_debuginfo(*installables, options=options)
return CommandOutput(stdout=None, stderr=None)

def install_from_repository(
self,
*installables: Installable,
options: Optional[Options] = None,
) -> CommandOutput:

# Check presence to avoid unnecessary container rebuilds
presence = self.check_presence(*installables)

missing_installables = {i for i, present in presence.items() if not present}
if missing_installables:
self.engine.install(*missing_installables, options=options)

return CommandOutput(stdout=None, stderr=None)

def install_from_url(
self,
*installables: Installable,
options: Optional[Options] = None,
) -> CommandOutput:

presence = self.check_presence(*installables)

missing_installables = {i for i, present in presence.items() if not present}
if missing_installables:
self.engine.install(*missing_installables, options=options)

return CommandOutput(stdout=None, stderr=None)

def install_local(
self,
*installables: Installable,
Expand Down
12 changes: 7 additions & 5 deletions tmt/package_managers/rpm_ostree.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,10 @@ def sort_packages(
required: list[Installable] = []
recommended: list[Installable] = []

for installable in installables:
if all(self.check_presence(installable).values()):
presence = self.check_presence(*installables)

for installable, present in presence.items():
if present:
continue
if options.skip_missing:
recommended.append(installable)
Expand All @@ -228,7 +230,7 @@ def sort_packages(

return required, recommended

def install_from_repository(
def install(
self,
*installables: Installable,
options: Optional[Options] = None,
Expand All @@ -239,13 +241,13 @@ def install_from_repository(
for package in recommended:
self.info('package', str(package), 'green')
try:
self.install(package)
super().install(package, options=options)
except RunError as error:
self.debug(f"Package installation failed: {error}")
self.warn(f"Unable to install recommended package '{package}'.")

if required:
return self.install(*required)
return super().install(*required)

return CommandOutput(stdout=None, stderr=None)

Expand Down
4 changes: 2 additions & 2 deletions tmt/steps/prepare/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,15 +274,15 @@ def _install(

if self.remote_packages:
install_outputs.append(
guest.package_manager.install_from_url(
guest.package_manager.install(
*self._list_installables('remote package', *self.remote_packages),
options=options,
)
)

if self.packages:
install_outputs.append(
guest.package_manager.install_from_repository(
guest.package_manager.install(
*self._list_installables('package', *self.packages),
options=options,
)
Expand Down
Loading