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

Michael E Brown Michael_E_Brown at dell.com
Mon May 7 17:36:47 UTC 2007


On Sat, May 05, 2007 at 08:56:17PM +0200, Enrico Scholz wrote:
> 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')

Is this the best way to fix this? What are the other options? (open question...)

> +        
>          # 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()

You just removed the close() on the macros file. This was probably not
intended.

--
Michael




More information about the Fedora-buildsys-list mailing list