return output
- def setup_pakfire(self):
+ def setup_pakfire(self, **kwargs):
"""
Calls Pakfire and has it load its configuration
"""
return pakfire.Pakfire(self.root, arch=self.arch,
- conf="/etc/pakfire/distros/ipfire3.conf")
+ conf="/etc/pakfire/distros/ipfire3.conf", **kwargs)
def _select_bootloaders(self):
"""
# Set up Pakfire
with self.tui.progress(
- _("Setting Up Pakfire"),
- _("Pakfire is being set up..."),
- ):
- p = self.bricklayer.setup_pakfire()
-
- with p as p:
- # Resolve package dependencies
- with self.tui.progress(
- _("Resolving Dependencies"),
- _("Resolving package dependencies..."),
- ):
- try:
- transaction = p.install(packages)
-
- # Abort on any dependencies problems
- except pakfire.errors.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))
-
- 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),
- width=78,
- )
-
- # Log the transaction
- log.info("%s" % transaction.dump())
-
- # Run the transaction
- with self.tui.progress(
- _("Installing Packages"),
- _("Installing packages..."),
- ):
- transaction.run()
+ _("Installing Packages"),
+ _("Installing packages..."),
+ max_value=100,
+ ) as t:
+ # Create a new Pakfire instance
+ p = self.bricklayer.setup_pakfire(**t.callbacks)
+
+ try:
+ # Install packages
+ p.install(packages)
+
+ # Abort on any dependencies problems
+ except pakfire.errors.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))
+
+ 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),
+ width=78,
+ )
class InteractiveStep(Step):