From: Mariano Lopez <mariano.lo...@linux.intel.com> This fixes the issue with the mismatch in the statistics bar and the recipe list. The mismatch is caused by the gcc-source recipe, because every version of the recipe is counted in Upstream History but not in Recipe Upgrade.
Also added the TODO.rrs to track bugs and issues with rrs. Signed-off-by: Mariano Lopez <mariano.lo...@linux.intel.com> --- TODO.rrs | 4 ++++ rrs/models.py | 35 +++++++++++++++++++++++++++++++++++ rrs/views.py | 16 +++++++--------- 3 files changed, 46 insertions(+), 9 deletions(-) create mode 100644 TODO.rrs diff --git a/TODO.rrs b/TODO.rrs new file mode 100644 index 0000000..8f1acf9 --- /dev/null +++ b/TODO.rrs @@ -0,0 +1,4 @@ +TODO: + +Bugs: + - gcc-source recipe has his own recipes per version. This is triggered in gcc-source.inc diff --git a/rrs/models.py b/rrs/models.py index abc9d5b..186e56f 100644 --- a/rrs/models.py +++ b/rrs/models.py @@ -429,6 +429,41 @@ class Raw(): return stats @staticmethod + def get_reup_statistics(date, date_id): + """ Special case to get recipes statistics removing gcc-source duplicates """ + recipes = [] + updated = 0 + not_updated = 0 + cant = 0 + unknown = 0 + + all_recipes = Raw.get_reupg_by_date(date) + for re in all_recipes: + recipes.append(re["id"]) + + if date_id: + recipes = str(recipes).strip('[]') + qry = """SELECT id, status, no_update_reason + FROM rrs_RecipeUpstream""" + qry += "\nWHERE history_id = '%s'" % str(date_id.id) + qry += "\nAND recipe_id IN (%s);" % recipes + cur = connection.cursor() + cur.execute(qry) + + for re in Raw.dictfetchall(cur): + if re["status"] == "Y": + updated += 1 + elif re["status"] == "N" and re["no_update_reason"] == "": + not_updated += 1 + elif re["status"] == "N": + cant += 1 + # We count downgrade as unknown + else: + unknown += 1 + + return (updated, not_updated, cant, unknown) + + @staticmethod def get_reup_by_recipes_and_date(recipes_id, date_id=None): """ Get Recipe Upstream based on Recipes and Recipe Upstream History """ stats = [] diff --git a/rrs/views.py b/rrs/views.py index 01f14f5..8cbbe49 100644 --- a/rrs/views.py +++ b/rrs/views.py @@ -47,16 +47,14 @@ def _get_milestone_statistics(milestone, maintainer_name=None): ) if maintainer_name is None: + t_updated, t_not_updated, t_cant, t_unknown = \ + Raw.get_reup_statistics(milestone.end_date, recipe_upstream_history) milestone_statistics['all'] = \ - RecipeUpstream.get_all_recipes(recipe_upstream_history).count() - milestone_statistics['up_to_date'] = \ - RecipeUpstream.get_recipes_up_to_date(recipe_upstream_history).count() - milestone_statistics['not_updated'] = \ - RecipeUpstream.get_recipes_not_updated(recipe_upstream_history).count() - milestone_statistics['cant_be_updated'] = \ - RecipeUpstream.get_recipes_cant_be_updated(recipe_upstream_history).count() - milestone_statistics['unknown'] = \ - RecipeUpstream.get_recipes_unknown(recipe_upstream_history).count() + t_updated + t_not_updated + t_cant + t_unknown + milestone_statistics['up_to_date'] = t_updated + milestone_statistics['not_updated'] = t_not_updated + milestone_statistics['cant_be_updated'] = t_cant + milestone_statistics['unknown'] = t_unknown milestone_statistics['percentage'] = 0 milestone_statistics['all_upgraded'] = 0 milestone_statistics['all_not_upgraded'] = 0 -- 1.9.1 -- _______________________________________________ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto