[yum-commits] Branch 'yum-3_2_X' - 9 commits - ChangeLog cli.py output.py yum/history.py yum/__init__.py yummain.py yum/rpmtrans.py

James Antill james at osuosl.org
Tue Jun 28 20:25:24 UTC 2011


 ChangeLog       |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 cli.py          |    4 +++-
 output.py       |   12 ++++++------
 yum/__init__.py |    6 ++++--
 yum/history.py  |   12 +++++++++++-
 yum/rpmtrans.py |    9 +++++++++
 yummain.py      |   11 +++++++++++
 7 files changed, 99 insertions(+), 10 deletions(-)

New commits:
commit cf8a5669165e958d56157abf40d0cdd552c8fbf9
Author: James Antill <james at and.org>
Date:   Tue Jun 28 16:25:00 2011 -0400

     Update ChangeLog from git.

diff --git a/ChangeLog b/ChangeLog
index 3ca62dd..df2a802 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,58 @@
+2011-06-28  James Antill <james at and.org>
+
+	* yum/__init__.py: Bump version to 3.4.3
+
+2011-06-28  James Antill <james at and.org>
+
+	* yum/__init__.py:  Don't call repo.doSetup() if we've already setup the repos. BZ
+	 717163.   Test: yum in @core == has    setup.        yum rm @core
+	 == hasn't setup.
+
+2011-06-28  James Antill <james at and.org>
+
+	* yum/history.py, yum/rpmtrans.py:  Disable the rpmtrans chroot workaround. Use exclusive locking in
+	 history.   The only downside here appears to be that we get
+	 .sqlite-journal files in /var/lib/yum/history ... which is probably
+	 fine.  Also tested fine as a normal user, with read-only access.
+
+2011-06-27  James Antill <james at and.org>
+
+	* yummain.py: Change the logging for NFS path problems from debug to
+	critical.
+
+2011-06-24  Nick Jacek <njacek at redhat.com>
+
+	* yummain.py: Checks if we have read and write access in the current
+	directory. If not, chdir to /. BZ 698795
+
+2011-06-23  Zdeněk Pavlas <zpavlas at redhat.com>
+
+	* output.py: Make the source xgettext-friendly.  xgettext ignores
+	_(var), so localize literals instead.
+
+2011-06-23  James Antill <james at and.org>
+
+	* cli.py: Don't show -c warning, when we've changed it due to
+	--installroot. BZ 707358.
+
+2011-06-22  James Antill <james at and.org>
+
+	* yum/rpmtrans.py:  Workaround rpm chroot insanity, so we can use sqlite from
+	 unInstStop() cb.   So the problem is that AGAIN, when we log stuff
+	 for installed rpms we do it in _instCloseFile, which is outside the
+	 chroot ... but when we log stuff for erase rpms we do it in
+	 _unInstStop, which is inside the chroot.  sqlite will open it's
+	 journal file, which is it has a working path for from outside the
+	 chroot ... being inside the chroot breaks this, which results in
+	 complete failure of everything.   Fix is to move out of the chroot,
+	 before we call the history/sqlite APIs, and then move back in again
+	 ... basically what rpm does.
+
+2011-06-22  James Antill <james at and.org>
+
+	* ChangeLog, yum.spec, yum/__init__.py: Update ChangeLog/version for
+	3.4.2 release.
+
 2011-06-22  Zdeněk Pavlas <zpavlas at redhat.com>
 
 	* output.py: Clean up the 'Transaction summary' report.
commit 02a6d7ad9752e67812460a67400826313bbc5326
Author: James Antill <james at and.org>
Date:   Tue Jun 28 16:18:08 2011 -0400

    Bump version to 3.4.3

diff --git a/yum/__init__.py b/yum/__init__.py
index 2dce3bf..99039e0 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -91,7 +91,7 @@ from weakref import proxy as weakref
 
 from urlgrabber.grabber import default_grabber
 
-__version__ = '3.4.2'
+__version__ = '3.4.3'
 __version_info__ = tuple([ int(num) for num in __version__.split('.')])
 
 #  Setup a default_grabber UA here that says we are yum, done using the global
