migration/4.0.0_Any.py
author David Douard <david.douard@logilab.fr>
Thu, 20 Nov 2014 23:14:28 +0100
changeset 1779 52df5eea680c
parent 1773 35a2edaa84e5
child 1622 84913fb4d2e7
permissions -rw-r--r--
[migration] ensure Repository and ProjectEnvironment have recipes

from itertools import chain

drop_attribute('ProjectEnvironment', 'vcs_path')

add_relation_definition('Repository', 'checkout_recipe', 'Recipe')
add_relation_definition('ProjectEnvironment', 'setup_recipe', 'Recipe')


sync_schema_props_perms(schema['TestExecution'].rdef('branch'))

# rename apycot recipes
for oldname, newname in ((u'apycot.recipe.full', u'apycot.python.full'),
                         (u'apycot.recipe.quick', u'apycot.python.quick'),
                         ):
    rql('SET R name %(newname)s WHERE R is Recipe, R name %(oldname)s',
        {'newname': newname, 'oldname': oldname})
commit()

# add new or update basic recipes
from cubes.apycot import recipes
recipes.create_recipes(session, update=True)

# add checkout recipes to repositories
rql('SET REPO checkout_recipe CR WHERE CR name "apycot.checkout.mercurial", '
    'REPO type "mercurial", NOT REPO checkout_recipe CR2')
# add setup recipes to project environments
rql('SET PE setup_recipe SR WHERE SR name "apycot.setup.distutils", '
    'NOT PE setup_recipe SR2')