[Treepkg-commits] r139 - in trunk: bin treepkg

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Nov 28 16:36:11 CET 2008


Author: bh
Date: 2008-11-28 16:36:10 +0100 (Fri, 28 Nov 2008)
New Revision: 139

Modified:
   trunk/bin/treepkgbuilder.py
   trunk/treepkg/builder.py
Log:
Add --bind-mount option to bin/treepkgbuilder.py's login command and a
corresponding parameter to the login method of the PBuilder class


Modified: trunk/bin/treepkgbuilder.py
===================================================================
--- trunk/bin/treepkgbuilder.py	2008-11-28 15:11:18 UTC (rev 138)
+++ trunk/bin/treepkgbuilder.py	2008-11-28 15:36:10 UTC (rev 139)
@@ -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):

Modified: trunk/treepkg/builder.py
===================================================================
--- trunk/treepkg/builder.py	2008-11-28 15:11:18 UTC (rev 138)
+++ trunk/treepkg/builder.py	2008-11-28 15:36:10 UTC (rev 139)
@@ -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)



More information about the Treepkg-commits mailing list