[PATCH mock] Allow installation when /dev is mounted read-only
Enrico Scholz
enrico.scholz at informatik.tu-chemnitz.de
Sat May 5 18:47:49 UTC 2007
This patch bind-mounts a custom /etc/rpm directory to set the
%_netsharedpath macro before doing the 'yum install' operation.
Else, installation of filesystem package will fail due to a cpio error.
Signed-off-by: Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
---
mock.py | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/mock.py b/mock.py
index 3762324..6061907 100644
--- a/mock.py
+++ b/mock.py
@@ -500,6 +500,7 @@ class Root:
# mount /dev
if self.config.get('dev-template'):
self._mount('none --bind -o ro', self.config['dev-template'], 'dev')
+ self._mount('none --bind', os.path.join(self.statedir, 'rpm'), '/etc/rpm')
# mount /dev/pts
self._mount('devpts', 'dev/pts', 'dev/pts')
@@ -698,7 +699,15 @@ class Root:
ret = rpmUtils.miscutils.unique(reqlist)
self.drop()
return ret
-
+
+ def __create_rpm_macros_for_install(self):
+ p = os.path.join(self.statedir, 'rpm')
+ fname = os.path.join(p, 'macros')
+ if not os.path.exists(fname):
+ self._ensure_dir(p)
+ f = open(fname, 'w')
+ f.write(self._expand_macro_string({'%_netsharedpath' : '/dev'}))
+
def _prep_install(self):
"""prep chroot for installation"""
# make chroot dir
@@ -715,6 +724,7 @@ class Root:
os.path.join(self.rootdir, 'etc/yum.repos.d')]:
self._ensure_dir(item)
+ self.__create_rpm_macros_for_install()
self._mountall()
if not self.config.get('dev-template'):
More information about the Fedora-buildsys-list
mailing list