]> git.siccegge.de Git - forks/vmdebootstrap.git/commitdiff
Fix package lists if no necessary packages exist
authorNeil Williams <codehelp@debian.org>
Tue, 23 Dec 2014 16:25:39 +0000 (16:25 +0000)
committerNeil Williams <codehelp@debian.org>
Tue, 23 Dec 2014 16:25:39 +0000 (16:25 +0000)
On foreign architectures, it is quite possible to
not have "necessary_packages", so append the user-
specified list and the necessary list separately.
Tidy up undefined local variables.

vmdebootstrap

index ab9486b95647f607fd2ff908fcf12ee8386ae460..aae437a9120e5ceaab66e7a18fab1913badd9eea 100755 (executable)
@@ -318,6 +318,7 @@ class VmDebootstrap(cliapp.Application):  # pylint: disable=too-many-public-meth
             self.runcmd(['install-mbr', self.settings['image']])
 
     def setup_kpartx(self):
+        bootindex = None
         out = self.runcmd(['kpartx', '-avs', self.settings['image']])
         if self.settings['bootsize']:
             bootindex = 0
@@ -326,7 +327,7 @@ class VmDebootstrap(cliapp.Application):  # pylint: disable=too-many-public-meth
         else:
             rootindex = 0
             parts = 1
-            boot = None
+        boot = None
         devices = [line.split()[2]
                    for line in out.splitlines()
                    if line.startswith('add map ')]
@@ -367,9 +368,12 @@ class VmDebootstrap(cliapp.Application):  # pylint: disable=too-many-public-meth
             include.append('sudo')
 
         args = ['debootstrap', '--arch=%s' % self.settings['arch']]
-        if self.settings['package'] and len(necessary_packages) > 0:
+        if self.settings['package']:
             args.append(
-                '--include=%s' % ','.join(necessary_packages + include))
+                '--include=%s' % ','.join(include))
+            if len(necessary_packages) > 0:
+                args.append(
+                    '--include=%s' % ','.join(necessary_packages))
         if self.settings['foreign']:
             args.append('--foreign')
         if self.settings['variant']: