mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
update.py: ignore layers within layers
Some layers, such as meta-intel, also contain other layers. We don't want recipes/classes/appends in those child layers to appear in the parent layer so ignore any that appear within subdirectories that contain a conf/layer.conf file. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
7c4a1c1dab
commit
ab393b18c6
|
@ -364,6 +364,13 @@ def main():
|
||||||
layerrecipes_delete = []
|
layerrecipes_delete = []
|
||||||
layerrecipes_add = []
|
layerrecipes_add = []
|
||||||
|
|
||||||
|
# Check if any paths should be ignored because there are layers within this layer
|
||||||
|
removedirs = []
|
||||||
|
for root, dirs, files in os.walk(layerdir):
|
||||||
|
for d in dirs:
|
||||||
|
if os.path.exists(os.path.join(root, d, 'conf', 'layer.conf')):
|
||||||
|
removedirs.append(os.path.join(root, d) + os.sep)
|
||||||
|
|
||||||
if diff:
|
if diff:
|
||||||
# Apply git changes to existing recipe list
|
# Apply git changes to existing recipe list
|
||||||
|
|
||||||
|
@ -376,6 +383,13 @@ def main():
|
||||||
for d in diff.iter_change_type('D'):
|
for d in diff.iter_change_type('D'):
|
||||||
path = d.a_blob.path
|
path = d.a_blob.path
|
||||||
if path.startswith(subdir_start):
|
if path.startswith(subdir_start):
|
||||||
|
skip = False
|
||||||
|
for d in removedirs:
|
||||||
|
if path.startswith(d):
|
||||||
|
skip = True
|
||||||
|
break
|
||||||
|
if skip:
|
||||||
|
continue
|
||||||
(typename, filepath, filename) = recipeparse.detect_file_type(path, subdir_start)
|
(typename, filepath, filename) = recipeparse.detect_file_type(path, subdir_start)
|
||||||
if typename == 'recipe':
|
if typename == 'recipe':
|
||||||
values = layerrecipes.filter(filepath=filepath).filter(filename=filename).values('id', 'filepath', 'filename', 'pn')
|
values = layerrecipes.filter(filepath=filepath).filter(filename=filename).values('id', 'filepath', 'filename', 'pn')
|
||||||
|
@ -395,6 +409,13 @@ def main():
|
||||||
for d in diff.iter_change_type('A'):
|
for d in diff.iter_change_type('A'):
|
||||||
path = d.b_blob.path
|
path = d.b_blob.path
|
||||||
if path.startswith(subdir_start):
|
if path.startswith(subdir_start):
|
||||||
|
skip = False
|
||||||
|
for d in removedirs:
|
||||||
|
if path.startswith(d):
|
||||||
|
skip = True
|
||||||
|
break
|
||||||
|
if skip:
|
||||||
|
continue
|
||||||
(typename, filepath, filename) = recipeparse.detect_file_type(path, subdir_start)
|
(typename, filepath, filename) = recipeparse.detect_file_type(path, subdir_start)
|
||||||
if typename == 'recipe':
|
if typename == 'recipe':
|
||||||
layerrecipes_add.append(os.path.join(repodir, path))
|
layerrecipes_add.append(os.path.join(repodir, path))
|
||||||
|
@ -422,6 +443,13 @@ def main():
|
||||||
for d in diff.iter_change_type('M'):
|
for d in diff.iter_change_type('M'):
|
||||||
path = d.a_blob.path
|
path = d.a_blob.path
|
||||||
if path.startswith(subdir_start):
|
if path.startswith(subdir_start):
|
||||||
|
skip = False
|
||||||
|
for d in removedirs:
|
||||||
|
if path.startswith(d):
|
||||||
|
skip = True
|
||||||
|
break
|
||||||
|
if skip:
|
||||||
|
continue
|
||||||
(typename, filepath, filename) = recipeparse.detect_file_type(path, subdir_start)
|
(typename, filepath, filename) = recipeparse.detect_file_type(path, subdir_start)
|
||||||
if typename == 'recipe':
|
if typename == 'recipe':
|
||||||
logger.debug("Mark %s for update" % path)
|
logger.debug("Mark %s for update" % path)
|
||||||
|
@ -457,7 +485,16 @@ def main():
|
||||||
for v in layerrecipe_values:
|
for v in layerrecipe_values:
|
||||||
root = os.path.join(layerdir, v['filepath'])
|
root = os.path.join(layerdir, v['filepath'])
|
||||||
fullpath = os.path.join(root, v['filename'])
|
fullpath = os.path.join(root, v['filename'])
|
||||||
|
preserve = True
|
||||||
if os.path.exists(fullpath):
|
if os.path.exists(fullpath):
|
||||||
|
for d in removedirs:
|
||||||
|
if fullpath.startswith(d):
|
||||||
|
preserve = False
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
preserve = False
|
||||||
|
|
||||||
|
if preserve:
|
||||||
# Recipe still exists, update it
|
# Recipe still exists, update it
|
||||||
results = layerrecipes.filter(id=v['id'])[:1]
|
results = layerrecipes.filter(id=v['id'])[:1]
|
||||||
recipe = results[0]
|
recipe = results[0]
|
||||||
|
@ -473,6 +510,10 @@ def main():
|
||||||
for root, dirs, files in os.walk(layerdir):
|
for root, dirs, files in os.walk(layerdir):
|
||||||
if '.git' in dirs:
|
if '.git' in dirs:
|
||||||
dirs.remove('.git')
|
dirs.remove('.git')
|
||||||
|
for d in dirs[:]:
|
||||||
|
fullpath = os.path.join(root, d) + os.sep
|
||||||
|
if fullpath in removedirs:
|
||||||
|
dirs.remove(d)
|
||||||
for f in files:
|
for f in files:
|
||||||
fullpath = os.path.join(root, f)
|
fullpath = os.path.join(root, f)
|
||||||
(typename, _, filename) = recipeparse.detect_file_type(fullpath, layerdir_start)
|
(typename, _, filename) = recipeparse.detect_file_type(fullpath, layerdir_start)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user