commit 83b1afba634f361fefc7d9eef53133c501e58aeb
Author: James Antill <james at and.org>
Date:   Tue Jun 28 15:59:22 2011 -0400

     Don't call repo.doSetup() if we've already setup the repos. BZ 717163.
    
     Test: yum in @core == has    setup.
           yum rm @core == hasn't setup.

diff --git a/yum/__init__.py b/yum/__init__.py
index 92f25d4..2dce3bf 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -792,7 +792,9 @@ class YumBase(depsolve.Depsolve):
         self.verbose_logger.log(logginglevels.DEBUG_4,
                                 _('Getting group metadata'))
         reposWithGroups = []
-        self.repos.doSetup()
+        #  Need to make sure the groups data is ready to read. Really we'd want
+        # to add groups to the mdpolicy list of the repo. but we don't atm.
+        self.pkgSack
         for repo in self.repos.listGroupsEnabled():
             if repo.groups_added: # already added the groups from this repo
                 reposWithGroups.append(repo)
commit 1a193447dc63f0bac4bbd572e034f369445e1cf1
Author: James Antill <james at and.org>
Date:   Tue Jun 28 15:13:12 2011 -0400

     Disable the rpmtrans chroot workaround. Use exclusive locking in history.
    
     The only downside here appears to be that we get .sqlite-journal files
    in /var/lib/yum/history ... which is probably fine.
     Also tested fine as a normal user, with read-only access.

diff --git a/yum/history.py b/yum/history.py
index 26d6ee2..5385bd1 100644
--- a/yum/history.py
+++ b/yum/history.py
@@ -627,6 +627,14 @@ class YumHistory:
                 self.conf.readable = False
                 return None
 
+            #  Note that this is required due to changing the history DB in the
+            # callback for removed txmbrs ... which happens inside the chroot,
+            # as against all our other access which is outside the chroot. So
+            # we need sqlite to not open the journal.
+            #  In theory this sucks, as history could be shared. In reality
+            # it's deep yum stuff and there should only be one yum.
+            executeSQL(self._conn.cursor(), "PRAGMA locking_mode = EXCLUSIVE")
+
         return self._conn.cursor()
     def _commit(self):
         return self._conn.commit()
@@ -747,7 +755,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 +1317,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)
commit 4311cccb7303048efea8b39c91fdd0bfd9b3bae7
Author: James Antill <james at and.org>
Date:   Mon Jun 27 10:23:44 2011 -0400

    Change the logging for NFS path problems from debug to critical.

diff --git a/yummain.py b/yummain.py
index d88ecfd..9f79f4f 100755
--- a/yummain.py
+++ b/yummain.py
@@ -107,7 +107,7 @@ def main(args):
         f = open(".")
     except IOError, e:
         if e.errno == errno.EACCES:
-            verbose_logger.debug(_('No read/write access in current directory, moving to /'))
+            logger.critical(_('No read/write access in current directory, moving to /'))
             os.chdir("/")
     else:
         close(f)
commit d54a93855018030d98286c8eff8526f83cde5b97
Author: Nick Jacek <njacek at redhat.com>
Date:   Fri Jun 24 16:58:06 2011 -0400

    Checks if we have read and write access in the current directory. If not, chdir to /. BZ 698795

diff --git a/yummain.py b/yummain.py
index e3efd10..d88ecfd 100755
--- a/yummain.py
+++ b/yummain.py
@@ -101,6 +101,17 @@ def main(args):
     except Errors.YumBaseError, e:
         return exFatal(e)
 
+    # Try to open the current directory to see if we have 
+    # read and write access. If not, chdir to /
+    try:
+        f = open(".")
+    except IOError, e:
+        if e.errno == errno.EACCES:
+            verbose_logger.debug(_('No read/write access in current directory, moving to /'))
+            os.chdir("/")
+    else:
+        close(f)
+
     lockerr = ""
     while True:
         try:
