Skip to content

Commit

Permalink
Move yum-specific ts.check() wrapper back to YumBase private function
Browse files Browse the repository at this point in the history
This essentially reverts commit c54c908
which inapproppriately dragged yum imports into rpmUtils space, causing
recursive imports and breakage for other users.
  • Loading branch information
pmatila committed Feb 21, 2011
1 parent 6f843ab commit 77edf20
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ def doTransaction(self):
rcd_st = time.time()
self.verbose_logger.log(yum.logginglevels.INFO_2,
_('Running Transaction Check'))
msgs = self.ts.check()
msgs = self._run_rpm_check()
if msgs:
rpmlib_only = True
for msg in msgs:
Expand Down
15 changes: 2 additions & 13 deletions rpmUtils/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import rpm
import miscutils
from yum.i18n import to_str

read_ts = None
ts = None
Expand All @@ -23,7 +22,8 @@
class TransactionWrapper:
def __init__(self, root='/'):
self.ts = rpm.TransactionSet(root)
self._methods = ['order',
self._methods = ['check',
'order',
'addErase',
'addInstall',
'run',
Expand All @@ -49,17 +49,6 @@ def close(self):
self.ts = None
self.open = False

def check(self):
results = []
self.ts.check()
for prob in self.ts.problems():
# Newer rpm (4.8.0+) has problem objects, older have just strings.
# Should probably move to using the new objects, when we can. For
# now just be compatible.
results.append(to_str(prob))

return results

def dbMatch(self, *args, **kwds):
if 'patterns' in kwds:
patterns = kwds.pop('patterns')
Expand Down
13 changes: 12 additions & 1 deletion yum/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4821,7 +4821,7 @@ def _doTestTransaction(self,callback,display=None):
# This can be overloaded by a subclass.
self.verbose_logger.log(logginglevels.INFO_2,
_('Running Transaction Check'))
msgs = self.ts.check()
msgs = self._run_rpm_check()
if msgs:
rpmlib_only = True
for msg in msgs:
Expand Down Expand Up @@ -4874,6 +4874,17 @@ def _doTransaction(self,callback,display=None):
cb.display = display
self.runTransaction( cb=cb )

def _run_rpm_check(self):
results = []
self.ts.check()
for prob in self.ts.problems():
# Newer rpm (4.8.0+) has problem objects, older have just strings.
# Should probably move to using the new objects, when we can. For
# now just be compatible.
results.append(to_str(prob))

return results

def add_enable_repo(self, repoid, baseurls=[], mirrorlist=None, **kwargs):
"""add and enable a repo with just a baseurl/mirrorlist and repoid
requires repoid and at least one of baseurl and mirrorlist
Expand Down

0 comments on commit 77edf20

Please sign in to comment.