mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
Split out recipe dependency handling to its own function
Make it easier to call this outside of the context of the update process. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
bcedcb7006
commit
d1be5af067
|
@ -153,3 +153,45 @@ def detect_file_type(path, subdir_start):
|
||||||
|
|
||||||
return (None, None, None)
|
return (None, None, None)
|
||||||
|
|
||||||
|
|
||||||
|
def handle_recipe_depends(recipe, depends, packageconfig_opts):
|
||||||
|
from layerindex.models import StaticBuildDep, PackageConfig, DynamicBuildDep
|
||||||
|
|
||||||
|
# Handle static build dependencies for this recipe
|
||||||
|
for dep in depends.split():
|
||||||
|
static_build_dependency, created = StaticBuildDep.objects.get_or_create(name=dep)
|
||||||
|
if created:
|
||||||
|
static_build_dependency.save()
|
||||||
|
static_build_dependency.recipes.add(recipe)
|
||||||
|
|
||||||
|
# Handle the PACKAGECONFIG variables for this recipe
|
||||||
|
PackageConfig.objects.filter(recipe=recipe).delete()
|
||||||
|
for key, value in packageconfig_opts.items():
|
||||||
|
if key == "doc":
|
||||||
|
continue
|
||||||
|
package_config = PackageConfig()
|
||||||
|
package_config.feature = key
|
||||||
|
package_config.recipe = recipe
|
||||||
|
package_config_vals = value.split(",")
|
||||||
|
try:
|
||||||
|
package_config.build_deps = package_config_vals[2]
|
||||||
|
except IndexError:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
package_config.with_option = package_config_vals[0]
|
||||||
|
except IndexError:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
package_config.without_option = package_config_vals[1]
|
||||||
|
except IndexError:
|
||||||
|
pass
|
||||||
|
package_config.save()
|
||||||
|
# Handle the dynamic dependencies for the PACKAGECONFIG variable
|
||||||
|
if package_config.build_deps:
|
||||||
|
for dep in package_config.build_deps.split():
|
||||||
|
dynamic_build_dependency, created = DynamicBuildDep.objects.get_or_create(name=dep)
|
||||||
|
if created:
|
||||||
|
dynamic_build_dependency.save()
|
||||||
|
dynamic_build_dependency.package_configs.add(package_config)
|
||||||
|
dynamic_build_dependency.recipes.add(recipe)
|
||||||
|
|
||||||
|
|
|
@ -123,14 +123,6 @@ def update_recipe_file(tinfoil, data, path, recipe, layerdir_start, repodir, sto
|
||||||
recipe.blacklisted = envdata.getVarFlag('PNBLACKLIST', recipe.pn, True) or ""
|
recipe.blacklisted = envdata.getVarFlag('PNBLACKLIST', recipe.pn, True) or ""
|
||||||
recipe.save()
|
recipe.save()
|
||||||
|
|
||||||
# Handle static build dependencies for this recipe
|
|
||||||
static_dependencies = envdata.getVar("DEPENDS", True) or ""
|
|
||||||
for dep in static_dependencies.split():
|
|
||||||
static_build_dependency, created = StaticBuildDep.objects.get_or_create(name=dep)
|
|
||||||
if created:
|
|
||||||
static_build_dependency.save()
|
|
||||||
static_build_dependency.recipes.add(recipe)
|
|
||||||
|
|
||||||
# Handle sources
|
# Handle sources
|
||||||
old_urls = list(recipe.source_set.values_list('url', flat=True))
|
old_urls = list(recipe.source_set.values_list('url', flat=True))
|
||||||
for url in (envdata.getVar('SRC_URI', True) or '').split():
|
for url in (envdata.getVar('SRC_URI', True) or '').split():
|
||||||
|
@ -144,37 +136,7 @@ def update_recipe_file(tinfoil, data, path, recipe, layerdir_start, repodir, sto
|
||||||
for url in old_urls:
|
for url in old_urls:
|
||||||
recipe.source_set.filter(url=url).delete()
|
recipe.source_set.filter(url=url).delete()
|
||||||
|
|
||||||
# Handle the PACKAGECONFIG variables for this recipe
|
recipeparse.handle_recipe_depends(recipe, envdata.getVar('DEPENDS', True) or '', envdata.getVarFlags('PACKAGECONFIG'))
|
||||||
PackageConfig.objects.filter(recipe=recipe).delete()
|
|
||||||
package_config_VarFlags = envdata.getVarFlags("PACKAGECONFIG")
|
|
||||||
for key, value in package_config_VarFlags.items():
|
|
||||||
if key == "doc":
|
|
||||||
continue
|
|
||||||
package_config = PackageConfig()
|
|
||||||
package_config.feature = key
|
|
||||||
package_config.recipe = recipe
|
|
||||||
package_config_vals = value.split(",")
|
|
||||||
try:
|
|
||||||
package_config.build_deps = package_config_vals[2]
|
|
||||||
except IndexError:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
package_config.with_option = package_config_vals[0]
|
|
||||||
except IndexError:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
package_config.without_option = package_config_vals[1]
|
|
||||||
except IndexError:
|
|
||||||
pass
|
|
||||||
package_config.save()
|
|
||||||
# Handle the dynamic dependencies for the PACKAGECONFIG variable
|
|
||||||
if package_config.build_deps:
|
|
||||||
for dep in package_config.build_deps.split():
|
|
||||||
dynamic_build_dependency, created = DynamicBuildDep.objects.get_or_create(name=dep)
|
|
||||||
if created:
|
|
||||||
dynamic_build_dependency.save()
|
|
||||||
dynamic_build_dependency.package_configs.add(package_config)
|
|
||||||
dynamic_build_dependency.recipes.add(recipe)
|
|
||||||
|
|
||||||
if not skip_patches:
|
if not skip_patches:
|
||||||
# Handle patches
|
# Handle patches
|
||||||
|
|
Loading…
Reference in New Issue
Block a user