Fix indentation, remove unused import

use absolute path to apt-get
This commit is contained in:
Anders Ingemann 2013-08-17 16:49:38 +02:00
parent e4e6035eb2
commit 8fe457b2dc

View file

@ -8,31 +8,29 @@ import os
class AptSourcesBackports(Task): class AptSourcesBackports(Task):
description = 'Adding backports to sources.list' description = 'Adding backports to sources.list'
phase = phases.system_modification phase = phases.system_modification
after = [AptSources] after = [AptSources]
before = [AptUpgrade] before = [AptUpgrade]
def run(self, info):
sources_path = os.path.join(info.root, 'etc/apt/sources.list') def run(self, info):
with open(sources_path, 'a') as apt_sources: sources_path = os.path.join(info.root, 'etc/apt/sources.list')
apt_sources.write(('deb {apt_mirror} {release}-backports main\n' with open(sources_path, 'a') as apt_sources:
'deb-src {apt_mirror} {release}-backports main\n' apt_sources.write(('deb {apt_mirror} {release}-backports main\n'
.format(apt_mirror='http://http.debian.net/debian', 'deb-src {apt_mirror} {release}-backports main\n'
release=info.manifest.system['release']))) .format(apt_mirror='http://http.debian.net/debian',
release=info.manifest.system['release'])))
class AddBackportsPackages(Task): class AddBackportsPackages(Task):
description = 'Adding backport packages to the image' description = 'Adding backport packages to the image'
phase = phases.system_modification phase = phases.system_modification
after = [AptUpgrade] after = [AptUpgrade]
def run(self, info):
if 'packages' not in info.manifest.plugins['backports']:
return
def run(self, info): from common.tools import log_check_call
if 'packages' not in info.manifest.plugins['backports']: for pkg in info.manifest.plugins['backports']['packages']:
return log_check_call(['/usr/sbin/chroot', info.root, '/usr/bin/apt-get', 'install', '-y', '-t', info.manifest.system['release'] + '-backports', pkg])
from shutil import copy
from common.tools import log_check_call
for pkg in info.manifest.plugins['backports']['packages']:
log_check_call(['/usr/sbin/chroot', info.root, 'apt-get', 'install', '-y', '-t', info.manifest.system['release'] + '-backports', pkg])