[Piuparts-commits] [SCM] piuparts git repository branch, piatti, updated. 0.44-598-gace668e

Andreas Beckmann debian at abeckmann.de
Sun May 27 13:47:17 UTC 2012


The following commit has been merged in the piatti branch:
commit 70f66bfd1a2d13e972439a75a0edf6c6c9e580f5
Author: Leo Iannacone <l3on at ubuntu.com>
Date:   Thu May 24 17:18:47 2012 +0200

    add --existing-chroot option
    
    piuparts.py: add --existing-chroot option, specify a directory as source
    for the chroot, instead of building a new one with debootstrap or
    decompress an archived one.
    
    Signed-off-by: Andreas Beckmann <debian at abeckmann.de>

diff --git a/debian/changelog b/debian/changelog
index 6b901a2..c6259b9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,11 @@ piuparts (0.45) UNRELEASED; urgency=low
     - Implement --install-remove-install option to test installation in
       config-files-remaining state.  (Closes: #359154)
 
+  [ Leo Iannacone ]
+  * piuparts.py: add --existing-chroot option, specify a directory as source
+    for the chroot, instead of building a new one with debootstrap or
+    decompress an archived one.  (Closes: #658044)
+
  -- Holger Levsen <holger at debian.org>  Thu, 17 May 2012 21:08:16 +0200
 
 piuparts (0.44) unstable; urgency=low
diff --git a/piuparts.1.txt b/piuparts.1.txt
index f629546..b0abb03 100644
--- a/piuparts.1.txt
+++ b/piuparts.1.txt
@@ -71,6 +71,11 @@ The tarball can be created with the '-s' option, or you can use one that *pbuild
 *--extra-old-packages*='pkg1[,pkg2]...'::
   Install additional old packages before upgrading.  Allows testing package renames/merges where the old package is no longer available in the new distribution and the new one utilizes Conflicts/Replaces.  The argument is a comma separated list of package names and the option can be given multiple times.
 
+*-e* 'dirname', *--existing-chroot*='dirname'::
+  Use the specified directory as source for the new chroot, instead of building
+  a new one with debootstrap. This is similar to '--basetgz', but the contents
+  are not archived.
+
 *-i* 'filename', *--ignore*='filename'::
   Add a filename to the list of filenames to be ignored when comparing changes before and after installation. By default, piuparts ignores files that always change during a package installation and uninstallation, such as *dpkg* status files. The filename should be relative to the root of the chroot (e.g., _var/lib/dpkg/status_). This option can be used as many times as necessary.
 
diff --git a/piuparts.py b/piuparts.py
index 6d45357..5be5580 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -146,6 +146,7 @@ class Settings:
         self.basetgz = None
         self.savetgz = None
         self.lvm_volume = None
+        self.existing_chroot = None
         self.end_meta = None
         self.save_end_meta = None
         self.skip_minimize = True
@@ -732,6 +733,8 @@ class Chroot:
             self.unpack_from_tgz(settings.basetgz)
         elif settings.lvm_volume:
             self.setup_from_lvm(settings.lvm_volume)
+        elif settings.existing_chroot:
+            self.setup_from_dir(settings.existing_chroot)
         else:
             self.setup_minimal_chroot()
 
@@ -816,6 +819,14 @@ class Chroot:
         logging.info("Mounting LVM snapshot to %s" % self.name); 
         run(['mount', self.lvm_snapshot, self.name])
 
+    def setup_from_dir(self, dirname):
+        """Create chroot from an existing one."""
+        logging.debug("Copying %s into %s" % (dirname, self.name))
+        for name in os.listdir(dirname):
+            src = os.path.join(dirname, name)
+            dst = os.path.join(self.name, name)
+            run(["cp", "-ax", src, dst])
+
     def run(self, command, ignore_errors=False):
         prefix = []
         if settings.eatmydata and os.path.isfile(os.path.join(self.name,
@@ -2257,6 +2268,11 @@ def parse_command_line():
                       action='store_true',
                       help="Do not verify signatures from the Release files when running debootstrap.")
 
+    parser.add_option("-e", "--existing-chroot", metavar="DIR",
+                      help="Use DIR as the contents of the initial " +
+                           "chroot, instead of building a new one with " +
+                           "debootstrap")
+
     parser.add_option("-i", "--ignore", action="append", metavar="FILENAME",
                       default=[],
                       help="Add FILENAME to list of filenames to be " +
@@ -2438,6 +2454,7 @@ def parse_command_line():
     settings.savetgz = opts.save
     settings.lvm_volume = opts.lvm_volume
     settings.lvm_snapshot_size = opts.lvm_snapshot_size
+    settings.existing_chroot = opts.existing_chroot
     settings.end_meta = opts.end_meta
     settings.save_end_meta = opts.save_end_meta
     settings.skip_minimize = opts.skip_minimize

-- 
piuparts git repository



More information about the Piuparts-commits mailing list