On Tue, 2011-06-28 at 15:17 -0400, James Antill wrote:
> The only downside here appears to be that we get .sqlite-journal files
> in /var/lib/yum/history ... which is probably fine.
> ---
>  yum/history.py  |    6 +++++-
>  yum/rpmtrans.py |    5 +++--
>  2 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/yum/history.py b/yum/history.py
> index 26d6ee2..e40c2b0 100644
> --- a/yum/history.py
> +++ b/yum/history.py
> @@ -627,6 +627,8 @@ class YumHistory:
>                  self.conf.readable = False
>                  return None
>  
> +            executeSQL(self._conn.cursor(), "pragma locking_mode = 
> EXCLUSIVE")
> +
>          return self._conn.cursor()
>      def _commit(self):
>          return self._conn.commit()
> @@ -747,7 +749,6 @@ class YumHistory:
>                           WHERE tid = ? AND pkgtupid = ? AND state = ?
>                           """, ('TRUE', self._tid, pid, state))
>          self._commit()
> -        return cur.lastrowid
>  
>      def _trans_rpmdb_problem(self, problem):
>          if not hasattr(self, '_tid'):
> @@ -1310,6 +1311,9 @@ class YumHistory:
>                                      'sqlite')
>          if self._db_file == _db_file:
>              os.rename(_db_file, _db_file + '.old')
> +            # Just in case ... move the journal file too.
> +            if os.path.exists(_db_file + '-journal'):
> +                os.rename(_db_file  + '-journal', _db_file + '-journal.old')
>          self._db_file = _db_file
>          
>          if self.conf.writable and not os.path.exists(self._db_file):
> diff --git a/yum/rpmtrans.py b/yum/rpmtrans.py
> index 6e31512..9b265f9 100644
> --- a/yum/rpmtrans.py
> +++ b/yum/rpmtrans.py
> @@ -554,12 +554,13 @@ class RPMTransaction:
>              #  Note that we are currently inside the chroot, which makes
>              # sqlite panic when it tries to open it's journal file.
>              # So let's have some "fun" and workaround that:
> -            if self.base.conf.installroot != '/':
> +            _do_chroot = False
> +            if _do_chroot and self.base.conf.installroot != '/':
>                  os.chroot(".")
>              pid   = self.base.history.pkg2pid(txmbr.po)
>              state = self.base.history.txmbr2state(txmbr)
>              self.base.history.trans_data_pid_end(pid, state)
> -            if self.base.conf.installroot != '/':
> +            if _do_chroot and self.base.conf.installroot != '/':
>                  os.chroot(self.base.conf.installroot)
>  
>              self.ts_done(txmbr.po, txmbr.output_state)


I suspect we're just begging for problems but why not?

ACK - put it in and let's see how/if mock breaks.

-sv


_______________________________________________
Yum-devel mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to