diff --git a/lineage-updater b/lineage-updater index 417a9d8..fc81ae4 100755 --- a/lineage-updater +++ b/lineage-updater @@ -165,6 +165,11 @@ def find_roms(device=None, buildtype=None, incremental=None): cf.close() cf = None + try: + req_incr_stamp = incremental_stamp(incremental) + except Exception as e: + raise RuntimeError("Failed to parse request incremental field: %s" % (e)) + roms = [] for k, v in cache.items(): try: @@ -177,24 +182,20 @@ def find_roms(device=None, buildtype=None, incremental=None): continue if buildtype and props['buildtype'] != buildtype: continue - if incremental: - if 'incrbase' in props: - # Incremental - if incremental != props['incrbase']: - continue - else: - # Full - try: - req_incr_stamp = incremental_stamp(incremental) - except ValueError: - continue - try: - ota_incr_stamp = incremental_stamp(props['incremental']) - except ValueError: - dbg("Failed to parse cache incremental field") - continue - if ota_incr_stamp <= req_incr_stamp: - continue + + try: + ota_incr_stamp = incremental_stamp(props['incremental']) + except ValueError: + dbg("Failed to parse cache incremental field") + continue + + if 'incrbase' in props: + # Incremental + if incremental != props['incrbase']: + continue + + if ota_incr_stamp <= req_incr_stamp: + continue roms.append(v)