update_classic_status: add skip option

Add an option to skip certain recipes by name (a crude workaround for
when we would otherwise get an erroneous match).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2018-02-15 10:21:13 +13:00
parent dd01e13519
commit c98417f891

View File

@ -38,6 +38,9 @@ def main():
parser.add_option("-n", "--dry-run", parser.add_option("-n", "--dry-run",
help = "Don't write any data back to the database", help = "Don't write any data back to the database",
action="store_true", dest="dryrun") action="store_true", dest="dryrun")
parser.add_option("-s", "--skip",
help = "Skip specified packages (comma-separated list, no spaces)",
action="store", dest="skip")
parser.add_option("-d", "--debug", parser.add_option("-d", "--debug",
help = "Enable debug output", help = "Enable debug output",
action="store_const", const=logging.DEBUG, dest="loglevel", default=logging.INFO) action="store_const", const=logging.DEBUG, dest="loglevel", default=logging.INFO)
@ -65,6 +68,10 @@ def main():
logger.error("Specified branch %s does not exist in database" % options.branch) logger.error("Specified branch %s does not exist in database" % options.branch)
sys.exit(1) sys.exit(1)
if options.skip:
skiplist = options.skip.split(',')
else:
skiplist = []
try: try:
with transaction.atomic(): with transaction.atomic():
def recipe_pn_query(pn): def recipe_pn_query(pn):
@ -72,6 +79,9 @@ def main():
recipequery = ClassicRecipe.objects.filter(layerbranch=layerbranch).filter(deleted=False).filter(cover_status__in=['U', 'N']) recipequery = ClassicRecipe.objects.filter(layerbranch=layerbranch).filter(deleted=False).filter(cover_status__in=['U', 'N'])
for recipe in recipequery: for recipe in recipequery:
if recipe.pn in skiplist:
logger.debug('Skipping %s' % recipe.pn)
continue
sanepn = recipe.pn.lower().replace('_', '-') sanepn = recipe.pn.lower().replace('_', '-')
replquery = recipe_pn_query(sanepn) replquery = recipe_pn_query(sanepn)
found = False found = False