From 3b63697176dcdc183d960a4a768450ea9f938896 Mon Sep 17 00:00:00 2001 From: cproudlock Date: Thu, 23 Jul 2026 10:54:35 -0400 Subject: [PATCH] download-drivers: compare BIOS versions numerically, not as strings parse_bios_catalog kept the 'latest' BIOS per model with a string compare, so e.g. '1.20.1' > '1.9.0' was False and it wrongly retained the older 1.9.0. Added _ver_tuple() and compare tuples of ints so the genuinely newest firmware wins. --- scripts/download-drivers.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/download-drivers.py b/scripts/download-drivers.py index 1005e80..5b97978 100755 --- a/scripts/download-drivers.py +++ b/scripts/download-drivers.py @@ -155,6 +155,14 @@ def parse_driver_catalog(xml_path, os_filter=None): return packs +def _ver_tuple(v): + """Version string -> tuple of ints for numeric compare ('1.20.1' -> (1,20,1)).""" + try: + return tuple(int(x) for x in str(v).split(".")) + except (ValueError, AttributeError): + return (0,) + + def parse_bios_catalog(xml_path, model_names): """Parse DellSDPCatalogPC.xml → list of latest BIOS update dicts for given models.""" tree = ET.parse(xml_path) @@ -199,9 +207,11 @@ def parse_bios_catalog(xml_path, model_names): "model": matched_model, } - # Keep latest version per model + # Keep latest version per model. Compare numerically (tuple of ints), + # not as strings - "1.20.1" > "1.9.0" is False as a string compare, + # which would wrongly keep the older 1.9.0 BIOS. key = matched_model - if key not in bios or version > bios[key]["version"]: + if key not in bios or _ver_tuple(version) > _ver_tuple(bios[key]["version"]): bios[key] = entry return list(bios.values())