update.py: fix scanning for machine files

* Avoid picking up machine files in sub-layers
* Skip scanning of .git directory when doing full refresh

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2013-03-20 17:59:41 +00:00
parent e1bbc39237
commit 1c73d63333

View File

@ -69,8 +69,9 @@ def split_bb_file_path(recipe_path, subdir_start):
return (None, None) return (None, None)
conf_re = re.compile(r'conf/machine/([^/.]*).conf$') conf_re = re.compile(r'conf/machine/([^/.]*).conf$')
def check_machine_conf(path): def check_machine_conf(path, subdir_start):
res = conf_re.search(path) subpath = path[len(subdir_start):]
res = conf_re.match(subpath)
if res: if res:
return res.group(1) return res.group(1)
return None return None
@ -423,7 +424,7 @@ def main():
if filename: if filename:
layerrecipes.filter(filepath=filepath).filter(filename=filename).delete() layerrecipes.filter(filepath=filepath).filter(filename=filename).delete()
else: else:
machinename = check_machine_conf(path) machinename = check_machine_conf(path, subdir_start)
if machinename: if machinename:
layermachines.filter(name=machinename).delete() layermachines.filter(name=machinename).delete()
@ -440,7 +441,7 @@ def main():
recipe.save() recipe.save()
updatedrecipes.add(recipe) updatedrecipes.add(recipe)
else: else:
machinename = check_machine_conf(path) machinename = check_machine_conf(path, subdir_start)
if machinename: if machinename:
machine = Machine() machine = Machine()
machine.layerbranch = layerbranch machine.layerbranch = layerbranch
@ -461,7 +462,7 @@ def main():
recipe.save() recipe.save()
updatedrecipes.add(recipe) updatedrecipes.add(recipe)
else: else:
machinename = check_machine_conf(path) machinename = check_machine_conf(path, subdir_start)
if machinename: if machinename:
results = layermachines.filter(name=machinename) results = layermachines.filter(name=machinename)
if results: if results:
@ -480,6 +481,8 @@ def main():
layerrecipes.delete() layerrecipes.delete()
layermachines.delete() layermachines.delete()
for root, dirs, files in os.walk(layerdir): for root, dirs, files in os.walk(layerdir):
if '.git' in dirs:
dirs.remove('.git')
for f in files: for f in files:
if fnmatch.fnmatch(f, "*.bb"): if fnmatch.fnmatch(f, "*.bb"):
recipe = Recipe() recipe = Recipe()
@ -490,7 +493,7 @@ def main():
recipe.save() recipe.save()
else: else:
fullpath = os.path.join(root, f) fullpath = os.path.join(root, f)
machinename = check_machine_conf(fullpath) machinename = check_machine_conf(fullpath, layerdir_start)
if machinename: if machinename:
machine = Machine() machine = Machine()
machine.layerbranch = layerbranch machine.layerbranch = layerbranch