[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-API] [PATCH] Fix parsing of the tools .iso filename
# HG changeset patch # User David Scott <dave.scott@xxxxxxxxxxxxx> # Date 1259253843 0 # Node ID c512a7857329c62e8ba44bc76e70f1068a0d1abb # Parent 6fd77ef2569ead1d2cbc5ca6a6d496519e966fc0 CA-35383: if the tools filename build number has a non-digit suffix, disregard it. XCP hosts currently have tools isos in /opt/xensource/packages/iso/xs-tools-<version>-<build><suffix>.iso where <build> is an integer and <suffix> is a string. Signed-off-by: David Scott <dave.scott@xxxxxxxxxxxxx> diff -r 6fd77ef2569e -r c512a7857329 ocaml/xapi/xapi_pv_driver_version.ml --- a/ocaml/xapi/xapi_pv_driver_version.ml Tue Nov 24 15:17:56 2009 +0000 +++ b/ocaml/xapi/xapi_pv_driver_version.ml Thu Nov 26 16:44:03 2009 +0000 @@ -43,7 +43,12 @@ match String.split '.' mid with | [ maj; min; mic_plus_build ] -> begin match String.split '-' mic_plus_build with - | [ mic; build ] -> int_of_string maj, int_of_string min, int_of_string mic, int_of_string build + | [ mic; build ] -> + (* Build numbers often have a non-digit suffix: remove this *) + let isdigit c = Char.code c >= (Char.code '0') && (Char.code c <= (Char.code '9')) in + let build = String.strip (fun c -> not (isdigit c)) build in + + int_of_string maj, int_of_string min, int_of_string mic, int_of_string build | [ mic ] -> int_of_string maj, int_of_string min, int_of_string mic, -1 | _ -> none (* never happens *) end 1 file changed, 6 insertions(+), 1 deletion(-) ocaml/xapi/xapi_pv_driver_version.ml | 7 ++++++- Attachment:
xen-api.hg.patch _______________________________________________ xen-api mailing list xen-api@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/mailman/listinfo/xen-api
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |