Displaying 20 results from an estimated 41 matches for "sort_uniq".
2015 Nov 17
0
[PATCH 1/3] mllib: Add sort_uniq function.
...ault x ys
+let uniq ?(cmp = Pervasives.compare) xs =
+ let rec loop acc = function
+ | [] -> acc
+ | [x] -> x :: acc
+ | x :: (y :: _ as xs) when cmp x y = 0 ->
+ loop acc xs
+ | x :: (y :: _ as xs) ->
+ loop (x :: acc) xs
+ in
+ List.rev (loop [] xs)
+
+let sort_uniq ?(cmp = Pervasives.compare) xs =
+ let xs = List.sort cmp xs in
+ let xs = uniq ~cmp xs in
+ xs
+
let may f = function
| None -> ()
| Some x -> f x
diff --git a/mllib/common_utils.mli b/mllib/common_utils.mli
index 44b8c93..68f7988 100644
--- a/mllib/common_utils.mli
+++ b/mllib/com...
2016 Sep 09
2
[PATCH] v2v: utils: Replace "remove_duplicates" function with call to sort_uniq.
...bootloaders.ml b/v2v/linux_bootloaders.ml
index a5e4c8d..7c48480 100644
--- a/v2v/linux_bootloaders.ml
+++ b/v2v/linux_bootloaders.ml
@@ -76,7 +76,7 @@ object
let paths = Array.to_list paths in
(* Remove duplicates. *)
- let paths = remove_duplicates paths in
+ let paths = sort_uniq paths in
(* Get the default kernel from grub if it's set. *)
let default =
diff --git a/v2v/utils.ml b/v2v/utils.ml
index ec69abb..6e68583 100644
--- a/v2v/utils.ml
+++ b/v2v/utils.ml
@@ -79,15 +79,6 @@ let compare_app2_versions app1 app2 =
compare_version app1.Guestfs.ap...
2016 Sep 09
0
Re: [PATCH] v2v: utils: Replace "remove_duplicates" function with call to sort_uniq.
On Friday, 9 September 2016 15:33:20 CEST Richard W.M. Jones wrote:
> ---
> v2v/linux_bootloaders.ml | 2 +-
> v2v/utils.ml | 9 ---------
> v2v/utils.mli | 3 ---
> 3 files changed, 1 insertion(+), 13 deletions(-)
Hm this may change the order of the grub1 kernels though. Also the
sorting done with a simple string comparison function will not always
produce
2012 Feb 11
1
[PATCH] Eliminate duplicate entries from package list
...src/febootstrap_debian.ml
index 8d0f75f..d1ee8ab 100644
--- a/src/febootstrap_debian.ml
+++ b/src/febootstrap_debian.ml
@@ -53,7 +53,7 @@ let rec debian_resolve_dependencies_and_download names =
if Config.apt_cache_depends_recurse_broken then
workaround_broken_apt_cache_depends_recurse (sort_uniq pkgs)
else
- pkgs in
+ sort_uniq pkgs in
(* Exclude packages matching [--exclude] regexps on the command line. *)
let pkgs =
--
1.7.9
2016 Sep 23
2
[PATCH 1/2] mllib: move remove_duplicates from v2v
...++++++
v2v/utils.ml | 9 ---------
v2v/utils.mli | 3 ---
4 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml
index 81d8202..78618f5 100644
--- a/mllib/common_utils.ml
+++ b/mllib/common_utils.ml
@@ -297,6 +297,15 @@ let sort_uniq ?(cmp = Pervasives.compare) xs =
let xs = uniq ~cmp xs in
xs
+let remove_duplicates xs =
+ let h = Hashtbl.create (List.length xs) in
+ let rec loop = function
+ | [] -> []
+ | x :: xs when Hashtbl.mem h x -> xs
+ | x :: xs -> Hashtbl.add h x true; x :: loop xs
+ in
+...
2016 Jul 07
0
[PATCH v3 4/8] mllib: Add some imperative list manipulation functions.
...| 20 ++++++++++++++++++++
mllib/common_utils.mli | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+)
diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml
index 77b9acd..40a19bc 100644
--- a/mllib/common_utils.ml
+++ b/mllib/common_utils.ml
@@ -282,6 +282,26 @@ let sort_uniq ?(cmp = Pervasives.compare) xs =
let xs = uniq ~cmp xs in
xs
+let push xsp x = xsp := !xsp @ [x]
+let unshift x xsp = xsp := x :: !xsp
+let pop xsp =
+ let x, xs =
+ match List.rev !xsp with
+ | x :: xs -> x, xs
+ | [] -> failwith "pop" in
+ xsp := List.rev xs;
+...
2017 Nov 21
2
[PATCH v3 0/2] common/mlstdutils: Extend the List module.
v2 -> v3:
- Renamed List.assoc_ -> List.assoc_lbl.
- Rebased on top of current master branch.
Rich.
2017 Oct 08
4
[PATCH 0/3] common/mlstdutils: Add Std_utils List and Option modules.
In Std_utils we already extend Char and String. These commits take it
a little further by extending List and adding a new Option submodule.
All basically simple refactoring.
Rich.
2017 Oct 08
7
[[PATCH v2 0/4] common/mlstdutils: Add Std_utils List and Option modules.
This time including the first commit ...
2018 Aug 10
2
[PATCH] Change wording from "twice" to "more than once" in error messages
...b/v2v/input_libvirt_vddk.ml
@@ -87,7 +87,7 @@ let parse_input_options options =
(key, value)
) options in
- (* Check no option appears twice. *)
+ (* Check no option appears more than once. *)
let keys = List.map fst options in
if List.length keys <> List.length (List.sort_uniq keys) then
error (f_"-it vddk: duplicate -io options on the command line");
diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml
index 6260eaac5..2bff35029 100644
--- a/v2v/output_rhv_upload.ml
+++ b/v2v/output_rhv_upload.ml
@@ -53,11 +53,11 @@ let parse_output_options op...
2015 Oct 13
6
[PATCH 0/4] rpm: Choose providers better (RHBZ#1266918).
Fix for
https://bugzilla.redhat.com/show_bug.cgi?id=1266918
2015 Oct 13
0
[PATCH 4/4] rpm: Choose providers better (RHBZ#1266918).
...try
+ (* 'providers' here is an array of just package names. *)
+ let providers = rpm_pkg_whatprovides (get_rpm ()) req in
+ let providers = Array.to_list providers in
+ (* --whatprovides will return duplicate identical packages, so: *)
+ let providers = sort_uniq providers in
+ match providers with
+ | [] -> None
+ | [name] -> Some name
+ | names ->
+ if !settings.debug >= 2 then
+ printf "supermin: rpm: multiple providers: requirement %s: providers: %s\n"
+ req (Stri...
2015 Oct 13
1
[PATCH v2] rpm: Choose providers better (RHBZ#1266918).
This is v2 of the 4/4 patch from the original series.
Changes:
- memoize the function this time
- check packages are installed using rpm_package_of_string
However I didn't combine the two case together, because the code is a
bit simpler with them separate.
Rich.
2019 Aug 13
0
[PATCH libnbd 1/6] generator: Share single list of all Closures.
...typedefs () =
- let all_cls =
- List.map (
- fun (_, { args }) ->
- filter_map (function Closure cl -> Some cl | _ -> None) args
- ) handle_calls in
- let all_cls = List.flatten all_cls in
- let cmp { cbname = n1 } { cbname = n2 } = compare n1 n2 in
- let unique_cls = sort_uniq ~cmp all_cls in
List.iter (
fun { cbname; cbargs } ->
pr "typedef int (*nbd_%s_callback) " cbname;
print_cbarg_list cbargs;
pr ";\n";
- ) unique_cls;
+ ) all_closures;
pr "\n"
let print_extern_and_define name args optargs ret =
-...
2016 Aug 18
3
[PATCH v2 0/2] v2v: Use OVMF secure boot file (RHBZ#1367615).
First version was posted here:
https://www.redhat.com/archives/libguestfs/2016-August/thread.html#00100
This is semantically the same as the first version. However
I've split the patch up into two parts. In the first part,
I factor out the UEFI paths so now they are created by the
generator and written in the library and v2v/ directory directly,
instead of the complex business of having a C
2019 Aug 03
1
[PATCH libnbd] generator: Generate typedefs automatically for Closure arguments.
...; acc
+ | [x] -> x :: acc
+ | x :: (y :: _ as xs) when cmp x y = 0 ->
+ loop acc xs
+ | x :: (y :: _ as xs) ->
+ loop (x :: acc) xs
+ in
+ List.rev (loop [] xs)
+
+(* This is present in OCaml 4.04, so we can remove it when
+ * we depend on OCaml >= 4.04.
+ *)
+let sort_uniq ?(cmp = Pervasives.compare) xs =
+ let xs = List.sort cmp xs in
+ let xs = uniq ~cmp xs in
+ xs
+
let chan = ref Pervasives.stdout
let pr fs = ksprintf (fun str -> output_string !chan str) fs
@@ -3100,6 +3119,30 @@ let () =
name
) handle_calls;
+ (* Closures mu...
2016 Mar 11
6
[PATCH v3 0/5] v2v: more control over device types
The decision on which device type to use for disks, network and video
cards on output used to be taken deep inside the converting functions.
This is not always desirable. In particular, there are scenarios when
this decision is made before the convertion takes place. E.g. in
in-place mode, the decisions are taken and the output VM configuration
is created outside of v2v tool.
This patchset
2015 Nov 17
8
[PATCH 0/3] v2v: windows: Use '*.inf' files to control how Windows drivers are installed.
https://github.com/rwmjones/libguestfs/tree/rewrite-virtio-copy-drivers
Instead of trying to split and parse elements from virtio-win paths,
use the '*.inf' files supplied with the drivers to control how Windows
drivers are installed.
The following emails best explain how this works:
https://www.redhat.com/archives/libguestfs/2015-October/msg00352.html
2016 Mar 18
10
[PATCH v4 0/5] v2v: more control over device types
The decision on which device type to use for disks, network and video
cards on output used to be taken deep inside the converting functions.
This is not always desirable. In particular, there are scenarios when
this decision is made before the convertion takes place. E.g. in
in-place mode, the decisions are taken and the output VM configuration
is created outside of v2v tool.
This patchset
2017 Jun 15
0
[PATCH v6 04/41] mllib: Split ‘Common_utils’ into ‘Std_utils’ + ‘Common_utils’.
...ault x ys
+
+let uniq ?(cmp = Pervasives.compare) xs =
+ let rec loop acc = function
+ | [] -> acc
+ | [x] -> x :: acc
+ | x :: (y :: _ as xs) when cmp x y = 0 ->
+ loop acc xs
+ | x :: (y :: _ as xs) ->
+ loop (x :: acc) xs
+ in
+ List.rev (loop [] xs)
+
+let sort_uniq ?(cmp = Pervasives.compare) xs =
+ let xs = List.sort cmp xs in
+ let xs = uniq ~cmp xs in
+ xs
+
+let remove_duplicates xs =
+ let h = Hashtbl.create (List.length xs) in
+ let rec loop = function
+ | [] -> []
+ | x :: xs when Hashtbl.mem h x -> xs
+ | x :: xs -> Hashtbl.add...