mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
package: Add option to skip recommends
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
3 files changed
+17
-5
No files matched your search
+7
-2
@@ -69,7 +69,7 @@ class Transaction(object):
|
||||
self.percentage = 0
|
||||
self.stderr = None
|
||||
|
||||
def install(self):
|
||||
def install(self, skip_recommends=False):
|
||||
"""Run an apt-get transaction to install given packages.
|
||||
|
||||
FreedomBox Service (Plinth) needs to be running as root when calling
|
||||
@@ -79,7 +79,12 @@ class Transaction(object):
|
||||
"""
|
||||
try:
|
||||
self._run_apt_command(['update'])
|
||||
self._run_apt_command(['install', self.module_name] +
|
||||
if skip_recommends:
|
||||
self._run_apt_command(
|
||||
['install', '--skip-recommends', self.module_name] +
|
||||
self.package_names)
|
||||
else:
|
||||
self._run_apt_command(['install', self.module_name] +
|
||||
self.package_names)
|
||||
except subprocess.CalledProcessError as exception:
|
||||
logger.exception('Error installing package: %s', exception)
|
||||
|
||||
+2
-2
@@ -100,7 +100,7 @@ class Helper(object):
|
||||
self.is_finished = True
|
||||
self.current_operation = None
|
||||
|
||||
def install(self, package_names):
|
||||
def install(self, package_names, skip_recommends=False):
|
||||
"""Install a set of packages marking progress."""
|
||||
if self.allow_install is False:
|
||||
# Raise error if packages are not already installed.
|
||||
@@ -119,7 +119,7 @@ class Helper(object):
|
||||
'step': 'install',
|
||||
'transaction': transaction,
|
||||
}
|
||||
transaction.install()
|
||||
transaction.install(skip_recommends)
|
||||
|
||||
def call(self, step, method, *args, **kwargs):
|
||||
"""Call an arbitrary method during setup and note down its stage."""
|
||||
|
||||
Reference in new issue
Block a user