[Piuparts-commits] [SCM] piuparts git repository branch, bikeshed, updated. 0.52-50-g1ca8406

Andreas Beckmann anbe at debian.org
Sat Jun 1 13:43:14 UTC 2013


The following commit has been merged in the bikeshed branch:
commit c09c4741695b52017a6126fd77a9f9fcccd468bc
Author: Andreas Beckmann <anbe at debian.org>
Date:   Thu May 30 12:25:02 2013 +0200

    p: new option --allow-database
    
    allow starting MySQL or PostgreSQL servers in the chroot
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>

diff --git a/debian/changelog b/debian/changelog
index 59227cc..f55c264 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ piuparts (0.53) UNRELEASED; urgency=low
   [ Andreas Beckmann ]
   * piuparts.py:
     - Do not run adequate checks on possibly disappearing packages.
+    - Add --allow-database option that enables starting MySQL and PostgreSQL
+      database servers in the chroot.
   * piuparts.conf:
   * distros.conf:
     - Add "candidates" key to merge multiple Packages files into one virtual
diff --git a/piuparts.1.txt b/piuparts.1.txt
index 30e7b41..9667e92 100644
--- a/piuparts.1.txt
+++ b/piuparts.1.txt
@@ -43,6 +43,15 @@ Options must come before the other command line arguments.
 *-a*, *--apt*::
   The package arguments on the command line are to be treated as package names and installed via *apt-get* instead  of  being  names  of  package  files, to be installed via *dpkg -i*.
 
+*--allow-database*::
+  Allow starting MySQL and PostgreSQL database servers in the chroot for
+  packages requiring database access in their maintainer scripts.
+  Do not use this option if there is already a database server running on the
+  system running piuparts (or piuparts-slave)!
+  In master-slave setups with multiple slaves running on one host collisions
+  may occur, these will be detected by 'detect_piuparts_issues' and the
+  affected packages will be tested again.
+
 *--arch*='arch'::
   Create chroot and run tests for (non-default) architecture 'arch'. The default is the output from 'dpkg --print-architecture'.
 
diff --git a/piuparts.py b/piuparts.py
index 87e84e5..9c5e668 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -163,6 +163,7 @@ class Settings:
         self.dpkg_force_confdef = False
         self.scriptsdirs = []
         self.bindmounts = []
+        self.allow_database = False
         # chroot setup
         self.arch = None
         self.basetgz = None
@@ -1011,7 +1012,13 @@ class Chroot:
     def create_policy_rc_d(self):
         """Create a policy-rc.d that prevents daemons from running."""
         full_name = self.relative("usr/sbin/policy-rc.d")
-        create_file(full_name, "#!/bin/sh\nexit 101\n")
+        policy = "#!/bin/sh\n"
+        if settings.allow_database:
+            policy += 'test "$1" = "mysql" && exit 0\n'
+            policy += 'test "$1" = "postgresql" && exit 0\n'
+            policy += 'test "$1" = "postgresql-8.3" && exit 0\n'
+        policy += "exit 101\n"
+        create_file(full_name, policy)
         os.chmod(full_name, 0755)
         logging.debug("Created policy-rc.d and chmodded it.")
 
@@ -2609,6 +2616,10 @@ def parse_command_line():
                       action='store_true',
                       help="Do not verify signatures from the Release files when running debootstrap.")
 
+    parser.add_option("--allow-database", default=False,
+                      action='store_true',
+                      help="Allow database servers (MySQL, PostgreSQL) to be started in the chroot.")
+
     parser.add_option("--distupgrade-to-testdebs", default=False,
                       action='store_true',
                       help="Use the testdebs repository as distupgrade target.")
@@ -2848,6 +2859,7 @@ def parse_command_line():
     settings.dpkg_force_confdef = opts.dpkg_force_confdef
     settings.scriptsdirs = opts.scriptsdir
     settings.bindmounts += opts.bindmount
+    settings.allow_database = opts.allow_database
     # chroot setup
     settings.arch = opts.arch
     settings.basetgz = opts.basetgz

-- 
piuparts git repository



More information about the Piuparts-commits mailing list