bootstrap-vz/common/tasks/host.py
Anders Ingemann 1c93094833 Integrated package plugin with base system
New phase introduced "package installation" (fixes #114)
Apt source lines are now parsed, this allows to verify the target release of added packages.
All packages (except locales) are now installed *after* bootstrapping (fixes #123)
Added env argument to log_(check_)call
HostDependencies have been refactored a little
2013-12-29 20:58:06 +01:00

38 lines
1.2 KiB
Python

from base import Task
from common import phases
from common.exceptions import TaskError
class HostDependencies(Task):
description = 'Determining required host dependencies'
phase = phases.preparation
def run(self, info):
info.host_dependencies.add('debootstrap')
from common.fs.loopbackvolume import LoopbackVolume
if isinstance(info.volume, LoopbackVolume):
info.host_dependencies.add('qemu-utils')
if 'xfs' in (p.filesystem for p in info.volume.partition_map.partitions):
info.host_dependencies.add('xfsprogs')
from base.fs.partitionmaps.none import NoPartitions
if not isinstance(info.volume.partition_map, NoPartitions):
info.host_dependencies.update(['parted', 'kpartx'])
class CheckHostDependencies(Task):
description = 'Checking installed host packages'
phase = phases.preparation
predecessors = [HostDependencies]
def run(self, info):
from common.tools import log_check_call
from subprocess import CalledProcessError
for package in info.host_dependencies:
try:
log_check_call(['/usr/bin/dpkg-query', '-s', package])
except CalledProcessError:
msg = "The package ``{0}\'\' is not installed".format(package)
raise TaskError(msg)