diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2013-09-18 21:19:43 +0100 |
---|---|---|
committer | Paul Eggleton <paul.eggleton@linux.intel.com> | 2013-09-20 07:08:22 +0100 |
commit | 84eecd7a54d73cd380b4a390a98e270855beaa62 (patch) | |
tree | 0c17c4a3bf4fbd727ad7281fab47f5a8d2549434 | |
parent | fe717e0ad131aa85a000f899e005668ae102316f (diff) | |
download | openembedded-core-contrib-84eecd7a54d73cd380b4a390a98e270855beaa62.tar.gz |
update.py: add --fullreload option
Recently the -r/--reload option was changed to preserve existing recipe
data, so that it could be used to load values into newly added fields;
however we still need an option to load recipe data from scratch for
testing purposes (e.g. in combination with --nocheckout) so add a
--fullreload option to do this.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rwxr-xr-x | layerindex/update.py | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/layerindex/update.py b/layerindex/update.py index f43b260bb2..f62e62a8ce 100755 --- a/layerindex/update.py +++ b/layerindex/update.py @@ -119,8 +119,11 @@ def main(): help = "Specify layers to update (use commas to separate multiple). Default is all published layers.", action="store", dest="layers") parser.add_option("-r", "--reload", - help = "Discard existing recipe data and fetch it from scratch", + help = "Reload recipe data instead of updating since last update", action="store_true", dest="reload") + parser.add_option("", "--fullreload", + help = "Discard existing recipe data and fetch it from scratch", + action="store_true", dest="fullreload") parser.add_option("-n", "--dry-run", help = "Don't write any data back to the database", action="store_true", dest="dryrun") @@ -143,6 +146,9 @@ def main(): parser.print_help() sys.exit(1) + if options.fullreload: + options.reload = True + utils.setup_django() import settings from layerindex.models import LayerItem, LayerBranch, Recipe, RecipeFileDependency, Machine, BBAppend, BBClass @@ -430,21 +436,24 @@ def main(): else: # Collect recipe data from scratch - # First, check which recipes still exist - layerrecipe_values = layerrecipes.values('id', 'filepath', 'filename', 'pn') - layerrecipe_fns = [] - for v in layerrecipe_values: - root = os.path.join(layerdir, v['filepath']) - fullpath = os.path.join(root, v['filename']) - if os.path.exists(fullpath): - # Recipe still exists, update it - results = layerrecipes.filter(id=v['id'])[:1] - recipe = results[0] - update_recipe_file(config_data_copy, root, recipe, layerdir_start, repodir) - else: - # Recipe no longer exists, mark it for later on - layerrecipes_delete.append(v) - layerrecipe_fns.append(fullpath) + if options.fullreload: + layerrecipes.delete() + else: + # First, check which recipes still exist + layerrecipe_values = layerrecipes.values('id', 'filepath', 'filename', 'pn') + layerrecipe_fns = [] + for v in layerrecipe_values: + root = os.path.join(layerdir, v['filepath']) + fullpath = os.path.join(root, v['filename']) + if os.path.exists(fullpath): + # Recipe still exists, update it + results = layerrecipes.filter(id=v['id'])[:1] + recipe = results[0] + update_recipe_file(config_data_copy, root, recipe, layerdir_start, repodir) + else: + # Recipe no longer exists, mark it for later on + layerrecipes_delete.append(v) + layerrecipe_fns.append(fullpath) layermachines.delete() layerappends.delete() |