diff --git a/scripts/rrs_update/recipe_upgrade.py b/scripts/rrs_update/recipe_upgrade.py index b74cb73..4d3db66 100644 --- a/scripts/rrs_update/recipe_upgrade.py +++ b/scripts/rrs_update/recipe_upgrade.py @@ -9,6 +9,8 @@ from django.db import transaction from layerindex.models import Recipe from rrs.models import Maintainer, RecipeUpgrade +from recipe_upstream import vercmp_string + """ Discovers the upgraded packages in the last day. """ @@ -72,9 +74,13 @@ def update_recipe_upgrades(layerbranch, repodir, layerdir, config_data, logger): prev_pv = None # if no previous version in database consider it an upgrade - if not prev_pv or prev_pv != pv: - logger.debug("Detected upgrade for %s in commit %s." % (pn, commit)) - create_upgrade(commit, repodir, recipe, pv, logger) + try: + if not prev_pv or vercmp_string(prev_pv, pv) == -1: + logger.debug("Detected upgrade for %s in commit %s." % (pn, commit)) + create_upgrade(commit, repodir, recipe, pv, logger) + except: + logger.error("vercmp_string: %s, %s - %s" % (recipe.pn, + prev_pv, pv)) utils.runcmd("git checkout origin/master ", repodir) utils.runcmd("git branch -D " + temp_branch, repodir) diff --git a/scripts/rrs_update/recipe_upstream.py b/scripts/rrs_update/recipe_upstream.py index 98499e0..02caf23 100644 --- a/scripts/rrs_update/recipe_upstream.py +++ b/scripts/rrs_update/recipe_upstream.py @@ -207,12 +207,20 @@ def get_upstream_info_thread(envdata, result, recipe_mutex, result_mutex, logger if not recipe_result['version']: recipe_result['status'] = 'U' # Unknown, need to review why - elif vercmp_string(recipe_pv, recipe_result['version']) == -1: - recipe_result['status'] = 'N' # Not update - elif vercmp_string(recipe_pv, recipe_result['version']) == 0: - recipe_result['status'] = 'Y' # Up-to-date - elif vercmp_string(recipe_pv, recipe_result['version']) == 1: - recipe_result['status'] = 'D' # Downgrade, need to review why + else: + try: + cmp_ver = vercmp_string(recipe_pv, recipe_result['version']) + + if cmp_ver == -1: + recipe_result['status'] = 'N' # Not update + elif cmp_ver == 0: + recipe_result['status'] = 'Y' # Up-to-date + elif cmp_ver == 1: + recipe_result['status'] = 'D' # Downgrade, need to review why + except: + recipe_result['status'] = 'U' # Unknown + logger.error("vercmp_string: %s, %s - %s" % (recipe.pn, recipe_pv, + recipe_result['version'])) result_mutex.acquire() result[recipe] = recipe_result diff --git a/scripts/tools/rrs_upstream_history.py b/scripts/tools/rrs_upstream_history.py index 0678f3d..38a2c0f 100755 --- a/scripts/tools/rrs_upstream_history.py +++ b/scripts/tools/rrs_upstream_history.py @@ -88,14 +88,19 @@ def upstream_history(directory, logger): if ru.version == '': ru.status = 'U' # Unknown else: - cmp_ver = vercmp_string(row['Version'], ru.version) + try: + cmp_ver = vercmp_string(row['Version'], ru.version) + if cmp_ver == -1: + ru.status = 'N' # Not updated + elif cmp_ver == 0: + ru.status = 'Y' # Up-to-date + else: + ru.status = 'D' # Downgrade + except: + ru.status = 'U' + logger.error("vercmp_string: %s, %s - %s" % (row['PackageName'], + row['Version'], ru.version)) - if cmp_ver == -1: - ru.status = 'N' # Not updated - elif cmp_ver == 0: - ru.status = 'Y' # Up-to-date - else: - ru.status = 'D' # Downgrade ru.type = 'A' # Automatic ru.no_update_reason = row['NoUpgradeReason'] ru.date = ru.history.end_date