if not title:
title = _("Installing Packages")
- # Set up Pakfire
- with self.tui.progress(title, _("Installing packages..."), max_value=100) as t:
- # Create a new Pakfire instance
- p = self.bricklayer.setup_pakfire()
+ # Create a new Pakfire instance
+ p = self.bricklayer.setup_pakfire()
+
+ # Create a new transaction
+ t = pakfire.Transaction(p)
+
+ # Install all packages
+ for package in packages:
+ t.install(package)
+ # Solve the transaction
+ with self.tui.progress(title, _("Solving dependencies...")):
try:
- # Install packages
- p.install(packages, status_callback=t.status)
+ t.solve()
# Abort on any dependencies problems
except pakfire.DependencyError as e:
problems = e.args[0]
- # Format problem descriptions
- text = []
- for problem in problems:
- lines = [
- "* %s" % problem
- ]
- for solution in problem.solutions:
- lines.append(" --> %s" % solution)
-
- text.append("\n".join(lines))
-
+ # Show an error with the error
self.tui.error(
_("Dependency Problem"),
- _(
- "A problem has occured during resolving package dependencies:\n\n%s",
- "Problems have occured during resolving package dependencies:\n\n%s",
- len(problems),
- ) % "\n\n".join(text),
+ _("Problems have occured during resolving package dependencies"
+ ":\n\n%s") % problems,
width=78,
)
+ # Run the transaction
+ t.run()
+
class InteractiveStep(Step):
"""