changeset 213:98c5aab790bb

Add --bind-mount option to bin/treepkgbuilder.py's login command and a corresponding parameter to the login method of the PBuilder class
author Bernhard Herzog <bh@intevation.de>
date Fri, 28 Nov 2008 15:36:10 +0000
parents 4d6c3431face
children 4307e25d2afe
files bin/treepkgbuilder.py treepkg/builder.py
diffstat 2 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/bin/treepkgbuilder.py	Fri Nov 28 15:11:18 2008 +0000
+++ b/bin/treepkgbuilder.py	Fri Nov 28 15:36:10 2008 +0000
@@ -124,8 +124,17 @@
 
     names = ("login",)
 
+    def create_parser(self):
+        parser = super(LoginCommand, self).create_parser()
+        parser.set_defaults(bind_mount=[])
+        parser.add_option("--bind-mount", action="append",
+                          help=("Directories to bind-mount in the chroot"
+                                " environment."))
+        return parser
+
+
     def run(self):
-        self.get_builder().login()
+        self.get_builder().login(bindmounts=self.opts.bind_mount)
 
 
 class BuildCommand(Command):
--- a/treepkg/builder.py	Fri Nov 28 15:11:18 2008 +0000
+++ b/treepkg/builder.py	Fri Nov 28 15:36:10 2008 +0000
@@ -246,9 +246,13 @@
                            args=args, script=script),
                  suppress_output=False)
 
-    def login(self):
+    def login(self, bindmounts=()):
         """Start an interactive shell in the pbuilder environment"""
+        args = []
+        for mount in bindmounts:
+            args.extend(["--bindmounts", mount])
         run.call(cmdexpand("@rootcmd /usr/sbin/pbuilder login"
-                           " --configfile $pbuilderrc",
-                           rootcmd=self.root_cmd, pbuilderrc=self.pbuilderrc),
+                           " --configfile $pbuilderrc @args",
+                           rootcmd=self.root_cmd, pbuilderrc=self.pbuilderrc,
+                           args=args),
                  suppress_output=False)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)