[PATCH mock] Allow installation when /dev is mounted read-only

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


On Sat, May 05, 2007 at 08:47:49PM +0200, Enrico Scholz wrote:
> 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.

This one is required IFF previous /dev patch is applied, correct?
Probably should mention that in the description.

Can this be done in .rpmmacros instead?
--
Michael


> 
> 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'):
> 
> --
> Fedora-buildsys-list mailing list
> Fedora-buildsys-list at redhat.com
> https://www.redhat.com/mailman/listinfo/fedora-buildsys-list




More information about the Fedora-buildsys-list mailing list