commit b61c0582bb046a7f00f8862f9665eade05f90884
Author: Zdeněk Pavlas <zpavlas at redhat.com>
Date:   Thu Jun 23 12:25:56 2011 +0200

    Make the source xgettext-friendly.
    
    xgettext ignores _(var), so localize literals instead.

diff --git a/output.py b/output.py
index c146abf..b6aa277 100755
--- a/output.py
+++ b/output.py
@@ -1103,14 +1103,14 @@ Transaction Summary
 %s
 """) % ('=' * self.term.columns))
         for action, count in (
-            ('Install', len(self.tsInfo.installed) + len(self.tsInfo.depinstalled)),
-            ('Upgrade', len(self.tsInfo.updated) + len(self.tsInfo.depupdated)),
-            ('Remove', len(self.tsInfo.removed) + len(self.tsInfo.depremoved)),
-            ('Reinstall', len(self.tsInfo.reinstalled)),
-            ('Downgrade', len(self.tsInfo.downgraded)),
+            (_('Install'), len(self.tsInfo.installed) + len(self.tsInfo.depinstalled)),
+            (_('Upgrade'), len(self.tsInfo.updated) + len(self.tsInfo.depupdated)),
+            (_('Remove'), len(self.tsInfo.removed) + len(self.tsInfo.depremoved)),
+            (_('Reinstall'), len(self.tsInfo.reinstalled)),
+            (_('Downgrade'), len(self.tsInfo.downgraded)),
         ):
             if count: out.append('%-9s %5d %s\n' % (
-                _(action), count, P_('Package', 'Packages', count),
+                action, count, P_('Package', 'Packages', count),
             ))
         return ''.join(out)
         
commit b4e12dec606dc19fa1ce2ba4be39e26e6145cacf
Author: James Antill <james at and.org>
Date:   Thu Jun 23 13:28:23 2011 -0400

    Don't show -c warning, when we've changed it due to --installroot. BZ 707358.

diff --git a/cli.py b/cli.py
index 82f286f..6056d38 100644
--- a/cli.py
+++ b/cli.py
@@ -264,7 +264,9 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
             opts.debuglevel = opts.errorlevel = 6
         if opts.debuglevel != pc.debuglevel or opts.errorlevel != pc.errorlevel:
             self.logger.warning("Ignored option -q, -v, -d or -e (probably due to merging: -yq != -y -q)")
-        if opts.conffile != pc.fn:
+        #  getRoot() changes it, but then setupYumConfig() changes it back. So
+        # don't test for this, if we are using --installroot.
+        if root == '/' and opts.conffile != pc.fn:
             self.logger.warning("Ignored option -c (probably due to merging -yc != -y -c)")
 
         if opts.version:
commit 6b03eccd86640cdd9e0109ba9c655f80be58fbc2
Author: James Antill <james at and.org>
Date:   Wed Jun 22 18:37:46 2011 -0400

     Workaround rpm chroot insanity, so we can use sqlite from unInstStop() cb.
    
     So the problem is that AGAIN, when we log stuff for installed rpms we
    do it in _instCloseFile, which is outside the chroot ... but when we log
    stuff for erase rpms we do it in _unInstStop, which is inside the
    chroot.
     sqlite will open it's journal file, which is it has a working path for
    from outside the chroot ... being inside the chroot breaks this, which
    results in complete failure of everything.
    
     Fix is to move out of the chroot, before we call the history/sqlite APIs, and
    then move back in again ... basically what rpm does.

diff --git a/yum/rpmtrans.py b/yum/rpmtrans.py
index 400d729..6e31512 100644
--- a/yum/rpmtrans.py
+++ b/yum/rpmtrans.py
@@ -551,9 +551,17 @@ class RPMTransaction:
         if txmbr is not None:
             self._scriptout(txmbr.po)
 
+            #  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 != '/':
+                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 != '/':
+                os.chroot(self.base.conf.installroot)
+
             self.ts_done(txmbr.po, txmbr.output_state)
         else:
             self._scriptout(name)


More information about the Yum-commits mailing list