From 582436727949a2550b9b34e9f7ca43b0d0326737c5cdff6461756201e55c9abd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= Date: Fri, 1 Sep 2017 12:43:05 +0000 Subject: [PATCH] Accepting request 520159 from home:cbosdonnat:branches:Virtualization - Distro detection: also use ID_LIKE to catch suse distros add patch: suse_release.patch OBS-URL: https://build.opensuse.org/request/show/520159 OBS-URL: https://build.opensuse.org/package/show/Virtualization/supermin?expand=0&rev=38 --- supermin.changes | 6 ++++ supermin.spec | 3 ++ suse_release.patch | 69 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 suse_release.patch diff --git a/supermin.changes b/supermin.changes index f0fa8e7..7c35473 100644 --- a/supermin.changes +++ b/supermin.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Aug 31 14:09:58 UTC 2017 - cbosdonnat@suse.com + +- Distro detection: also use ID_LIKE to catch suse distros + add patch: suse_release.patch + ------------------------------------------------------------------- Thu Jul 13 14:17:07 UTC 2017 - cbosdonnat@suse.com diff --git a/supermin.spec b/supermin.spec index f7b3a12..02f170c 100644 --- a/supermin.spec +++ b/supermin.spec @@ -30,6 +30,8 @@ Requires: xmlstarlet Requires: zypper BuildRoot: %{_tmppath}/%{name}-%{version}-build Source0: supermin-%{version}.tar.xz +# Pending upstream review +Patch0: suse_release.patch %if "%{?_ignore_exclusive_arch}" == "" ExclusiveArch: x86_64 ppc64 ppc64le s390x aarch64 %endif @@ -59,6 +61,7 @@ you need to boot one of them. %prep %setup -q +%patch0 -p1 %build export ZYPPER=zypper diff --git a/suse_release.patch b/suse_release.patch new file mode 100644 index 0000000..07c6c06 --- /dev/null +++ b/suse_release.patch @@ -0,0 +1,69 @@ +Index: supermin-5.1.18/src/os_release.ml +=================================================================== +--- supermin-5.1.18.orig/src/os_release.ml ++++ supermin-5.1.18/src/os_release.ml +@@ -29,6 +29,7 @@ let split sep str = + + type os_release = { + id : string; ++ id_like : string list; + } + + let data = ref None +@@ -52,6 +53,7 @@ and parse () = + let lines = List.filter (fun s -> s.[0] <> '#') lines in + + let id = ref "" in ++ let id_like = ref [] in + + List.iter ( + fun line -> +@@ -65,10 +67,11 @@ and parse () = + else value in + match field with + | "ID" -> id := value ++ | "ID_LIKE" -> id_like := string_split " " value + | _ -> () + ) lines; + +- Some { id = !id; } ++ Some { id = !id; id_like = !id_like } + ) else + None + +@@ -76,3 +79,8 @@ let get_id () = + match get_data () with + | None -> "" + | Some d -> d.id ++ ++let get_id_like () = ++ match get_data () with ++ | None -> [] ++ | Some d -> d.id_like +Index: supermin-5.1.18/src/os_release.mli +=================================================================== +--- supermin-5.1.18.orig/src/os_release.mli ++++ supermin-5.1.18/src/os_release.mli +@@ -24,3 +24,10 @@ val get_id : unit -> string + + An empty string is returned if the file does not exist or cannot + be read. *) ++ ++val get_id_like : unit -> string list ++(** Get the value of the "ID_LIKE" field from the /etc/os-release file ++ on the current system. ++ ++ An empty list is returned if the file does not exist, cannot ++ be read or the ID_LIKE field is not defined. *) +Index: supermin-5.1.18/src/ph_rpm.ml +=================================================================== +--- supermin-5.1.18.orig/src/ph_rpm.ml ++++ supermin-5.1.18/src/ph_rpm.ml +@@ -41,6 +41,7 @@ let opensuse_detect () = + Config.rpm <> "no" && Config.rpm2cpio <> "no" && rpm_is_available () && + Config.zypper <> "no" && + (List.mem (Os_release.get_id ()) [ "opensuse"; "sled"; "sles" ] || ++ List.mem "suse" (Os_release.get_id_like ()) || + try (stat "/etc/SuSE-release").st_kind = S_REG with Unix_error _ -> false) + + let mageia_detect () =