Hi Stefano (2011.08.18_13:05:56_+0200) > I know this won't work on Ubuntu (where eatmydata isn't in main, so > debootstrap can't install it), but I can improve it to handle that > better). It can be installed after enabling universe in the chroot, and > we can also not run it if it isn't installed in the chroot.
Improved version attached. SR -- Stefano Rivera http://tumbleweed.org.za/ H: +27 21 465 6908 C: +27 72 419 8559 UCT: x3127
diff --git a/piuparts.1.txt b/piuparts.1.txt index 0c91c29..9b2f31c 100644 --- a/piuparts.1.txt +++ b/piuparts.1.txt @@ -65,6 +65,9 @@ The tarball can be created with the '-s' option, or you can use one that *pbuild *--dpkg-noforce-unsafe-io*:: Prevent running dpkg with --force-unsafe-io. --force-unsafe-io causes dpkg to skip certain file system syncs known to cause substantial performance degradation on some filesystems. Thus, including this option reverts to safe but slower behavior. +*--no-eatmydata*:: + Prevent use of eatmydata. + *-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 52fc743..cae35ee 100644 --- a/piuparts.py +++ b/piuparts.py @@ -649,7 +649,10 @@ class Chroot: def unpack_from_tgz(self, tarball): """Unpack a tarball to a chroot.""" logging.debug("Unpacking %s into %s" % (tarball, self.name)) - run(["tar", "-C", self.name, "-zxf", tarball]) + prefix = [] + if settings.eatmydata: + prefix.append('eatmydata') + run(prefix + ["tar", "-C", self.name, "-zxf", tarball]) def setup_from_lvm(self, lvm_volume): """Create a chroot by creating an LVM snapshot.""" @@ -664,7 +667,11 @@ class Chroot: run(['mount', self.lvm_snapshot, self.name]) def run(self, command, ignore_errors=False): - return run(["chroot", self.name] + command, + prefix = [] + if settings.eatmydata and os.path.isfile(os.path.join(self.name, + 'usr/bin/eatmydata')): + prefix.append('eatmydata') + return run(["chroot", self.name] + prefix + command, ignore_errors=ignore_errors) def create_apt_sources(self, distro): @@ -732,8 +739,14 @@ class Chroot: (settings.debian_distros[0], self.name)) if settings.do_not_verify_signatures: logging.info("Warning: not using --keyring option when running debootstrap!") - run(["debootstrap", "--variant=minbase", settings.keyringoption, settings.debian_distros[0], - self.name, settings.debian_mirrors[0][0]]) + prefix = [] + options = [settings.keyringoption] + if settings.eatmydata: + options.append('--include=eatmydata') + options.append('--components=%s' % ','.join(settings.debian_mirrors[0][1])) + prefix.append('eatmydata') + run(prefix + ["debootstrap", "--variant=minbase"] + options + + [settings.debian_distros[0], self.name, settings.debian_mirrors[0][0]]) def minimize(self): """Minimize a chroot by removing (almost all) unnecessary packages""" @@ -1961,6 +1974,11 @@ def parse_command_line(): default="-o MaxPriority=required -o UseRecommends=no -f -n apt debfoster", help="Run debfoster with different parameters (default: -o MaxPriority=required -o UseRecommends=no -f -n apt debfoster).") + parser.add_option("--no-eatmydata", + default=False, + action='store_true', + help="Default is to use libeatmydata in the chroot") + parser.add_option("--dpkg-noforce-unsafe-io", default=False, action='store_true', @@ -2160,6 +2178,7 @@ def parse_command_line(): settings.warn_on_others = opts.warn_on_others settings.warn_on_leftovers_after_purge = opts.warn_on_leftovers_after_purge settings.debfoster_options = opts.debfoster_options.split() + settings.eatmydata = not opts.no_eatmydata settings.dpkg_force_unsafe_io = not opts.dpkg_noforce_unsafe_io settings.dpkg_force_confdef = opts.dpkg_force_confdef