[yum-commits] docs/yum-changelog.conf.5 plugins/changelog yum-utils.spec
James Antill
james at osuosl.org
Mon Mar 30 17:57:21 UTC 2009
docs/yum-changelog.conf.5 | 20 ++++++++++
plugins/changelog/changelog.py | 75 ++++++++++++++++++++++++++++++-----------
yum-utils.spec | 3 +
3 files changed, 77 insertions(+), 21 deletions(-)
New commits:
commit 9c9d88c26265520315af17570904d14e2b53d6b9
Author: James Antill <james at and.org>
Date: Mon Mar 30 13:56:33 2009 -0400
Allow changelog data to show updateinfo data too
diff --git a/docs/yum-changelog.conf.5 b/docs/yum-changelog.conf.5
index f666f7b..5786749 100644
--- a/docs/yum-changelog.conf.5
+++ b/docs/yum-changelog.conf.5
@@ -40,9 +40,27 @@ the yum updates.
This option reflects specifies if the changelog should always be shown.
.SH VALUE
.IP true
-The changelog is always displayed
+The changelog is always displayed.
.IP false
A command line option is required for the changelog to be displayed.
+.SH OPTION
+.IP updateinfo
+This option specifies that the "changelog" from the repo. updateinfo should be
+shown.
+.SH VALUE
+.IP true
+The updateinfo is displayed.
+.IP false
+The updateinfo is never displayed.
+.SH OPTION
+.IP updateinfo_always
+This option reflects specifies if the "changelog" from the repo. should always
+be shown (note that if updateinfo is false then this option has no meaning).
+.SH VALUE
+.IP true
+The updateinfo is always displayed.
+.IP false
+A command line option is required for the updateinfo to be displayed.
.SH AUTHOR
.RS
Chitlesh Goorah <chitlesh at fedoraproject.org>
diff --git a/plugins/changelog/changelog.py b/plugins/changelog/changelog.py
index 7c69df8..fd28f95 100644
--- a/plugins/changelog/changelog.py
+++ b/plugins/changelog/changelog.py
@@ -29,6 +29,8 @@ import logging
from yum.i18n import to_unicode
+from yum.update_md import UpdateMetadata
+
try:
import dateutil.parser as dateutil_parser
except ImportError:
@@ -38,6 +40,9 @@ plugin_type = (TYPE_INTERACTIVE,)
origpkgs = {}
changelog = False
+orignots = set()
+also_updateinfo = False
+updateinfo = False
def changelog_delta(pkg, olddate):
out = []
@@ -50,21 +55,7 @@ def srpmname(pkg):
n,v,r,e,a = splitFilename(pkg.returnSimple('sourcerpm'))
return n
-def show_changes(conduit, msg):
- # Group by src.rpm name, not binary to avoid showing duplicate changelogs
- # for subpackages
- srpms = {}
- ts = conduit.getTsInfo()
- for tsmem in ts.getMembers():
- if not tsmem.updates:
- continue
- name = srpmname(tsmem.po)
- if srpms.has_key(name):
- srpms[name].append(tsmem.po)
- else:
- srpms[name] = [tsmem.po]
-
- conduit.info(2, "\n%s\n" % msg)
+def _show_changes_changelog(conduit, srpms):
for name in sorted(srpms.keys()):
rpms = []
if origpkgs.has_key(name):
@@ -81,6 +72,30 @@ def show_changes(conduit, msg):
if not done:
conduit.info(2, "%s\n" % kvf("** No ChangeLog for: ",rpm_names))
+def _show_changes_updateinfo(conduit):
+ for note in sorted(orignots):
+ conduit.info(2, note)
+
+def show_changes(conduit, msg):
+ # Group by src.rpm name, not binary to avoid showing duplicate changelogs
+ # for subpackages
+ srpms = {}
+ ts = conduit.getTsInfo()
+ for tsmem in ts.getMembers():
+ if not tsmem.updates:
+ continue
+ name = srpmname(tsmem.po)
+ if srpms.has_key(name):
+ srpms[name].append(tsmem.po)
+ else:
+ srpms[name] = [tsmem.po]
+
+ conduit.info(2, "\n%s\n" % msg)
+ if changelog:
+ _show_changes_changelog(conduit, srpms)
+ if updateinfo:
+ _show_changes_updateinfo(conduit)
+
class ChangeLogCommand:
def getNames(self):
@@ -222,25 +237,44 @@ def config_hook(conduit):
if conduit.confBool('main', 'always', default=False):
global changelog
changelog = True
+ if conduit.confBool('main', 'updateinfo', default=True):
+ global also_updateinfo
+ also_updateinfo = True
+ if (also_updateinfo and
+ conduit.confBool('main', 'updateinfo_always', default=changelog)):
+ global updateinfo
+ updateinfo = True
+ if changelog and (not also_updateinfo or updateinfo):
return
parser.add_option('--changelog', action='store_true',
help='Show changelog delta of updated packages')
def _setup_changelog_from_cmdline(conduit):
global changelog
+ global updateinfo
opts, args = conduit.getCmdLine()
- if not changelog and opts:
- changelog = opts.changelog
+ if opts:
+ if not changelog:
+ changelog = opts.changelog
+ if not updateinfo:
+ updateinfo = opts.changelog
def postresolve_hook(conduit):
_setup_changelog_from_cmdline(conduit)
- if not changelog or conduit.resultcode == 1:
+ if not (changelog or updateinfo) or conduit.resultcode == 1:
return
# Find currently installed versions of packages we're about to update
ts = conduit.getTsInfo()
rpmdb = conduit.getRpmDB()
+ if updateinfo:
+ repos = set()
+ for tsmem in ts.getMembers():
+ if tsmem.po.repoid == 'installed':
+ continue
+ repos.add(tsmem.po.repo)
+ mdi = UpdateMetadata(repos=list(repos))
for tsmem in ts.getMembers():
for po in rpmdb.searchNevra(name=tsmem.po.name, arch=tsmem.po.arch):
hdr = po.hdr
@@ -251,12 +285,15 @@ def postresolve_hook(conduit):
origpkgs[n] = 0
else:
origpkgs[n] = times[0]
+ if updateinfo:
+ for (pkgtup, notice) in mdi.get_applicable_notices(po.pkgtup):
+ orignots.add(notice)
if conduit.confString('main', 'when', default='post') == 'pre':
show_changes(conduit, 'Changes in packages about to be updated:')
def posttrans_hook(conduit):
- if not changelog:
+ if not (changelog or updateinfo):
return
if conduit.confString('main', 'when', default='post') == "post":
diff --git a/yum-utils.spec b/yum-utils.spec
index 2d737c6..dab35a3 100644
--- a/yum-utils.spec
+++ b/yum-utils.spec
@@ -8,7 +8,8 @@ Source: http://yum.baseurl.org/download/yum-utils/%{name}-%{version}.tar.gz
URL: http://yum.baseurl.org/download/yum-utils/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
-Requires: python >= 2.4 , yum >= 3.2.22
+# changelog requires new update_md.UpdateMetadata() API in 3.2.23
+Requires: python >= 2.4 , yum >= 3.2.23
%description
yum-utils is a collection of utilities and examples for the yum package
More information about the Yum-commits
mailing list