From 8fe457b2dc52ef5d41d05afb933af51030ae407f Mon Sep 17 00:00:00 2001 From: Anders Ingemann Date: Sat, 17 Aug 2013 16:49:38 +0200 Subject: [PATCH] Fix indentation, remove unused import use absolute path to apt-get --- plugins/backports/tasks.py | 40 ++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/plugins/backports/tasks.py b/plugins/backports/tasks.py index 19c016c..a17863e 100644 --- a/plugins/backports/tasks.py +++ b/plugins/backports/tasks.py @@ -8,31 +8,29 @@ import os class AptSourcesBackports(Task): - description = 'Adding backports to sources.list' - phase = phases.system_modification + description = 'Adding backports to sources.list' + phase = phases.system_modification after = [AptSources] before = [AptUpgrade] - def run(self, info): - sources_path = os.path.join(info.root, 'etc/apt/sources.list') - with open(sources_path, 'a') as apt_sources: - apt_sources.write(('deb {apt_mirror} {release}-backports main\n' - 'deb-src {apt_mirror} {release}-backports main\n' - .format(apt_mirror='http://http.debian.net/debian', - release=info.manifest.system['release']))) + + def run(self, info): + sources_path = os.path.join(info.root, 'etc/apt/sources.list') + with open(sources_path, 'a') as apt_sources: + apt_sources.write(('deb {apt_mirror} {release}-backports main\n' + 'deb-src {apt_mirror} {release}-backports main\n' + .format(apt_mirror='http://http.debian.net/debian', + release=info.manifest.system['release']))) class AddBackportsPackages(Task): - description = 'Adding backport packages to the image' - phase = phases.system_modification - after = [AptUpgrade] + description = 'Adding backport packages to the image' + phase = phases.system_modification + after = [AptUpgrade] + def run(self, info): + if 'packages' not in info.manifest.plugins['backports']: + return - def run(self, info): - if 'packages' not in info.manifest.plugins['backports']: - return - - 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]) + from common.tools import log_check_call + for pkg in info.manifest.plugins['backports']['packages']: + log_check_call(['/usr/sbin/chroot', info.root, '/usr/bin/apt-get', 'install', '-y', '-t', info.manifest.system['release'] + '-backports', pkg])