| FInteger -> "int"
| FString width -> sprintf "char[%d]" width
+let file_exists name =
+ try Unix.access name [Unix.F_OK]; true
+ with Unix.Unix_error _ -> false
+
(* Regular expressions. We really really should use ocaml-mikmatch ... *)
let re_oldformat = Pcre.regexp "^RPM: \\d+: \\(build \\d+\\) ([-\\w]+) ([\\w.]+) ([\\w.]+) \\(.*?\\) (\\w+)"
let re_keyvalue = Pcre.regexp "^(\\w+): (.*)"
basename = basename; arch = arch;
kernel_version = version }
) infos in
+
+ (* Check the .data, .data.gz or .data.bz2 file exists, and skip with
+ * a warning if not.
+ *)
+ let infos = List.filter (
+ fun { basename = basename } ->
+ if not (file_exists (basename ^ ".data")) &&
+ not (file_exists (basename ^ ".data.gz")) &&
+ not (file_exists (basename ^ ".data.bz2")) then (
+ eprintf "warning: %s: no data file found for this kernel - skipping\n%!"
+ basename;
+ false
+ )
+ else
+ true
+ ) infos in
+
infos
(* XXX This would be better as a proper lex/yacc parser.
) struct_names;
(* Now read the data file and parse out the structures of interest. *)
- let file_exists name =
- try Unix.access name [Unix.F_OK]; true
- with Unix.Unix_error _ -> false
- in
let close_process_in cmd chan =
match Unix.close_process_in chan with
| Unix.WEXITED 0 -> ()