diff test/test_builder.py @ 122:6e34fc4ebe39

New arguments for the PBuilder.build method: - bindmounts to specify extra directories to be bind-mounted in the chroot (corresponds to pbuilder's --bindmounts option) - extra_packages to specify extra packages to be installed in the chroot (corresponds to pbuilder's --extrapackages option) Also adds corresponding test cases.
author Bernhard Herzog <bh@intevation.de>
date Thu, 22 May 2008 09:58:57 +0000
parents 890bb70920d6
children 68d829cac3ff
line wrap: on
line diff
--- a/test/test_builder.py	Wed May 21 16:47:34 2008 +0000
+++ b/test/test_builder.py	Thu May 22 09:58:57 2008 +0000
@@ -64,6 +64,47 @@
                                  'my_dsc_file'])
         self.failUnless(os.path.isdir(binary_dir_name))
 
+    def test_build_with_bindmounts(self):
+        """Tests the PBuilder.build method with the bindmounts parameter"""
+        binary_dir_name = self.temp_file_name("binary")
+        if os.path.exists(binary_dir_name):
+            os.rmdir(binary_dir_name)
+        # sanity check: the binary directory must not exist yet.
+        self.failIf(os.path.exists(binary_dir_name))
+
+        builder = PBuilder("my_pbuilderrc", self.root_command)
+        builder.build("my_dsc_file", binary_dir_name, "the_logfile",
+                      bindmounts=["/home/builder/tracks",
+                                  "/home/builder/pbuilder"])
+        self.check_command_line(['/usr/sbin/pbuilder', 'build',
+                                 '--configfile', 'my_pbuilderrc',
+                                 '--bindmounts', "/home/builder/tracks",
+                                 '--bindmounts', "/home/builder/pbuilder",
+                                 '--logfile', 'the_logfile',
+                                 '--buildresult', binary_dir_name,
+                                 'my_dsc_file'])
+        self.failUnless(os.path.isdir(binary_dir_name))
+
+    def test_build_with_extra_packages(self):
+        """Tests the PBuilder.build method with the extra_packages parameter"""
+        binary_dir_name = self.temp_file_name("binary")
+        if os.path.exists(binary_dir_name):
+            os.rmdir(binary_dir_name)
+        # sanity check: the binary directory must not exist yet.
+        self.failIf(os.path.exists(binary_dir_name))
+
+        builder = PBuilder("my_pbuilderrc", self.root_command)
+        builder.build("my_dsc_file", binary_dir_name, "the_logfile",
+                      extra_packages=["subversion", "texinfo"])
+        self.check_command_line(['/usr/sbin/pbuilder', 'build',
+                                 '--configfile', 'my_pbuilderrc',
+                                 '--extrapackages', "subversion",
+                                 '--extrapackages', "texinfo",
+                                 '--logfile', 'the_logfile',
+                                 '--buildresult', binary_dir_name,
+                                 'my_dsc_file'])
+        self.failUnless(os.path.isdir(binary_dir_name))
+
     def test_run_script(self):
         builder = PBuilder("my_pbuilderrc", self.root_command)
         builder.run_script("my_script", logfile="the_logfile")
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)