Package: piuparts Severity: important Version: 0.31 Tags: patch Please implement bindmounts so "deb file:<dir>" works.
I'm using the following patch to fix this bug. Please merge it. diff -Nru piuparts-0.31/piuparts.docbook piuparts-0.31/piuparts.docbook --- piuparts-0.31/piuparts.docbook 2008-05-12 06:56:34.000000000 +1000 +++ piuparts-0.31/piuparts.docbook 2008-08-23 17:03:08.000000000 +1000 @@ -57,6 +57,7 @@ <arg><option>-I</option> <replaceable>regexp</replaceable></arg> <arg><option>-l</option> <replaceable>logfile</replaceable></arg> <arg><option>-m</option> <replaceable>url</replaceable></arg> + <arg><option>--bindmount</option> <replaceable>dir</replaceable></arg> <arg><replaceable>package</replaceable></arg> </cmdsynopsis> </refsynopsisdiv> @@ -404,15 +405,26 @@ components are read from the same place.</para> <para>Note that <literal>file:</literal> addresses - do not currently work, since the files aren't - accessible from within the chroot and Lars has been - too lazy to add bind mounting support.</para> + works if the directories are made accessible from within + the chroot with <option>--binmount</option>.</para> </listitem> </varlistentry> <varlistentry> + + <term><option>--bindmount=</option><replaceable>dir</replaceable></term> + + <listitem> + + <para>Bind-mount a directory inside the chroot.</para> + + </listitem> + + </varlistentry> + + <varlistentry> <term><option>-n</option></term> <term><option>--no-ignores</option></term> diff -Nru piuparts-0.31/piuparts.py piuparts-0.31/piuparts.py --- piuparts-0.31/piuparts.py 2008-05-12 05:08:56.000000000 +1000 +++ piuparts-0.31/piuparts.py 2008-08-23 16:41:37.000000000 +1000 @@ -133,6 +133,7 @@ self.args_are_package_files = True self.debian_mirrors = [] self.debian_distros = [] + self.bindmounts = [] self.basetgz = None self.savetgz = None self.endmeta = None @@ -635,6 +636,9 @@ self.create_apt_sources(settings.debian_distros[0]) self.create_apt_conf() self.create_policy_rc_d() + for bindmount in settings.bindmounts: + run(["mkdir", "-p", self.relative(bindmount)]) + run(["mount", "-obind", bindmount, self.relative(bindmount)]) self.run(["apt-get", "update"]) def upgrade_to_distros(self, distros, packages): @@ -817,6 +821,8 @@ return dict def relative(self, pathname): + if pathname.startswith('/'): + return os.path.join(self.name, pathname[1:]) return os.path.join(self.name, pathname) def get_files_owned_by_packages(self): @@ -862,6 +868,8 @@ def unmount_proc(self): """Unmount /proc inside chroot.""" self.run(["umount", "/proc"], ignore_errors=True) + for bindmount in settings.bindmounts: + run(["umount", self.relative(bindmount)], ignore_errors=True) def is_ignored(self, pathname): """Is a file (or dir or whatever) to be ignored?""" @@ -1593,6 +1601,7 @@ def forget_ignores(option, opt, value, parser, *args, **kwargs): + settings.bindmounts = [] parser.values.ignore = [] parser.values.ignore_regex = [] settings.ignored_files = [] @@ -1625,6 +1634,10 @@ parser.add_option("-B", "--end-meta", metavar="FILE", help="XXX") + parser.add_option("--bindmount", action="append", metavar="DIR", + default=[], + help="Directory to be bind-mounted inside the chroot.") + parser.add_option("-d", "--distribution", action="append", metavar="NAME", help="Which Debian distribution to use: a code name " + "(sarge, etch, sid) or experimental. The " + @@ -1735,6 +1748,7 @@ settings.defaults = opts.defaults settings.args_are_package_files = not opts.apt settings.basetgz = opts.basetgz + settings.bindmounts += opts.bindmount settings.debian_distros = opts.distribution settings.ignored_files += opts.ignore settings.ignored_patterns += opts.ignore_regex
signature.asc
Description: Digital signature