[yum-commits] Branch 'yum-3_2_X' - 8 commits - output.py yum/depsolve.py yum/__init__.py yum/misc.py yum/sqlitesack.py yum/transactioninfo.py
James Antill
james at osuosl.org
Fri Jun 11 15:18:02 UTC 2010
output.py | 49 ++++++++++++++++++++++++++++++++-----------------
yum/__init__.py | 23 ++++++++++++++++++++++-
yum/depsolve.py | 9 +++++----
yum/misc.py | 12 +++++++++++-
yum/sqlitesack.py | 14 ++++++++++----
yum/transactioninfo.py | 14 +++++++++++---
6 files changed, 91 insertions(+), 30 deletions(-)
New commits:
commit 0c4d027b73753e94c7928676a54bbe2135940409
Author: James Antill <james at and.org>
Date: Fri Jun 11 10:44:35 2010 -0400
Don't return None when transaction is empty in resolveDeps, BZ 603002
diff --git a/yum/depsolve.py b/yum/depsolve.py
index b661191..3e95626 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -776,10 +776,9 @@ class Depsolve(object):
self.verbose_logger.log(logginglevels.DEBUG_4," --> %s" % err)
return (1, errors)
- if len(self.tsInfo) > 0:
- if not len(self.tsInfo):
- return (0, [_('Success - empty transaction')])
- return (2, [_('Success - deps resolved')])
+ if not len(self.tsInfo):
+ return (0, [_('Success - empty transaction')])
+ return (2, [_('Success - deps resolved')])
def _resolveRequires(self, errors):
any_missing = False
commit 43deeed3f0755d36c30c41c08fd8703d5ffbdcbb
Author: James Antill <james at and.org>
Date: Fri Jun 11 01:18:02 2010 -0400
Add installed_by and changed_by to info -v
diff --git a/output.py b/output.py
index 4e8fbe9..4a1e10e 100755
--- a/output.py
+++ b/output.py
@@ -558,27 +558,41 @@ class YumOutput:
def infoOutput(self, pkg, highlight=False):
(hibeg, hiend) = self._highlight(highlight)
- print _("Name : %s%s%s") % (hibeg, to_unicode(pkg.name), hiend)
- print _("Arch : %s") % to_unicode(pkg.arch)
+ print _("Name : %s%s%s") % (hibeg, to_unicode(pkg.name), hiend)
+ print _("Arch : %s") % to_unicode(pkg.arch)
if pkg.epoch != "0":
- print _("Epoch : %s") % to_unicode(pkg.epoch)
- print _("Version : %s") % to_unicode(pkg.version)
- print _("Release : %s") % to_unicode(pkg.release)
- print _("Size : %s") % self.format_number(float(pkg.size))
- print _("Repo : %s") % to_unicode(pkg.repoid)
+ print _("Epoch : %s") % to_unicode(pkg.epoch)
+ print _("Version : %s") % to_unicode(pkg.version)
+ print _("Release : %s") % to_unicode(pkg.release)
+ print _("Size : %s") % self.format_number(float(pkg.size))
+ print _("Repo : %s") % to_unicode(pkg.repoid)
if pkg.repoid == 'installed' and 'from_repo' in pkg.yumdb_info:
- print _("From repo : %s") % to_unicode(pkg.yumdb_info.from_repo)
+ print _("From repo : %s") % to_unicode(pkg.yumdb_info.from_repo)
if self.verbose_logger.isEnabledFor(logginglevels.DEBUG_3):
- print _("Committer : %s") % to_unicode(pkg.committer)
- print _("Committime : %s") % time.ctime(pkg.committime)
- print _("Buildtime : %s") % time.ctime(pkg.buildtime)
+ print _("Committer : %s") % to_unicode(pkg.committer)
+ print _("Committime : %s") % time.ctime(pkg.committime)
+ print _("Buildtime : %s") % time.ctime(pkg.buildtime)
if hasattr(pkg, 'installtime'):
- print _("Installtime: %s") % time.ctime(pkg.installtime)
- print self.fmtKeyValFill(_("Summary : "), self._enc(pkg.summary))
+ print _("Install time: %s") % time.ctime(pkg.installtime)
+ uid = None
+ if 'installed_by' in pkg.yumdb_info:
+ try:
+ uid = int(pkg.yumdb_info.installed_by)
+ except ValueError: # In case int() fails
+ uid = None
+ print _("Installed by: %s") % self._pwd_ui_username(uid)
+ uid = None
+ if 'changed_by' in pkg.yumdb_info:
+ try:
+ uid = int(pkg.yumdb_info.changed_by)
+ except ValueError: # In case int() fails
+ uid = None
+ print _("Changed by : %s") % self._pwd_ui_username(uid)
+ print self.fmtKeyValFill(_("Summary : "), self._enc(pkg.summary))
if pkg.url:
- print _("URL : %s") % to_unicode(pkg.url)
- print self.fmtKeyValFill(_("License : "), to_unicode(pkg.license))
- print self.fmtKeyValFill(_("Description: "), self._enc(pkg.description))
+ print _("URL : %s") % to_unicode(pkg.url)
+ print self.fmtKeyValFill(_("License : "), to_unicode(pkg.license))
+ print self.fmtKeyValFill(_("Description : "),self._enc(pkg.description))
print ""
def updatesObsoletesList(self, uotup, changetype, columns=None):
commit 6adb022fd54b7232c7d4410313c029f8a3a87313
Author: James Antill <james at and.org>
Date: Fri Jun 11 00:57:47 2010 -0400
Fix typo info=>list
diff --git a/output.py b/output.py
index 05a4e83..4e8fbe9 100755
--- a/output.py
+++ b/output.py
@@ -1333,7 +1333,7 @@ to exit.
tids, printall = self._history_list_transactions(extcmds)
if tids is None:
- return 1, ['Failed history info']
+ return 1, ['Failed history list']
fmt = "%s | %s | %s | %s | %s"
print fmt % (utf8_width_fill(_("ID"), 6, 6),
commit a336b5c283acf275310fc0e5b53e5299dcf044ce
Author: Toshio Kuratomi <toshio at fedoraproject.org>
Date: Thu Jun 10 17:09:36 2010 -0400
Fix for UnicodeWarning when comparing provides, BZ 570819.
diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
index 9accbb1..820f003 100644
--- a/yum/sqlitesack.py
+++ b/yum/sqlitesack.py
@@ -1324,8 +1324,14 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
(n,f,(e,v,r)) = misc.string_to_prco_tuple(name)
except Errors.MiscError, e:
raise Errors.PackageSackError, to_unicode(e)
-
- n = to_unicode(n)
+
+ # The _b means this is a byte string
+ # The _u means this is a unicode string
+ # A bare n is used when, it's unicode but hasn't been evaluated
+ # whether that's actually the right thing to do
+ n_b = n
+ n_u = to_unicode(n)
+ n = n_u
glob = True
querytype = 'glob'
@@ -1346,9 +1352,9 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
# file dep add all matches to the results
results.append(po)
continue
-
+
if not glob:
- if po.checkPrco(prcotype, (n, f, (e,v,r))):
+ if po.checkPrco(prcotype, (n_b, f, (e,v,r))):
results.append(po)
else:
# if it is a glob we can't really get any closer to checking it
commit 385390f028af11de7af7fec336014b1c83709710
Author: James Antill <james at and.org>
Date: Thu Jun 10 16:47:23 2010 -0400
Add a dsCallback "r" state for reinstalled, as we are doing downgrade
diff --git a/output.py b/output.py
index 060eaab..05a4e83 100755
--- a/output.py
+++ b/output.py
@@ -1706,6 +1706,7 @@ class DepSolveProgressCallBack:
'u': _('updated'),
'o': _('obsoleted'),
'e': _('erased'),
+ 'r': _('reinstalled'),
'd': _('downgraded')}
(n, a, e, v, r) = pkgtup
modeterm = modedict[mode]
diff --git a/yum/depsolve.py b/yum/depsolve.py
index c197b7f..b661191 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -794,6 +794,8 @@ class Depsolve(object):
dscb_ts_state = txmbr.ts_state
if txmbr.downgrades:
dscb_ts_state = 'd'
+ if dscb_ts_state == 'u' and txmbr.reinstall:
+ dscb_ts_state = 'r'
if dscb_ts_state == 'u' and not txmbr.updates:
dscb_ts_state = 'i'
self.dsCallback.pkgAdded(txmbr.pkgtup, dscb_ts_state)
commit 4b78fffbd9017b9606bfc476f4f30769813fcc90
Author: James Antill <james at and.org>
Date: Thu Jun 10 16:46:17 2010 -0400
Make .reinstall a real txmbr attribute
diff --git a/yum/__init__.py b/yum/__init__.py
index 8e58124..1d7637f 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1424,8 +1424,7 @@ class YumBase(depsolve.Depsolve):
if loginuid is None:
continue
loginuid = str(loginuid)
- if (txmbr.updates or txmbr.downgrades or
- (hasattr(txmbr, 'reinstall') and txmbr.reinstall)):
+ if txmbr.updates or txmbr.downgrades or txmbr.reinstall:
if txmbr.updates:
opo = txmbr.updates[0]
elif txmbr.downgrades:
diff --git a/yum/transactioninfo.py b/yum/transactioninfo.py
index d574b80..b8e4564 100644
--- a/yum/transactioninfo.py
+++ b/yum/transactioninfo.py
@@ -349,8 +349,7 @@ class TransactionData:
self.updated.append(txmbr)
elif txmbr.output_state in (TS_INSTALL, TS_TRUEINSTALL):
- if include_reinstall and self.rpmdb.contains(po=txmbr.po):
- txmbr.reinstall = True
+ if include_reinstall and txmbr.reinstall:
self.reinstalled.append(txmbr)
continue
@@ -416,6 +415,10 @@ class TransactionData:
txmbr.po.state = TS_INSTALL
txmbr.ts_state = 'u'
txmbr.reason = 'user'
+
+ if self.rpmdb.contains(po=txmbr.po):
+ txmbr.reinstall = True
+
self.add(txmbr)
return txmbr
@@ -506,6 +509,10 @@ class TransactionData:
txmbr.ts_state = 'u'
txmbr.relatedto.append((oldpo, 'obsoletes'))
txmbr.obsoletes.append(oldpo)
+
+ if self.rpmdb.contains(po=txmbr.po):
+ txmbr.reinstall = True
+
self.add(txmbr)
return txmbr
@@ -607,7 +614,7 @@ class TransactionData:
for txmbr in self.getMembersWithState(None, TS_INSTALL_STATES):
# reinstalls have to use their "new" checksum data, in case it's
# different.
- if hasattr(txmbr, 'reinstall') and txmbr.reinstall:
+ if txmbr.reinstall:
_reinstalled_pkgtups[txmbr.po.pkgtup] = txmbr.po
pkgs.append(txmbr.po)
@@ -720,6 +727,7 @@ class TransactionMember:
self.updated_by = []
self.downgrades = []
self.downgraded_by = []
+ self.reinstall = False
self.groups = [] # groups it's in
self._poattr = ['pkgtup', 'repoid', 'name', 'arch', 'epoch', 'version',
'release']
commit d57bdd6ba7f3f47cb88733615ad6a89344423964
Author: James Antill <james at and.org>
Date: Thu Jun 10 16:37:39 2010 -0400
Save loginuids of installed_by and changed_by to the yumdb
diff --git a/yum/__init__.py b/yum/__init__.py
index fa26e62..8e58124 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1419,7 +1419,29 @@ class YumBase(depsolve.Depsolve):
po.yumdb_info.from_repo_revision = str(md.revision)
if md:
po.yumdb_info.from_repo_timestamp = str(md.timestamp)
-
+
+ loginuid = misc.getloginuid()
+ if loginuid is None:
+ continue
+ loginuid = str(loginuid)
+ if (txmbr.updates or txmbr.downgrades or
+ (hasattr(txmbr, 'reinstall') and txmbr.reinstall)):
+ if txmbr.updates:
+ opo = txmbr.updates[0]
+ elif txmbr.downgrades:
+ opo = txmbr.downgrades[0]
+ else:
+ opo = po
+ if 'installed_by' in opo.yumdb_info:
+ po.yumdb_info.installed_by = opo.yumdb_info.installed_by
+ po.yumdb_info.changed_by = loginuid
+ else:
+ po.yumdb_info.installed_by = loginuid
+
+ # Remove old ones after installing new ones, so we can copy values.
+ for txmbr in self.tsInfo:
+ if txmbr.output_state in TS_INSTALL_STATES:
+ pass
elif txmbr.output_state in TS_REMOVE_STATES:
if self.rpmdb.contains(po=txmbr.po):
if not self.tsInfo.getMembersWithState(pkgtup=txmbr.pkgtup,
commit 55d5b5bf45e296a911a7a09a11760aae71ea4be3
Author: James Antill <james at and.org>
Date: Thu Jun 10 16:36:59 2010 -0400
Add caching getloginuid, so we can use it outside of history
diff --git a/yum/misc.py b/yum/misc.py
index 921b95c..35b8056 100644
--- a/yum/misc.py
+++ b/yum/misc.py
@@ -899,7 +899,7 @@ def unlink_f(filename):
if e.errno != errno.ENOENT:
raise
-def getloginuid():
+def _getloginuid():
""" Get the audit-uid/login-uid, if available. None is returned if there
was a problem. Note that no caching is done here. """
# We might normally call audit.audit_getloginuid(), except that requires
@@ -914,6 +914,16 @@ def getloginuid():
except ValueError:
return None
+_cached_getloginuid = None
+def getloginuid():
+ """ Get the audit-uid/login-uid, if available. None is returned if there
+ was a problem. The value is cached, so you don't have to save it. """
+ global _cached_getloginuid
+ if _cached_getloginuid is None:
+ _cached_getloginuid = _getloginuid()
+ return _cached_getloginuid
+
+
# ---------- i18n ----------
import locale
import sys
More information about the Yum-commits
mailing list