Displaying 20 results from an estimated 26 matches for "osinfo_get_short_ids".
2017 Oct 09
1
Re: [PATCH v11 6/6] New tool: virt-builder-repository
...2 ""
This looks like you're subverting type safety. There shouldn't be any
case where SHA512 is an empty string. If you meant "I want to return
nothing from this function", then make the function return an option
type.
> +let osinfo_ids = ref None
> +
> +let osinfo_get_short_ids () =
> + match !osinfo_ids with
> + | Some ids -> ids
> + | None -> (
> + let set = ref StringSet.empty in
> + Osinfo.iterate_db (
> + fun filepath ->
> + let doc = Xml.parse_file filepath in
> + let xpathctx = Xml.xpath_new_context doc i...
2017 Nov 14
1
Re: [PATCH v12 3/3] New tool: virt-builder-repository
...ums_get_sha512 = function
| None -> None
| Some csums ->
let rec loop = function
| [] -> None
| Checksums.SHA512 csum :: _ -> Some csum
| _ :: rest -> loop rest
in
loop csums
> +let osinfo_ids = ref None
> +
> +let rec osinfo_get_short_ids () =
> + match !osinfo_ids with
> + | Some ids -> ids
> + | None ->
> + osinfo_ids :=
> + Some (
> + Osinfo.fold (
> + fun set filepath ->
> + let doc = Xml.parse_file filepath in
> + let xpathctx = Xml.xpath_new_c...
2017 Jan 03
0
[PATCH 5/5] Add a virt-builder-repository tool
...match (Str.regexp "^\\(.*[-._]\\)\\([0-9]+\\)$") s 0 then
+ let prefix = Str.matched_group 1 s in
+ let suffix = int_of_string (Str.matched_group 2 s) in
+ Utils.Rev_string (prefix ^ (string_of_int (suffix + 1)))
+ else
+ Utils.Rev_string (s ^ ".1")
+
+let osinfo_get_short_ids () =
+ let get_ids xpathctx =
+ xpath_string_default xpathctx "/libosinfo/os/short-id" "" in
+
+ let ids = Osinfo.osinfo_read_db get_ids in
+ List.filter (fun id -> id <> "") ids
+
+let main () =
+ let cmdline = parse_cmdline () in
+
+ (* If debugging,...
2017 Nov 13
0
[PATCH v12 3/3] New tool: virt-builder-repository
...+let checksums_get_sha512 = function
+ | None -> None
+ | Some csums ->
+ try
+ Some (List.find (
+ function
+ | Checksums.SHA512 _ -> true
+ | _ -> false
+ ) csums)
+ with Not_found -> None
+
+let osinfo_ids = ref None
+
+let rec osinfo_get_short_ids () =
+ match !osinfo_ids with
+ | Some ids -> ids
+ | None ->
+ osinfo_ids :=
+ Some (
+ Osinfo.fold (
+ fun set filepath ->
+ let doc = Xml.parse_file filepath in
+ let xpathctx = Xml.xpath_new_context doc in
+ let nodes = xpath_...
2017 Mar 07
0
[PATCH v4 9/9] Add a virt-builder-repository tool
...*[-._]\\)\\([0-9]+\\)$") s 0 then
+ let prefix = Str.matched_group 1 s in
+ let suffix = int_of_string (Str.matched_group 2 s) in
+ Utils.Rev_string (prefix ^ (string_of_int (suffix + 1)))
+ else
+ Utils.Rev_string (s ^ ".1")
+
+let osinfo_ids = ref None
+
+let osinfo_get_short_ids () =
+ match !osinfo_ids with
+ | Some ids -> ids
+ | None -> (
+ let set = ref StringSet.empty in
+ let g = open_guestfs () in
+
+ Osinfo.read_osinfo_db g#ocaml_handle (
+ fun filepath ->
+ let doc = Xml.parse_file filepath in
+ let xpathctx = Xml.xpath_new_...
2017 Mar 23
0
[PATCH v5 10/10] Add a virt-builder-repository tool
...*[-._]\\)\\([0-9]+\\)$") s 0 then
+ let prefix = Str.matched_group 1 s in
+ let suffix = int_of_string (Str.matched_group 2 s) in
+ Utils.Rev_string (prefix ^ (string_of_int (suffix + 1)))
+ else
+ Utils.Rev_string (s ^ ".1")
+
+let osinfo_ids = ref None
+
+let osinfo_get_short_ids () =
+ match !osinfo_ids with
+ | Some ids -> ids
+ | None -> (
+ let set = ref StringSet.empty in
+ let g = open_guestfs () in
+
+ Osinfo.read_osinfo_db g#ocaml_handle (
+ fun filepath ->
+ let doc = Xml.parse_file filepath in
+ let xpathctx = Xml.xpath_new_...
2017 Feb 10
0
[PATCH v3 10/10] Add a virt-builder-repository tool
...*[-._]\\)\\([0-9]+\\)$") s 0 then
+ let prefix = Str.matched_group 1 s in
+ let suffix = int_of_string (Str.matched_group 2 s) in
+ Utils.Rev_string (prefix ^ (string_of_int (suffix + 1)))
+ else
+ Utils.Rev_string (s ^ ".1")
+
+let osinfo_ids = ref None
+
+let osinfo_get_short_ids () =
+ match !osinfo_ids with
+ | Some ids -> ids
+ | None -> (
+ let ids = ref [] in
+ let g = open_guestfs () in
+
+ Osinfo.read_osinfo_db g#ocaml_handle (
+ fun filepath ->
+ let doc = Xml.parse_file filepath in
+ let xpathctx = Xml.xpath_new_context doc i...
2017 Nov 13
6
[PATCH v12 0/3] virt-builder-repository tool
Hi there!
Here is the latest version of the series including Richard's comments.
I also reworked the repository_main.ml code to avoid setting an
empty entry if not found.
Cédric Bosdonnat (3):
builder: change arch type to distinguish guesses
builder: add a template parameter to get_index
New tool: virt-builder-repository
.gitignore | 4 +
2017 Apr 12
0
[PATCH v6 10/10] Add a virt-builder-repository tool
...List.find (
+ fun c ->
+ match c with
+ | Checksums.SHA512 _ -> true
+ | _ -> false
+ ) csums
+ with
+ | _ -> Checksums.SHA512 ""
+ )
+ | None -> Checksums.SHA512 ""
+
+let osinfo_ids = ref None
+
+let osinfo_get_short_ids () =
+ match !osinfo_ids with
+ | Some ids -> ids
+ | None -> (
+ let set = ref StringSet.empty in
+ let g = open_guestfs () in
+
+ Osinfo.read_osinfo_db g#ocaml_handle (
+ fun filepath ->
+ let doc = Xml.parse_file filepath in
+ let xpathctx = Xml.xpath_new_...
2017 Jun 19
0
[PATCH v7 9/9] Add a virt-builder-repository tool
...| None -> Checksums.SHA512 ""
+ | Some csums ->
+ try
+ List.find (
+ function
+ | Checksums.SHA512 _ -> true
+ | _ -> false
+ ) csums
+ with Not_found -> Checksums.SHA512 ""
+
+let osinfo_ids = ref None
+
+let osinfo_get_short_ids () =
+ match !osinfo_ids with
+ | Some ids -> ids
+ | None -> (
+ let set = ref StringSet.empty in
+ let g = open_guestfs () in
+
+ Osinfo.read_osinfo_db g#ocaml_handle (
+ fun filepath ->
+ let doc = Xml.parse_file filepath in
+ let xpathctx = Xml.xpath_new_...
2017 Sep 18
0
[PATCH v9 7/7] New tool: virt-builder-repository
...| None -> Checksums.SHA512 ""
+ | Some csums ->
+ try
+ List.find (
+ function
+ | Checksums.SHA512 _ -> true
+ | _ -> false
+ ) csums
+ with Not_found -> Checksums.SHA512 ""
+
+let osinfo_ids = ref None
+
+let osinfo_get_short_ids () =
+ match !osinfo_ids with
+ | Some ids -> ids
+ | None -> (
+ let set = ref StringSet.empty in
+ Osinfo.iterate_db (
+ fun filepath ->
+ let doc = Xml.parse_file filepath in
+ let xpathctx = Xml.xpath_new_context doc in
+ let nodes = xpath_get_nodes x...
2017 Oct 05
0
[PATCH v11 6/6] New tool: virt-builder-repository
...| None -> Checksums.SHA512 ""
+ | Some csums ->
+ try
+ List.find (
+ function
+ | Checksums.SHA512 _ -> true
+ | _ -> false
+ ) csums
+ with Not_found -> Checksums.SHA512 ""
+
+let osinfo_ids = ref None
+
+let osinfo_get_short_ids () =
+ match !osinfo_ids with
+ | Some ids -> ids
+ | None -> (
+ let set = ref StringSet.empty in
+ Osinfo.iterate_db (
+ fun filepath ->
+ let doc = Xml.parse_file filepath in
+ let xpathctx = Xml.xpath_new_context doc in
+ let nodes = xpath_get_nodes x...
2017 Sep 12
0
[PATCH v8 7/7] Add a virt-builder-repository tool
...| None -> Checksums.SHA512 ""
+ | Some csums ->
+ try
+ List.find (
+ function
+ | Checksums.SHA512 _ -> true
+ | _ -> false
+ ) csums
+ with Not_found -> Checksums.SHA512 ""
+
+let osinfo_ids = ref None
+
+let osinfo_get_short_ids () =
+ match !osinfo_ids with
+ | Some ids -> ids
+ | None -> (
+ let set = ref StringSet.empty in
+ Osinfo.iterate_db (
+ fun filepath ->
+ let doc = Xml.parse_file filepath in
+ let xpathctx = Xml.xpath_new_context doc in
+ let nodes = xpath_get_nodes x...
2017 Nov 21
5
[PATCH v13 0/3] virt-builder-repository
Hey there,
Here is an update of the series. The changes:
* Incorporate Richard's comments. Left out the with_openfile one
since that leads to a double close.
* Change the ask option return type to string (removing the option)
since if the use doesn't input anything we're using the default,
and the default is now a mandatory parameter.
* Make sure there are items in the
2017 Feb 10
15
[PATCH v3 00/10] Introducing virt-builder-repository
Hi guys,
Here is a v3 of the series, including changes to answer Richard's
comments.
Cédric Bosdonnat (10):
mllib: factorize code to add Checksum.get_checksum function
Move xml and xpath_helpers OCAML code to mllib
mllib: add Xml.parse_file helper
lib/osinfo.c: Extract xml processing into a callback
lib: extract osinfo DB traversing API
mllib: ocaml wrapper for lib/osinfo
2017 Oct 05
14
[PATCH v11 0/6] virt-builder-repository
Hi there,
This is an update of the series. Just to rebase it on top of
Rich's latest changes.
Cédric Bosdonnat (5):
builder: rename docs test script
builder: add a template parameter to get_index
builder: add Index.write_entry function
mllib: add XPath helper xpath_get_nodes()
New tool: virt-builder-repository
Pino Toscano (1):
builder: add simple OCaml osinfo-db reader
2017 Jan 03
13
[PATCH 0/5] Introducing virt-builder-repository
Hi all,
I wanted to provide an easy way to create or update a virt-builder
repository out of a folder of template disk image files. This is what
virt-builder-repository aims at. Some of the data are computed from
the image file, others are asked the user or extracted from an existing
index file.
So far, virt-builder-repository doesn't run libguestfs on each image
to extract the architecture,
2017 Mar 23
13
[PATCH v5 00/10] Introducing virt-builder-repository
Hi all,
Here is the v5 of my patches series applying the latest comments
from Pino.
Cédric Bosdonnat (10):
lib/osinfo.c: Extract xml processing into a callback
lib: extract osinfo DB traversing API
mllib: ocaml wrapper for lib/osinfo
builder: rename docs test script
builder: add a template parameter to get_index
builder: add Index.write_entry function
dib: move do_cp to
2017 Sep 20
6
[PATCH v10 0/6] virt-builder-repository
Hi all,
Diff to v9 includes the changes requested by Pino.
Cédric Bosdonnat (5):
builder: rename docs test script
builder: add a template parameter to get_index
builder: add Index.write_entry function
mllib: add XPath helper xpath_get_nodes()
New tool: virt-builder-repository
Pino Toscano (1):
builder: add simple OCaml osinfo-db reader
.gitignore
2017 Sep 18
11
[PATCH v9 0/7] virt-builder-repository
Hi there,
Diffs to v8:
* Remove the regex to increment the revision: Index_parser.get_entry()
only handles integers
* Fix Pino's comments
Cédric Bosdonnat (6):
builder: rename docs test script
builder: add a template parameter to get_index
builder: add Index.write_entry function
mllib: add XPath helper xpath_get_nodes()
builder: remove useless fish dependency
New tool: