On Tuesday, 13 June 2017 4:36:44 AM CEST Robert Yang wrote:
Fixed:
- set LAYERDEPENDS_openembedded-layer = "core"
- $ "update.py -l meta-oe -b master"
Check from web, its dependency is "openembedded-core"
- Change LAYERDEPENDS_openembedded-layer = "foo"
- Run "update.py -l meta-oe -b master"
Check from web, its dependency is "openembedded-core and foo", this is
wrong, it should be "foo" only, this patch can fix the problem.
And also the existing checking should filter(required=required),
otherwise it can't work well when a layer is in both depends and
recommends, this can't happen in a normal case, but it would surprise the
user when this happens.
Signed-off-by: Robert Yang <liezhi.y...@windriver.com>
---
layerindex/utils.py | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/layerindex/utils.py b/layerindex/utils.py
index 442b121..b7165d0 100644
--- a/layerindex/utils.py
+++ b/layerindex/utils.py
@@ -88,6 +88,7 @@ def _add_dependency(var, name, layerbranch, config_data,
logger=None, required=T
logger.debug('Error parsing %s_%s for %s\n%s' % (var, var_name,
layer_name, str(vse)))
return
+ need_delete = None
for dep, ver_list in list(dep_dict.items()):
ver_str = None
if ver_list:
@@ -106,8 +107,14 @@ def _add_dependency(var, name, layerbranch,
config_data, logger=None, required=T
logger.error('Cannot resolve %s %s (version %s) for %s' %
(name, dep, ver_str, layer_name))
continue
+ # Preparing to remove obsolete ones
+ if not need_delete:
+ need_delete =
LayerDependency.objects.filter(layerbranch=layerbranch).filter(required=required).exclude(dependency=dep_layer)
+ else:
+ need_delete = need_delete.exclude(dependency=dep_layer)
+
# Skip existing entries.
- existing =
list(LayerDependency.objects.filter(layerbranch=layerbranch).filter(dependency=dep_layer))
+ existing =
list(LayerDependency.objects.filter(layerbranch=layerbranch).filter(required=required).filter(dependency=dep_layer))
if existing:
logger.debug('Skipping %s - already a dependency for %s' %
(dep, layer_name))
continue
@@ -121,6 +128,10 @@ def _add_dependency(var, name, layerbranch,
config_data, logger=None, required=T
layerdep.required = required
layerdep.save()
+ if need_delete:
+ logger.debug("Removing obsolete dependencies: %s" % need_delete)
+ need_delete.delete()
+
def set_layerbranch_collection_version(layerbranch, config_data,
logger=None):
layerbranch.collection = config_data.getVar('BBFILE_COLLECTIONS', True)
ver_str = "LAYERVERSION_"
So I do see the need to clear out old dependency values when your list of
dependencies is coming entirely from LAYERDEPENDS, however if you have only
manually added dependencies and LAYERDEPENDS is not complete (as is often the
case in the OE layer index), will this automatically remove those? If so I