[yum-commits] plugins/show-leaves yum-utils.spec
skvidal at osuosl.org
skvidal at osuosl.org
Mon May 18 19:23:06 UTC 2009
plugins/show-leaves/show-leaves.conf | 3 +
plugins/show-leaves/show-leaves.py | 55 +++++++++++++++++++++++++++++++++++
yum-utils.spec | 19 ++++++++++++
3 files changed, 77 insertions(+)
New commits:
commit 0bf076cc1867b9e73581612408f725332d907144
Author: Seth Vidal <skvidal at fedoraproject.org>
Date: Mon May 18 15:21:20 2009 -0400
add show-leaves plugin from Ville Skyttä
diff --git a/plugins/show-leaves/show-leaves.conf b/plugins/show-leaves/show-leaves.conf
new file mode 100644
index 0000000..37d52e2
--- /dev/null
+++ b/plugins/show-leaves/show-leaves.conf
@@ -0,0 +1,3 @@
+[main]
+enabled=1
+
diff --git a/plugins/show-leaves/show-leaves.py b/plugins/show-leaves/show-leaves.py
new file mode 100644
index 0000000..386c247
--- /dev/null
+++ b/plugins/show-leaves/show-leaves.py
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2009 Ville Skyttä <ville.skytta at iki.fi>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+"""
+B{show-leaves} is a Yum plugin which shows newly installed leaf packages and
+packages that became leaves after a transaction.
+"""
+
+from yum.plugins import TYPE_INTERACTIVE
+
+requires_api_version = '2.4'
+plugin_type = (TYPE_INTERACTIVE,)
+
+_old_leaves = None
+_new_leaves = None
+
+def _get_installed_leaves(conduit):
+ ret = set()
+ for po in conduit.getRpmDB().returnLeafNodes():
+ ret.add((po.name, po.arch))
+ return ret
+
+def pretrans_hook(conduit):
+ global _old_leaves
+ _old_leaves = _get_installed_leaves(conduit)
+
+def posttrans_hook(conduit):
+ global _new_leaves
+ _new_leaves = _get_installed_leaves(conduit)
+
+def close_hook(conduit):
+ global _old_leaves, _new_leaves
+ if _old_leaves is None or _new_leaves is None:
+ return
+ newleaves = _new_leaves - _old_leaves
+ if newleaves:
+ conduit.info(2, "New leaves:")
+ for leaf in sorted(newleaves):
+ conduit.info(2, " %s.%s" % leaf)
+
diff --git a/yum-utils.spec b/yum-utils.spec
index 140bd1a..a48c732 100644
--- a/yum-utils.spec
+++ b/yum-utils.spec
@@ -344,6 +344,16 @@ This plugin looks to see if any debuginfo packages are installed, and if there
are it enables all debuginfo repositories that are "children" of enabled
repositories.
+%package -n yum-plugin-show-leaves
+Summary: Yum plugin which shows newly installed leaf packages
+packages that became leaves after a transaction
+Group: System Environment/Base
+Requires: yum >= 3.2.23
+
+%description -n yum-plugin-show-leaves
+Yum plugin which shows newly installed leaf packages
+and packages that became leaves after a transaction
+
%prep
%setup -q
@@ -377,6 +387,7 @@ plugins="\
post-transaction-actions \
rpm-warm-cache \
auto-update-debuginfo \
+ show-leaves \
"
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/yum/pluginconf.d/ $RPM_BUILD_ROOT/usr/lib/yum-plugins/
@@ -579,8 +590,16 @@ fi
/usr/lib/yum-plugins/auto-update-debuginfo.*
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/auto-update-debuginfo.conf
+%files -n yum-plugin-show-leaves
+%defattr(-, root, root)
+/usr/lib/yum-plugins/show-leaves.*
+%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/show-leaves.conf
+
%changelog
+* Mon May 18 2009 Seth Vidal <skvidal at fedoraproject.org>
+- add show-leaves plugin from Ville Skyttä
+
* Wed Mar 25 2009 Tim Lauridsen <timlau at fedoraproject.org>
- mark as 1.1.21
More information about the Yum-commits
mailing list