[Piuparts-commits] [piuparts] 01/01: Add new option, --hard-link, and do *not* use it by default. (Closes: #841025)

Holger Levsen holger at layer-acht.org
Thu Dec 1 18:47:29 UTC 2016


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch develop
in repository piuparts.

commit 15790003549221a081ac62cf64d2dfea8c5ca0c9
Author: Alexander Thomas <alexander.thomas at esaturnus.com>
Date:   Mon Oct 17 11:33:46 2016 +0200

    Add new option, --hard-link, and do *not* use it by default.
    (Closes: #841025)
    
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 piuparts.1.txt | 7 ++++++-
 piuparts.py    | 9 ++++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/piuparts.1.txt b/piuparts.1.txt
index a857f4d..80ae746 100644
--- a/piuparts.1.txt
+++ b/piuparts.1.txt
@@ -90,7 +90,7 @@ The tarball can be created with the '-s' option, or you can use one that *pbuild
 *-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.
+  are not archived. See also the --hard-link option.
 
 *--distupgrade-to-testdebs*::
   Use the "testdebs" repository to override the packages in the distupgrade
@@ -111,6 +111,11 @@ The tarball can be created with the '-s' option, or you can use one that *pbuild
   Takes a comma separated list of package names and can be given multiple
   times.
 
+*--hard-link*::
+  When the --existing-chroot option is used, and the source directory is on the
+  same filesystem, hard-link files instead of copying them. This is faster, but
+  any modifications to files will be reflected in the originals.
+
 *-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 76a10f2..d3e845f 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -178,6 +178,7 @@ class Settings:
         self.lvm_snapshot_size = "1G"
         self.adt_virt = None
         self.existing_chroot = None
+        self.hard_link = False
         self.schroot = None
         self.end_meta = None
         self.save_end_meta = None
@@ -879,7 +880,7 @@ class Chroot:
         """Create chroot from an existing one."""
         # if on same device, make hard link
         cmd = ["cp"]
-        if os.stat(dirname).st_dev == os.stat(self.name).st_dev:
+        if settings.hard_link and os.stat(dirname).st_dev == os.stat(self.name).st_dev:
             cmd += ["-al"]
             logging.debug("Hard linking %s to %s" % (dirname, self.name))
         else:
@@ -2774,6 +2775,11 @@ def parse_command_line():
                            "chroot, instead of building a new one with " +
                            "debootstrap")
 
+    parser.add_option("--hard-link", default=False,
+                      action='store_true',
+                      help="When using --existing-chroot, and the source dir is on the same"
+                           "filesystem, hard-link files instead of copying them.")
+
     parser.add_option("-i", "--ignore", action="append", metavar="FILENAME",
                       default=[],
                       help="Add FILENAME to list of filenames to be " +
@@ -3023,6 +3029,7 @@ def parse_command_line():
     settings.lvm_volume = opts.lvm_volume
     settings.lvm_snapshot_size = opts.lvm_snapshot_size
     settings.existing_chroot = opts.existing_chroot
+    settings.hard_link = opts.hard_link
     settings.schroot = opts.schroot
     settings.end_meta = opts.end_meta
     settings.save_end_meta = opts.save_end_meta

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git



More information about the Piuparts-commits mailing list