[PATCH mock] bind-mount the /var/lib/rpm from the chroot into the root directory

Enrico Scholz enrico.scholz at informatik.tu-chemnitz.de
Sat May 5 18:56:17 UTC 2007


This patch should not be needed when rpm would work properly... There was
already a try to fix this but setting '%_rpmlock_path'. But this never
worked because these macros will not be evaluated at 'yum install' time.

Last hunk requires the "Enhancements of the config_opts['macros'] handling"
patch.

Signed-off-by: Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
---

 mock.py |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/mock.py b/mock.py
index 6061907..df05920 100644
--- a/mock.py
+++ b/mock.py
@@ -502,6 +502,9 @@ class Root:
             self._mount('none --bind -o ro', self.config['dev-template'], 'dev')
             self._mount('none --bind',       os.path.join(self.statedir, 'rpm'), '/etc/rpm')
 
+        # provide our view of /var/lib/rpm
+        self._mount('none --bind',           os.path.join(self.rootdir, 'var/lib/rpm'), '/var/lib/rpm')
+        
         # mount /dev/pts
         self._mount('devpts', 'dev/pts', 'dev/pts')
 
@@ -834,14 +837,7 @@ class Root:
         macrofile_out = '%s%s/.rpmmacros' % (self.rootdir, self.homedir)
         if not os.path.exists(macrofile_out):
             rpmmacros = open(macrofile_out, 'w')
-
             rpmmacros.write(self._expand_macro_string(self.config['macros']))
-            rpmmacros.write(self._expand_macro_string(
-                {"%_rpmlock_path" : "%s/var/lib/rpm/__db.000" % self.basedir}
-                ))
-
-            rpmmacros.close()
-        
     
     def _prep_build(self):
         """prep the chroot for building packages"""




More information about the buildsys mailing list