ralphbean/fedora-tagger — Issue #37: Use tg2 scheduler to update list of all packages in Fedora.
Author: lmacken
Created: 2012-01-13 23:55:25+00:00
State: open

We need to update our package list on a fairly regular basis. Here is the code to do so, we just need to make sure TG2 scheduler is packaged up and integrate it.

```python
from koji import ClientSession
from kitchen.text.converters import to_unicode

def update_package_list(self):
koji = ClientSession('https://koji.fedoraproject.org/kojihub')
for package in koji.listPackages():
name = to_unicode(package['package_name'])
p = model.Package.query.filter_by(name=name)
if p.count() == 0:
model.DBSession.add(model.Package(name=name, summary=u''))
```