[Treepkg-commits] r106 - in trunk: recipes/gnupg test treepkg

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Jun 25 15:36:39 CEST 2008


Author: bh
Date: 2008-06-25 15:36:38 +0200 (Wed, 25 Jun 2008)
New Revision: 106

Modified:
   trunk/recipes/gnupg/base.py
   trunk/test/test_builder.py
   trunk/treepkg/builder.py
Log:
Extend the PBuilder.run_script method so that the script can be called
with arguments


Modified: trunk/recipes/gnupg/base.py
===================================================================
--- trunk/recipes/gnupg/base.py	2008-06-24 19:02:20 UTC (rev 105)
+++ trunk/recipes/gnupg/base.py	2008-06-25 13:36:38 UTC (rev 106)
@@ -154,7 +154,7 @@
 
         treepkg.util.ensure_directory(self.src_dir)
         treepkg.util.ensure_directory(self.log_dir)
-        self.track.builder.run_script(script_name,
+        self.track.builder.run_script([script_name],
                                       logfile=os.path.join(self.log_dir,
                                                            "tarball_log.txt"),
                                       bindmounts=[self.work_dir, self.src_dir])

Modified: trunk/test/test_builder.py
===================================================================
--- trunk/test/test_builder.py	2008-06-24 19:02:20 UTC (rev 105)
+++ trunk/test/test_builder.py	2008-06-25 13:36:38 UTC (rev 106)
@@ -241,15 +241,23 @@
 
     def test_run_script(self):
         builder = PBuilder("my_pbuilderrc", self.root_command)
-        builder.run_script("my_script", logfile="the_logfile")
+        builder.run_script(["my_script"], logfile="the_logfile")
         self.check_command_line(['/usr/sbin/pbuilder', 'execute',
                                  '--configfile', 'my_pbuilderrc',
                                  '--logfile', 'the_logfile',
                                  'my_script'])
 
+    def test_run_script_with_arguments(self):
+        builder = PBuilder("my_pbuilderrc", self.root_command)
+        builder.run_script(["my_script", "--verbose"], logfile="the_logfile")
+        self.check_command_line(['/usr/sbin/pbuilder', 'execute',
+                                 '--configfile', 'my_pbuilderrc',
+                                 '--logfile', 'the_logfile',
+                                 'my_script', '--verbose'])
+
     def test_run_script_with_bindmounts(self):
         builder = PBuilder("my_pbuilderrc", self.root_command)
-        builder.run_script("my_script", logfile="the_logfile",
+        builder.run_script(["my_script"], logfile="the_logfile",
                            bindmounts=("/home/builder/foo",
                                        "/home/builder/treepkg"))
         self.check_command_line(['/usr/sbin/pbuilder', 'execute',

Modified: trunk/treepkg/builder.py
===================================================================
--- trunk/treepkg/builder.py	2008-06-24 19:02:20 UTC (rev 105)
+++ trunk/treepkg/builder.py	2008-06-25 13:36:38 UTC (rev 106)
@@ -186,7 +186,8 @@
     def run_script(self, script, logfile, bindmounts=()):
         """Execute a script in pbuilder's chroot environment
         Parameters:
-           script -- The filename of the script
+           script -- A list of strings with the command line to invoke the
+                     script
            logfile -- name of the logfile of the build
            bindmounts -- Sequence of directory names that should be
                          bind-mounted in the pbuilder chroot
@@ -205,7 +206,7 @@
             args.extend(["--bindmounts", mount])
 
         run.call(cmdexpand("@rootcmd /usr/sbin/pbuilder execute"
-                           " --configfile $pbuilderrc @args $script",
+                           " --configfile $pbuilderrc @args @script",
                            rootcmd=self.root_cmd, pbuilderrc=self.pbuilderrc,
                            args=args, script=script),
                  suppress_output=False)



More information about the Treepkg-commits mailing list