[Piuparts-commits] rev 172 - in trunk: . debian
Holger Levsen
holger at alioth.debian.org
Sat Nov 8 17:10:29 UTC 2008
Author: holger
Date: 2008-11-08 17:10:29 +0000 (Sat, 08 Nov 2008)
New Revision: 172
Modified:
trunk/debian/changelog
trunk/piuparts.docbook
trunk/piuparts.py
Log:
Added --bindmount option, thanks to An?\195?\173bal Monsalve Salaza for the patch.
(Closes: #496186)
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2008-10-17 10:46:01 UTC (rev 171)
+++ trunk/debian/changelog 2008-11-08 17:10:29 UTC (rev 172)
@@ -1,3 +1,10 @@
+piuparts (0.33) unstable; urgency=low
+
+ * Added --bindmount option, thanks to Aníbal Monsalve Salaza for the patch.
+ (Closes: #496186)
+
+ -- Holger Levsen <holger at debian.org> Sat, 08 Nov 2008 17:07:22 +0000
+
piuparts (0.32) unstable; urgency=low
[ John Wright ]
Modified: trunk/piuparts.docbook
===================================================================
--- trunk/piuparts.docbook 2008-10-17 10:46:01 UTC (rev 171)
+++ trunk/piuparts.docbook 2008-11-08 17:10:29 UTC (rev 172)
@@ -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>--bindmount</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>
Modified: trunk/piuparts.py
===================================================================
--- trunk/piuparts.py 2008-10-17 10:46:01 UTC (rev 171)
+++ trunk/piuparts.py 2008-11-08 17:10:29 UTC (rev 172)
@@ -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):
@@ -820,6 +824,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):
@@ -865,6 +871,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?"""
@@ -1596,6 +1604,7 @@
def forget_ignores(option, opt, value, parser, *args, **kwargs):
+ settings.bindmounts = []
parser.values.ignore = []
parser.values.ignore_regex = []
settings.ignored_files = []
@@ -1628,6 +1637,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 " +
"(etch, lenny, sid) or experimental. The " +
@@ -1738,6 +1751,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
More information about the Piuparts-commits
mailing list