[yum-commits] 2 commits - plugins/rpm-warm-cache yum-utils.spec
skvidal at osuosl.org
skvidal at osuosl.org
Mon Oct 27 14:23:43 UTC 2008
plugins/rpm-warm-cache/rpm-warm-cache.conf | 2 +
plugins/rpm-warm-cache/rpm-warm-cache.py | 43 +++++++++++++++++++++++++++++
yum-utils.spec | 18 ++++++++++++
3 files changed, 63 insertions(+)
New commits:
commit 6b9f254b2f097c06c81d95c63046ae109b8be352
Author: Seth Vidal <skvidal at fedoraproject.org>
Date: Mon Oct 27 10:21:48 2008 -0400
forgot the .*
diff --git a/yum-utils.spec b/yum-utils.spec
index 5fe55d9..ba02be7 100644
--- a/yum-utils.spec
+++ b/yum-utils.spec
@@ -538,7 +538,7 @@ fi
%files -n yum-rpm-warm-cache
%defattr(-, root, root)
-/usr/lib/yum-plugins/rpm-warm-cache
+/usr/lib/yum-plugins/rpm-warm-cache.*
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/rpm-warm-cache.conf
commit c6b9c600cd094efc6c3316644ae405dfcfc22feb
Author: Seth Vidal <skvidal at fedoraproject.org>
Date: Mon Oct 27 10:20:07 2008 -0400
rpm-warm-cache plugin
diff --git a/plugins/rpm-warm-cache/rpm-warm-cache.conf b/plugins/rpm-warm-cache/rpm-warm-cache.conf
new file mode 100644
index 0000000..e7002aa
--- /dev/null
+++ b/plugins/rpm-warm-cache/rpm-warm-cache.conf
@@ -0,0 +1,2 @@
+[main]
+enabled = 1
diff --git a/plugins/rpm-warm-cache/rpm-warm-cache.py b/plugins/rpm-warm-cache/rpm-warm-cache.py
new file mode 100644
index 0000000..b80c0f6
--- /dev/null
+++ b/plugins/rpm-warm-cache/rpm-warm-cache.py
@@ -0,0 +1,43 @@
+#!/usr/bin/python
+
+# 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 Ralf Ertzinger <ralf at skytale.net>
+#
+# This plugin reads the complete RPM database into the buffer cache
+# in order to improve database reads later on.
+# Don't use this if you're short on memory, anyways.
+
+from yum.plugins import PluginYumExit, TYPE_CORE
+from os import walk, path
+
+requires_api_version = '2.1'
+plugin_type = (TYPE_CORE,)
+
+def postreposetup_hook(conduit):
+ opts, commands = conduit.getCmdLine()
+ if commands[0] in ('upgrade', 'install', 'remove'):
+ try:
+ for root, dirs, files in walk('/var/lib/rpm'):
+ for file in files:
+ f = open(path.join(root, file))
+ d = f.read(1024*1024)
+ while(len(d) > 0):
+ d = f.read(1024*1024)
+ f.close()
+ except:
+ # Do nothing in case something fails, caching is entirely
+ # optional.
+ pass
diff --git a/yum-utils.spec b/yum-utils.spec
index 04f8e55..5fe55d9 100644
--- a/yum-utils.spec
+++ b/yum-utils.spec
@@ -291,6 +291,15 @@ happens in NetworkManager. Note that currently there is no checking of
previous data, so if your WiFi keeps going up and down (or you suspend/resume
a lot) yum will recheck it's cached data a lot.
+%package -n yum-rpm-warm-cache
+Summary: Yum plugin to access the rpmdb files early to warm up access to the db
+Group: System Environment/Base
+Requires: yum >= 3.2.19
+
+%description -n yum-rpm-warm-cache
+This plugin reads the rpmdb files into the system cache before accessing the
+rpmdb directly. In some cases this should speed up access to rpmdb information
+
%prep
%setup -q
@@ -325,6 +334,7 @@ plugins="\
keys \
remove-with-leaves \
post-transaction-actions \
+ rpm-warm-cache \
"
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/yum/pluginconf.d/ $RPM_BUILD_ROOT/usr/lib/yum-plugins/
@@ -526,8 +536,16 @@ fi
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/post-transaction-actions.conf
%doc plugins/post-transaction-actions/sample.action
+%files -n yum-rpm-warm-cache
+%defattr(-, root, root)
+/usr/lib/yum-plugins/rpm-warm-cache
+%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/rpm-warm-cache.conf
+
%changelog
+* Mon Oct 27 2008 Seth Vidal <skvidal at fedoraproject.org>
+- add rpm-warm-cache plugin
+
* Fri Sep 19 2008 Tim Lauridsen <timlau at fedoraproject.org>
- removed skip-broken plugin
More information about the Yum-commits
mailing list