search for: is_suffix

Displaying 20 results from an estimated 65 matches for "is_suffix".

2016 Nov 01
3
[PATCH v3] v2v: bootloaders: search grub config for all distributions
...et elems = [ @@ -333,34 +341,42 @@ object (self) ignore (g#command [| grub2_mkconfig_cmd; "-o"; grub_config |]) end +(* We can determine if the bootloader config file is grub 1 or + * grub 2 just by looking at the filename. + *) +let bootloader_type_of_filename path = + if String.is_suffix path "/grub.cfg" then + Some Grub2 + else if String.is_suffix path "/grub.conf" || + String.is_suffix path "/menu.lst" then + Some Grub1 + else + None + +(* Where to start searching for bootloaders. *) +let bootloader_mountpoint = function + | { i_...
2016 Nov 01
0
Re: [PATCH v3] v2v: bootloaders: search grub config for all distributions
...t (self) > ignore (g#command [| grub2_mkconfig_cmd; "-o"; grub_config |]) > end > > +(* We can determine if the bootloader config file is grub 1 or > + * grub 2 just by looking at the filename. > + *) > +let bootloader_type_of_filename path = > + if String.is_suffix path "/grub.cfg" then > + Some Grub2 > + else if String.is_suffix path "/grub.conf" || > + String.is_suffix path "/menu.lst" then > + Some Grub1 > + else > + None Our String.is_suffix is a does String.sub every time, so this is a...
2015 Oct 06
0
[PATCH 5/5] mllib: Replace various ad hoc string_* functions with String.*
This is just a straight refactoring. Various ad hoc string_* functions that appeared in Common_utils have been renamed and placed in the String.* namespace. The old vs "new" functions are: string_prefix -> String.is_prefix string_suffix -> String.is_suffix string_find -> String.find replace_str -> String.replace string_nsplit -> String.nsplit string_split -> String.split string_lines_split -> String.lines_split string_random8 -> String.random8 --- builder/checksums.ml | 2 +- builder/downloader.ml...
2020 Sep 23
0
[v2v PATCH 3/3] linux: remove special handling of packages with no files
...uot;; "/" ^ f ^ ".ko"; "/" ^ f ^ ".ko.xz" ] - ) candidates - ) in - let candidate = - try - List.find ( - fun m -> - List.exists (String.is_suffix m) all_candidates - ) modules - with Not_found -> - (* No known module found, pick an arbitrary one - * (the first). - *) - List.hd modules in - let candidate = modpath ^ can...
2020 Sep 23
3
[v2v PATCH 1/3] linux: remove warning for packages with no files
Metapackages are valid packages with no files, used to easily install something without manually installing bits. This is the case of the "kernel" package in Fedora/RHEL/etc in the last couple of years. --- v2v/linux_kernels.ml | 1 - 1 file changed, 1 deletion(-) diff --git a/v2v/linux_kernels.ml b/v2v/linux_kernels.ml index 9a41225a..78c1ee59 100644 --- a/v2v/linux_kernels.ml +++
2016 Dec 14
1
Re: [PATCH v2 3/4] sysprep: Add a new operation to remove editor backup files (RHBZ#1401320).
...ow. Also, should this operation include also the swap files that editors can leave while editing? > + let fses = > + match g#inspect_get_type root with > + | "hurd" > + | "linux" > + | "minix" -> unix_whitelist > + | f when String.is_suffix f "bsd" -> unix_whitelist > + | _ -> ["/"] in There's a similar list also in customize/customize_run.ml for the `SSHInject operation -- I guess an helper function could be added to Common_utils. > + List.iter ( > + fun fs -> > + if g#is_dir...
2015 Oct 06
10
[PATCH 0/5] mllib: Hide bad String functions and miscellaneous refactoring.
Hide/prevent the use of bad string functions like String.lowercase. These are replaced by safe functions that won't break UTF-8 strings. Other miscellaneous refactoring. Rich.
2017 Jun 15
0
[PATCH v6 04/41] mllib: Split ‘Common_utils’ into ‘Std_utils’ + ‘Common_utils’.
...let capitalize_ascii s = + let b = Bytes.of_string s in + Bytes.unsafe_set b 0 (Char.uppercase_ascii (Bytes.unsafe_get b 0)); + Bytes.to_string b + + let is_prefix str prefix = + let n = length prefix in + length str >= n && sub str 0 n = prefix + + let is_suffix str suffix = + let sufflen = length suffix + and len = length str in + len >= sufflen && sub str (len - sufflen) sufflen = suffix + + let rec find s sub = + let len = length s in + let sublen = length sub in + let rec loop i = + if i <= len-subl...
2015 Oct 07
1
Re: [PATCH 5/5] mllib: Replace various ad hoc string_* functions with String.*
...: > This is just a straight refactoring. Various ad hoc string_* > functions that appeared in Common_utils have been renamed and placed > in the String.* namespace. The old vs "new" functions are: > > string_prefix -> String.is_prefix > string_suffix -> String.is_suffix > string_find -> String.find > replace_str -> String.replace > string_nsplit -> String.nsplit > string_split -> String.split > string_lines_split -> String.lines_split > string_random8 -> String.random8 > --- As mentioned yesterday on IRC, I'm to...
2016 Jun 16
1
[PATCH] mllib: Add isspace, triml, trimr and trim functions.
...blen = length sub in diff --git a/mllib/common_utils.mli b/mllib/common_utils.mli index 5b0b9bb..a04a784 100644 --- a/mllib/common_utils.mli +++ b/mllib/common_utils.mli @@ -56,6 +56,14 @@ module String : sig (** [is_prefix str prefix] returns true if [prefix] is a prefix of [str]. *) val is_suffix : string -> string -> bool (** [is_suffix str suffix] returns true if [suffix] is a suffix of [str]. *) + val isspace : char -> bool + (** Return true if char is a whitespace character. *) + val triml : ?test:(char -> bool) -> string -> string + (** Trim left. *)...
2020 Sep 22
2
[v2v PATCH 1/2] linux: split kernel packages filtering from processing
Split the processing of the kernel packages in two phases: - filtering only (by name) - actual processing This makes the filtering part easier to review/modify, and it is now much easier to see (in the debug log) which packages are processed as kernel packages. There are no behaviour changes (other than an additional debug message). --- v2v/linux_kernels.ml | 20 +++++++++++++------- 1 file
2019 Mar 20
1
[PATCH] v2v: linux: improve archtecture detection from modules (RHBZ#1690574)
...uot;; "/" ^ f ^ ".ko"; "/" ^ f ^ ".ko.xz" ] + ) candidates + ) in + let candidate = + try + List.find ( + fun m -> + List.exists (String.is_suffix m) all_candidates + ) modules + with Not_found -> + (* No known module found, pick an arbitrary one + * (the first). + *) + List.hd modules in + let candidate = modpath ^ can...
2020 Jan 22
3
[PATCH 1/1] sparsify: support LUKS-encrypted partitions
...@ let rec list_filesystems () = (* Devices. *) let devices = Devsparts.list_devices () in + let devices = List.filter is_not_partitioned_device devices in let ret = List.filter_map check_with_vfs_type devices in @@ -144,9 +146,20 @@ and check_with_vfs_type device = else if String.is_suffix vfs_type "_member" then None - (* Ignore LUKS-encrypted partitions. These are also containers, as above. *) - else if vfs_type = "crypto_LUKS" then - None + (* If a LUKS-encrypted partition had been opened, include the corresponding + * device mapper filesystem p...
2016 Sep 09
0
[PATCH] v2v: linux: Move kernel detection to a separate module.
...em "virtio_net" modules in - let is_xen_kernel = List.mem "xennet" modules in - - (* If the package name is like "kernel-debug", then it's - * a debug kernel. - *) - let is_debug = - String.is_suffix app.G.app2_name "-debug" || - String.is_suffix app.G.app2_name "-dbg" in - - Some { - ki_app = app; - ki_name = name; - ki_version = version; - ki_arch = arch; - ki_vmlinuz = vmlinuz...
2016 Sep 09
2
[PATCH] v2v: linux: Move kernel detection to a separate module.
This is a sort of follow-up to the Linux_bootloaders patch. It turns out all the kernel detection code is nicely self- contained and can therefore be moved to its own module. Rich.
2020 Jan 21
12
[PATCH 0/1] WIP: Support LUKS-encrypted partitions
The following patch attempts to implement sparsification of LUKS-encrypted partitions. It uses lsblk to pair the underlying LUKS block device with its mapped name. Also, --allow-discards was added by default to luks_open(). There are several potential issues that I can think of: 1) If and entire device is encrypted (not just one of more partitions), the lsblk trick might not work. 2) The
2019 Mar 26
0
[PATCH 2/3] v2v: try to pick the right arch for qemu-ga pkgs
...re_string inspect in + let pkg_ext = Linux.binary_package_extension inspect in + let package_suffixes = [ + sprintf ".%s.%s" pkg_arch pkg_ext; + sprintf "_%s.%s" pkg_arch pkg_ext; + ] in + let package_filter path _ = + List.exists (String.is_suffix path) package_suffixes + in debug "locating packages in %s" src_path; let packages = copy_from_virtio_win g inspect src_path dst_path - (fun _ _ -> true) + package_filter (...
2020 Jan 21
0
[PATCH 1/1] WIP: sparsify: Support LUKS-encrypted partitions
...@ let rec list_filesystems () = (* Devices. *) let devices = Devsparts.list_devices () in + let devices = List.filter is_not_partitioned_device devices in let ret = List.filter_map check_with_vfs_type devices in @@ -144,9 +146,19 @@ and check_with_vfs_type device = else if String.is_suffix vfs_type "_member" then None - (* Ignore LUKS-encrypted partitions. These are also containers, as above. *) - else if vfs_type = "crypto_LUKS" then - None + (* If a LUKS-encrypted partition had been opened, include the corresponding + * device mapper filesystem p...
2020 Jan 22
0
Re: [PATCH 1/1] sparsify: support LUKS-encrypted partitions
...vsparts.list_devices () in > + Did you mean to add a blank line here? > let devices = List.filter is_not_partitioned_device devices in > let ret = List.filter_map check_with_vfs_type devices in > > @@ -144,9 +146,20 @@ and check_with_vfs_type device = > else if String.is_suffix vfs_type "_member" then > None > > - (* Ignore LUKS-encrypted partitions. These are also containers, as above. *) > - else if vfs_type = "crypto_LUKS" then > - None > + (* If a LUKS-encrypted partition had been opened, include the corresponding &g...
2020 Sep 22
0
[v2v PATCH 2/2] linux: ignore -devel kernel packages
...kernels (g : G.guestfs) inspect family bootloader = let kernel_pkgs = List.filter ( fun { G.app2_name = name } -> name = "kernel" - || String.is_prefix name "kernel-" + || (String.is_prefix name "kernel-" && not (String.is_suffix name "-devel")) || String.is_prefix name "linux-image-" ) inspect.i_apps in if verbose () then ( -- 2.26.2