[yum-cvs] yum/yum update_md.py,1.1,1.2
Luke Macken
lmacken at linux.duke.edu
Tue Jun 13 18:57:12 UTC 2006
Update of /home/groups/yum/cvs/yum/yum
In directory login1.linux.duke.edu:/tmp/cvs-serv3170/yum
Modified Files:
update_md.py
Log Message:
Add support for reading 'updateinfo' metadata from repos, if it exists, and sending it through dbus to the puplet. For testing purposes, arbitrary metadata may be inserted into repository using the following tool:
http://people.redhat.com/lmacken/insertmd.py
Index: update_md.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/update_md.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- update_md.py 22 Dec 2005 16:07:43 -0000 1.1
+++ update_md.py 13 Jun 2006 18:57:10 -0000 1.2
@@ -36,9 +36,9 @@
self.distribution = None
self.release_date = None
self.status = None
- self.classification = None
+ self.type = None
self.title = ''
-
+
if elem:
self.parse(elem)
@@ -46,14 +46,14 @@
cveinfo = pkglist = related = ''
head = """
-Class: %s
+Type: %s
Status: %s
Distribution: %s
ID: %s
Release date: %s
Description:
%s
- """ % (self.classification, self.status, self.distribution,
+ """ % (self.type, self.status, self.distribution,
self.update_id, self.release_date, self.description)
if self.urls:
@@ -87,11 +87,11 @@
self.release_date = elem.attrib.get('release_date')
self.status = elem.attrib.get('status')
- c = elem.attrib.get('class')
+ c = elem.attrib.get('type')
if not c:
- self.classification = 'update'
+ self.type = 'update'
else:
- self.classification = c
+ self.type = c
for child in elem:
@@ -129,7 +129,6 @@
-
class UpdateMetadata(object):
def __init__(self):
self._notices = {}
@@ -138,7 +137,17 @@
return self._notices.values()
notices = property(get_notices)
-
+
+ def get_notice(self, nvr):
+ """ Retrieve an update notice for a given (name, version, release). """
+ for notice in self._notices.values():
+ for pkg in notice.packages:
+ if pkg['name'] == nvr[0] and \
+ pkg['ver'] == nvr[1] and \
+ pkg['rel'] == nvr[2]:
+ return notice
+ return None
+
def add(self, srcfile):
if not srcfile:
raise UpdateNoticeException
@@ -155,10 +164,10 @@
un = UpdateNotice(elem)
if not self._notices.has_key(un.update_id):
self._notices[un.update_id] = un
-
-
+
+
del parser
-
+
def dump(self):
for notice in self.notices:
print notice
More information about the Yum-cvs-commits
mailing list