[yum-cvs] 4 commits - yum-updatesd yum-updatesd-helper
James Antill
james at linux.duke.edu
Mon Dec 10 23:26:09 UTC 2007
yum-updatesd | 25 ++++++++++++++++++++-----
yum-updatesd-helper | 5 +++++
2 files changed, 25 insertions(+), 5 deletions(-)
New commits:
commit 4bbd13f4223d6ab04d363b6fc4ef853fca17d2c1
Author: James Antill <james at and.org>
Date: Mon Dec 10 18:26:03 2007 -0500
Explain why limited isn't used on default runs
diff --git a/yum-updatesd b/yum-updatesd
index 13bb65c..83c8c70 100755
--- a/yum-updatesd
+++ b/yum-updatesd
@@ -298,6 +298,11 @@ def main(options = None):
pass
run_interval_ms = opts.run_interval * 1000 # needs to be in ms
+ # Note that we don't use limited=True here because:
+ # 1. We could get out of sync. with yum metadata_expire, causing the yum
+ # UI to hit the network.
+ # 2. If updatesrefresh == run_interval (the default), we could skip every
+ # other timeout.
gobject.timeout_add(run_interval_ms, checkUpdates, opts)
# set up file watcher when we're idle
commit c1fbf555868988262967cc1150b8003761d3c054
Author: James Antill <james at and.org>
Date: Mon Dec 10 18:16:46 2007 -0500
Use SecondsOption from latest yum
diff --git a/yum-updatesd b/yum-updatesd
index 6e26030..13bb65c 100755
--- a/yum-updatesd
+++ b/yum-updatesd
@@ -52,7 +52,7 @@ NM_ONLINE = 3
class UDConfig(BaseConfig):
"""Config format for the daemon"""
- run_interval = IntOption(3600)
+ run_interval = SecondsOption(60 * 60) # 1h
nonroot_workdir = Option("/var/tmp/yum-updatesd")
emit_via = ListOption(['dbus', 'email', 'syslog'])
email_to = ListOption(["root"])
@@ -63,7 +63,7 @@ class UDConfig(BaseConfig):
do_update = BoolOption(False)
do_download = BoolOption(False)
do_download_deps = BoolOption(False)
- updaterefresh = IntOption(3600)
+ updaterefresh = SecondsOption(60 * 60) # 1h
syslog_facility = Option("DAEMON")
syslog_level = Option("WARN")
syslog_ident = Option("yum-updatesd")
commit 271f4cbfc03ef81feeefc735796f0ca4df4ea850
Author: James Antill <james at and.org>
Date: Mon Dec 10 18:16:14 2007 -0500
Fix updaterefresh option
diff --git a/yum-updatesd b/yum-updatesd
index 5faa6a5..6e26030 100755
--- a/yum-updatesd
+++ b/yum-updatesd
@@ -28,6 +28,7 @@ import string
import syslog
import string
import subprocess
+import time # For updaterefresh
from optparse import OptionParser
@@ -95,7 +96,7 @@ class YumDbusListener(dbus.service.Object):
self.yumdconfig = config
def doCheck(self):
- checkUpdates(self.yumdconfig)
+ checkUpdates(self.yumdconfig, limited=True)
return False
@dbus.service.method("edu.duke.linux.yum", in_signature="")
@@ -136,12 +137,20 @@ def checkHelperStatus():
return False
return True
-def checkUpdates(opts, wait = False):
+lastUpdate = None
+def checkUpdates(opts, wait = False, limited=False):
+ """ Run yum-updatesd-helper to check for updates and report. Possibly
+ wait for the result, and/or limit the number of updates we try. """
+ global lastUpdate
global helperProcess
if helperProcess is not None:
print >> sys.stderr, "Helper process already running"
return True
+ if lastUpdate and (time.time() - lastUpdate) < updaterefresh:
+ print >> sys.stderr, "Update requested too quickly"
+ return True
+
if os.path.exists("./yum-updatesd-helper") and opts.debug:
args = ["./yum-updatesd-helper", "--check"]
else:
@@ -182,6 +191,7 @@ def checkUpdates(opts, wait = False):
args.append("--debug")
print >> sys.stderr, "Going to exec: %s" %(args,)
+ lastUpdate = time.time()
helperProcess = subprocess.Popen(args, close_fds = True)
if not wait:
@@ -234,7 +244,7 @@ def setup_watcher():
def network_state_change(newstate, opts):
if int(newstate) == NM_ONLINE:
- checkUpdates(opts)
+ checkUpdates(opts, limited=True)
def main(options = None):
if options is None:
commit 0f798d6d2a9793374d062ebba0877a353632db1a
Author: James Antill <james at and.org>
Date: Mon Dec 10 18:13:50 2007 -0500
Override metadata expires value, as it's pointless to run cached
diff --git a/yum-updatesd-helper b/yum-updatesd-helper
index 888d8c2..2a7c451 100755
--- a/yum-updatesd-helper
+++ b/yum-updatesd-helper
@@ -369,6 +369,11 @@ class UpdatesDaemon(yum.YumBase):
# gettext.textdomain() and assuming it's from the default
# domain for this app)
self.emitSetupFailed(str(e))
+ # Override the metadata expire, because there's no point running
+ # yum-updatesd-helper if we use cached metadata
+ for repo in self.repos.listEnabled():
+ repo.metadata_expire = 1
+
def doLock(self):
try:
More information about the Yum-cvs-commits
mailing list