On Tue, Aug 28, 2012 at 9:43 PM, James Antill <ja...@and.org> wrote: > --- > yum/update_md.py | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- > 1 files changed, 48 insertions(+), 1 deletions(-) > > diff --git a/yum/update_md.py b/yum/update_md.py > index 7da6a08..0586c1c 100644 > --- a/yum/update_md.py > +++ b/yum/update_md.py > @@ -90,6 +90,20 @@ class UpdateNotice(object): > def __setitem__(self, item, val): > self._md[item] = val > > + def __eq__(self, other): > + # Tests to see if it's "the same data", which means that the > + # packages can be different (see add_notice). > + > + if not other or not hasattr(other, '_md'): > + return False > + > + for data in ('type', 'update_id', 'status', 'rights', > + 'issued', 'updated', 'version', 'pushcount', > + 'from', 'title', 'summary', 'description', > 'solution'): > + if self._md[data] != other._md[data]: > + return False > + return True > + > def text(self, skip_data=('files', 'summary', 'rights', 'solution')): > head = """ > > > =============================================================================== > @@ -429,9 +443,42 @@ class UpdateMetadata(object): > def add_notice(self, un): > """ Add an UpdateNotice object. This should be fully populated > with > data, esp. update_id and pkglist/packages. """ > - if not un or not un["update_id"] or un['update_id'] in > self._notices: > + if not un or not un["update_id"]: > return > > + # This is "special", the main thing we want to deal with here is > + # having one errata that has multiple packages in it rpmA and > rpmB, but > + # the packages are in repos. repoA and repoB. So instead of doing > a > + # single errata pointing to both rpmA and rpmB and put the same > thing > + # in both repodata (which is legal, and works fine) people want > to have > + # just the packages from repoA in the repodata for repoA and vice > versa. > + if un['update_id'] in self._notices: > + oun = self._notices[un['update_id']] > + if oun != un: > + return > + > + # Ok, main parts of errata are the same, so now merge > references: > + seen = set() > + for ref in oun['references']: > + seen.add(ref['id']) > + for ref in un['references']: > + if ref['id'] in seen: > + continue > + seen.add(ref['id']) > + oun['references'].append(ref) > + > + # ...and pkglist (this assumes that a pkglist name XYZ is the > same): > + seen = set() > + for pkg in oun['pkglist']: > + seen.add(pkg['name']) > + for pkg in un['pkglist']: > + if pkg['name'] in seen: > + continue > + seen.add(pkg['name']) > + oun['pkglist'].append(pkg) > + > + un = oun > + > self._notices[un['update_id']] = un > for pkg in un['pkglist']: > for filedata in pkg['packages']: > -- > 1.7.6.5 > > _______________________________________________ > Yum-devel mailing list > Yum-devel@lists.baseurl.org > http://lists.baseurl.org/mailman/listinfo/yum-devel >
ACK
_______________________________________________ Yum-devel mailing list Yum-devel@lists.baseurl.org http://lists.baseurl.org/mailman/listinfo/yum-devel