2011/3/19 Ben Walton <[email protected]>: > Excerpts from Maciej Bliziński's message of Sat Mar 19 07:12:22 -0400 2011: > >> Implementing the atom feed would require setting up a new feed >> served by http, and a glue code between the catalog notifier and the >> feed data backend (e.g. mysql). > > It seems to me that this could be done by the notifier itself. The > catalog parser and comparator parts would remain the same. The data > that generates the email notification from the template would just > need a second step that appends to the xml atom feed...or maybe calls > out to a separate tool that does this. > > At that point, it's just a matter of making the atom feed visible. > > I think that right around here[1] a bit of code would be added that > uses the catalog comparator code (already self contained) and spits > makes the appropriate changes to the feed. It might make sense to > factor out the calls to catalog comparator from the > NotificationFormatter too, but I didn't look too deeply at that. > > Maciej, is this roughly accurate?
Yes, that's it. Catalog downloading and comparing results are best reused. The comparator class only compares a single catalog, specific to an architecture and OS release. During one run, the notifier downloads and compares 6 (2 architectures × 3 OS releases) catalogs and stores all diffs in a single data structure. This data structure could be reused. You could for instance memoize the _GetPkgsByMaintainer function and call it again, reusing the data. You could add a new method, similar to FormatNotifications, calling memoized _GetPkgsByMaintainer and doing something else with the data. I've packaged an atom formatting library for Python: py_atomixlib. To persist data between runs, the same simple method could be used: pickle the data on disk, and read them during the next. Something like: unpickle old feed data get new information by comparing catalogs add new entries to the feed remove old items from the feed format feed save feed save data Maciej _______________________________________________ devel mailing list [email protected] https://lists.opencsw.org/mailman/listinfo/devel
