Commit 60ccfe96 authored by Panu Matilainen's avatar Panu Matilainen

- add allowdowngrade plugin

- fix traceback in changelog plugin if package has no changelog
parent 0c4c2e1e
# 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.
#
# by Panu Matilainen <pmatilai@laiskiainen.org>
from yum.plugins import TYPE_INTERFACE
from rpm import RPMPROB_FILTER_OLDPACKAGE
requires_api_version = '2.4'
plugin_type = (TYPE_INTERFACE,)
def config_hook(conduit):
parser = conduit.getOptParser()
parser.add_option('--allow-downgrade', dest='allow_downgrade',
action='store_true', default=False,
help='Allow packages to be downgraded')
def postresolve_hook(conduit):
opts, args = conduit.getCmdLine()
if opts.allow_downgrade:
tsInfo = conduit.getTsInfo()
tsInfo.probFilterFlags.append(RPMPROB_FILTER_OLDPACKAGE)
......@@ -90,7 +90,11 @@ def postresolve_hook(conduit):
# store the latest date in changelog entries
times = hdr['changelogtime']
n,v,r,e,a = splitFilename(hdr['sourcerpm'])
origpkgs[n] = times[0]
if len(times) == 0:
# deal with packages without changelog
origpkgs[n] = 0
else:
origpkgs[n] = times[0]
if conduit.confString('main', 'when', default='post') == 'pre':
show_changes(conduit, 'Changes in packages about to be updated:')
......
......@@ -102,6 +102,15 @@ Requires: yum >= 2.4.1
This plugin adds a --downloadonly flag to yum so that yum will only download
the packages and not install/update them.
%package -n yum-allowdowngrade
Summary: Yum plugin to enable manual downgrading of packages
Group: System Environment/Base
Requires: yum > 2.9.5
%description -n yum-allowdowngrade
This plugin adds a --allow-downgrade flag to yum to make it possible to
manually downgrade packages to specific versions.
%prep
%setup -q
......@@ -195,7 +204,15 @@ fi
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/downloadonly.conf
/usr/lib/yum-plugins/downloadonly.*
%files -n yum-allowdowngrade
%defattr(-, root, root)
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/allowdowngrade.conf
/usr/lib/yum-plugins/allowdowngrade.*
%changelog
* Tue Sep 05 2006 Panu Matilainen <pmatilai@laiskianen.org>
- added allowdowngrade plugin
* Sun Aug 13 2006 Seth Vidal <skvidal at linux.duke.edu>
- fix the plugins/ doc issue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment