layerindex-web/scripts/rrs_update/recipe_maintainer.py
Aníbal Limón 1152195b9e scripts/update.py: Add support for rrs
conf/local.conf: Add meta-yocto includes for get distro information
(distro aliases, maintainers, upstream {regex, tracking}) needed by
rrs.

scripts/update.py: Add support for rrs, ability to download poky layer
and set BBPATH to support meta-yocto includes in bitbake.

scripts/rrs_update/*: Modules for update data needed by rrs, distros,
maintainers, upgrades and upstream.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
2015-01-08 12:32:05 -06:00

42 lines
1.3 KiB
Python

from django.db import transaction
from rrs.models import Maintainer, RecipeMaintainer
"""
Update recipe maintainter if don't exist create new one.
"""
def update_recipe_maintainers(envdata, logger):
transaction.enter_transaction_management()
transaction.managed(True)
for recipe, data in envdata.iteritems():
maintainer = data.getVar('RECIPE_MAINTAINER', True) or ""
if (maintainer == ""):
m = Maintainer.objects.get(id = 0) # No Maintainer
else:
maintainer_name = " ".join(maintainer.split(' ')[0:-1])
maintainer_email = maintainer.split(' ')[-1].replace('<', '').replace('>','')
try:
m = Maintainer.objects.get(name = maintainer_name)
m.email = maintainer_email
except Maintainer.DoesNotExist:
m = Maintainer()
m.name = maintainer_name
m.email = maintainer_email
m.save()
try:
rm = RecipeMaintainer.objects.get(recipe = recipe)
rm.maintainer = m
except RecipeMaintainer.DoesNotExist:
rm = RecipeMaintainer()
rm.recipe = recipe
rm.maintainer = m
rm.save()
transaction.commit()
transaction.leave_transaction_management()