Hello community, here is the log from the commit of package supermin for openSUSE:Factory checked in at 2016-09-12 13:25:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/supermin (Old) and /work/SRC/openSUSE:Factory/.supermin.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "supermin" Changes: -------- --- /work/SRC/openSUSE:Factory/supermin/supermin.changes 2016-06-07 23:46:42.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.supermin.new/supermin.changes 2016-09-12 13:25:51.000000000 +0200 @@ -1,0 +2,8 @@ +Thu Sep 8 15:01:41 UTC 2016 - [email protected] + +- Remove use of SuSE-release and use os-release instead. (bsc#997936) + 0001-add_simple_handling_of_os-release.patch + 0002-use_os-release_to_detect_the_distro.patch + 0003-tests_use__etc_os-release_in_test-harder.patch + +------------------------------------------------------------------- New: ---- 0001-add_simple_handling_of_os-release.patch 0002-use_os-release_to_detect_the_distro.patch 0003-tests_use__etc_os-release_in_test-harder.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ supermin.spec ++++++ --- /var/tmp/diff_new_pack.r7Fxj7/_old 2016-09-12 13:25:52.000000000 +0200 +++ /var/tmp/diff_new_pack.r7Fxj7/_new 2016-09-12 13:25:52.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package supermin # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -30,6 +30,9 @@ Requires: zypper BuildRoot: %{_tmppath}/%{name}-%{version}-build Source0: supermin-%{version}.tar.xz +Patch0: 0001-add_simple_handling_of_os-release.patch +Patch1: 0002-use_os-release_to_detect_the_distro.patch +Patch2: 0003-tests_use__etc_os-release_in_test-harder.patch %if "%{?_ignore_exclusive_arch}" == "" ExclusiveArch: x86_64 ppc64 ppc64le s390x aarch64 %endif @@ -45,11 +48,11 @@ BuildRequires: ocaml-findlib BuildRequires: ocaml-rpm-macros >= 4.02.1 BuildRequires: pkg-config +BuildRequires: xz-devel +BuildRequires: zlib-devel BuildRequires: pkgconfig(com_err) BuildRequires: pkgconfig(ext2fs) BuildRequires: pkgconfig(rpm) -BuildRequires: xz-devel -BuildRequires: zlib-devel %description supermin is a tool for building supermin appliances. These are tiny @@ -59,6 +62,9 @@ %prep %setup -q +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 %build export ZYPPER=zypper ++++++ 0001-add_simple_handling_of_os-release.patch ++++++ >From [email protected] Wed Aug 31 13:20:03 2016 Return-Path: <[email protected]> Delivered-To: unknown Received: from gwmail.emea.novell.com (143.186.119.90:993) by laptop.vms with IMAP4-SSL; 31 Aug 2016 13:20:03 -0000 Received: from prv-mx.provo.novell.com (novprvlin0681.provo.novell.com [130.57.1.19]) by prv-mh.provo.novell.com with ESMTP (NOT encrypted); Wed, 31 Aug 2016 07:09:26 -0600 Received: from mx6-phx2.redhat.com (209.132.183.39) by prv-mx.provo.novell.com (130.57.1.10) GWAVA SMTP; Wed, 31 Aug 2016 07:10:12 -0600 X-Spam_ID: str=0001.0A010202.57C6D706.0196:SCFSTAT2484459,ss=1,re=-4.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 X-GWAVADAT: <keymat><rkey>gvWn3QsGV50RMxxr</rkey><gkey>9c16c207872a47573356cfe20b727ec6b327e3bac2a6eaa5ec59d5e9d6aa8342</gkey><objectid>17boib3.17boib3.v6</objectid></keymat> Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u7VD5h2P022390; Wed, 31 Aug 2016 09:05:44 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u7VD5gWQ007141 for <[email protected]>; Wed, 31 Aug 2016 09:05:42 -0400 Received: from thyrus.usersys.redhat.com (dhcp131-138.brq.redhat.com [10.34.131.138]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u7VD5eAY004091 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for <[email protected]>; Wed, 31 Aug 2016 09:05:42 -0400 From: Pino Toscano <[email protected]> To: [email protected] Date: Wed, 31 Aug 2016 15:05:35 +0200 Message-Id: <[email protected]> In-Reply-To: <[email protected]> References: <[email protected]> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-loop: [email protected] Subject: [Libguestfs] [PATCH 1/2] Add simple handling of /etc/os-release X-BeenThere: [email protected] X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Discussion and development of libguestfs <libguestfs.redhat.com> List-Unsubscribe: <https://www.redhat.com/mailman/options/libguestfs>, <mailto:[email protected]?subject=unsubscribe> List-Archive: <https://www.redhat.com/archives/libguestfs> List-Post: <mailto:[email protected]> List-Help: <mailto:[email protected]?subject=help> List-Subscribe: <https://www.redhat.com/mailman/listinfo/libguestfs>, <mailto:[email protected]?subject=subscribe> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: [email protected] Errors-To: [email protected] X-getmail-retrieved-from-mailbox: INBOX X-Evolution-Source: [email protected] Introduce a simple module to read and cache fields of /etc/os-release that might be needed, and there is only ID for now. --- src/Makefile.am | 3 +++ src/os_release.ml | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/os_release.mli | 26 ++++++++++++++++++ 3 files changed, 107 insertions(+) create mode 100644 src/os_release.ml create mode 100644 src/os_release.mli diff --git a/src/Makefile.am b/src/Makefile.am index 11adf31..767117f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -47,6 +47,8 @@ SOURCES = \ utils.ml \ utils.mli \ types.ml \ + os_release.ml \ + os_release.mli \ package_handler.ml \ package_handler.mli \ rpm.ml \ @@ -71,6 +73,7 @@ SOURCES_ML = \ config.ml \ utils.ml \ types.ml \ + os_release.ml \ package_handler.ml \ rpm.ml \ dpkg.ml \ diff --git a/src/os_release.ml b/src/os_release.ml new file mode 100644 index 0000000..b2de259 --- /dev/null +++ b/src/os_release.ml @@ -0,0 +1,78 @@ +(* supermin 5 + * Copyright (C) 2016 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +open Utils + +let split sep str = + let len = String.length sep in + let seplen = String.length str in + let i = find str sep in + if i = -1 then str, "" + else ( + String.sub str 0 i, String.sub str (i + len) (seplen - i - len) + ) + +type os_release = { + id : string; +} + +let data = ref None +let parsed = ref false + +let rec get_data () = + if !parsed = false then ( + data := parse (); + parsed := true; + ); + + !data + +and parse () = + let file = "/etc/os-release" in + if Sys.file_exists file then ( + let chan = open_in file in + let lines = input_all_lines chan in + close_in chan; + let lines = List.filter ((<>) "") lines in + let lines = List.filter (fun s -> s.[0] <> '#') lines in + + let id = ref "" in + + List.iter ( + fun line -> + let field, value = split "=" line in + let value = + let len = String.length value in + if len > 1 && + ((value.[0] = '"' && value.[len-1] = '"') || + (value.[0] = '\'' && value.[len-1] = '\'')) then + String.sub value 1 (len - 2) + else value in + match field with + | "ID" -> id := value + | _ -> () + ) lines; + + Some { id = !id; } + ) else + None + +let get_id () = + match get_data () with + | None -> "" + | Some d -> d.id diff --git a/src/os_release.mli b/src/os_release.mli new file mode 100644 index 0000000..2ae349b --- /dev/null +++ b/src/os_release.mli @@ -0,0 +1,26 @@ +(* supermin 5 + * Copyright (C) 2016 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +(** Handling of /etc/os-release. *) + +val get_id : unit -> string +(** Get the value of the "ID" field from the /etc/os-release file + on the current system. + + An empty string is returned if the file does not exist or cannot + be read. *) -- 2.7.4 _______________________________________________ Libguestfs mailing list [email protected] https://www.redhat.com/mailman/listinfo/libguestfs ++++++ 0002-use_os-release_to_detect_the_distro.patch ++++++ >From [email protected] Wed Aug 31 13:10:02 2016 From: Pino Toscano <[email protected]> To: [email protected] Date: Wed, 31 Aug 2016 15:05:36 +0200 Message-Id: <[email protected]> In-Reply-To: <[email protected]> References: <[email protected]> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-loop: [email protected] Subject: [Libguestfs] [PATCH 2/2] Use os-release to detect the distro X-BeenThere: [email protected] X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Discussion and development of libguestfs <libguestfs.redhat.com> List-Unsubscribe: <https://www.redhat.com/mailman/options/libguestfs>, <mailto:[email protected]?subject=unsubscribe> List-Archive: <https://www.redhat.com/archives/libguestfs> List-Post: <mailto:[email protected]> List-Help: <mailto:[email protected]?subject=help> List-Subscribe: <https://www.redhat.com/mailman/listinfo/libguestfs>, <mailto:[email protected]?subject=subscribe> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: [email protected] Errors-To: [email protected] X-getmail-retrieved-from-mailbox: INBOX X-Evolution-Source: [email protected] Check the ID field in /etc/os-release on the current system, before checking for the other old-style release-/version-like files in /etc. Some distributions (openSUSE Thumbleweed) are starting to remove them, breaking the supermin detection. --- src/dpkg.ml | 3 ++- src/pacman.ml | 5 +++-- src/rpm.ml | 15 +++++++++------ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/dpkg.ml b/src/dpkg.ml index 70acfa2..1e785de 100644 --- a/src/dpkg.ml +++ b/src/dpkg.ml @@ -28,7 +28,8 @@ let dpkg_detect () = Config.dpkg_query <> "no" && Config.dpkg_divert <> "no" && Config.apt_get <> "no" && - try (stat "/etc/debian_version").st_kind = S_REG with Unix_error _ -> false + (List.mem (Os_release.get_id ()) [ "debian"; "ubuntu" ] || + try (stat "/etc/debian_version").st_kind = S_REG with Unix_error _ -> false) let dpkg_primary_arch = ref "" let settings = ref no_settings diff --git a/src/pacman.ml b/src/pacman.ml index 3340fa6..c35668a 100644 --- a/src/pacman.ml +++ b/src/pacman.ml @@ -24,8 +24,9 @@ open Package_handler let pacman_detect () = Config.pacman <> "no" && Config.fakeroot <> "no" && - (stat "/etc/arch-release").st_kind = S_REG && - Config.pacman_g2 = "no" (* not Frugalware with pacman-g2 *) + (Os_release.get_id () = "arch" || + ((stat "/etc/arch-release").st_kind = S_REG && + Config.pacman_g2 = "no")) (* not Frugalware with pacman-g2 *) let settings = ref no_settings diff --git a/src/rpm.ml b/src/rpm.ml index a5dc67a..e409e37 100644 --- a/src/rpm.ml +++ b/src/rpm.ml @@ -31,21 +31,24 @@ let stringset_of_list pkgs = let fedora_detect () = Config.rpm <> "no" && Config.rpm2cpio <> "no" && rpm_is_available () && (Config.yumdownloader <> "no" || Config.dnf <> "no") && - try - (stat "/etc/redhat-release").st_kind = S_REG || - (stat "/etc/fedora-release").st_kind = S_REG - with Unix_error _ -> false + (List.mem (Os_release.get_id ()) [ "fedora"; "rhel"; "centos" ] || + try + (stat "/etc/redhat-release").st_kind = S_REG || + (stat "/etc/fedora-release").st_kind = S_REG + with Unix_error _ -> false) let opensuse_detect () = Config.rpm <> "no" && Config.rpm2cpio <> "no" && rpm_is_available () && Config.zypper <> "no" && - try (stat "/etc/SuSE-release").st_kind = S_REG with Unix_error _ -> false + (List.mem (Os_release.get_id ()) [ "opensuse"; "sled"; "sles" ] || + try (stat "/etc/SuSE-release").st_kind = S_REG with Unix_error _ -> false) let mageia_detect () = Config.rpm <> "no" && Config.rpm2cpio <> "no" && rpm_is_available () && Config.urpmi <> "no" && Config.fakeroot <> "no" && - try (stat "/etc/mageia-release").st_kind = S_REG with Unix_error _ -> false + (Os_release.get_id () = "mageia" || + try (stat "/etc/mageia-release").st_kind = S_REG with Unix_error _ -> false) let ibm_powerkvm_detect () = Config.rpm <> "no" && Config.rpm2cpio <> "no" && rpm_is_available () && -- 2.7.4 _______________________________________________ Libguestfs mailing list [email protected] https://www.redhat.com/mailman/listinfo/libguestfs ++++++ 0003-tests_use__etc_os-release_in_test-harder.patch ++++++ From: Pino Toscano <[email protected]> To: [email protected] Date: Wed, 31 Aug 2016 15:53:03 +0200 Message-Id: <[email protected]> In-Reply-To: <[email protected]> References: <[email protected]> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: [email protected] Subject: [Libguestfs] [PATCH] tests: use /etc/os-release in test-harder X-BeenThere: [email protected] X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Discussion and development of libguestfs <libguestfs.redhat.com> List-Unsubscribe: <https://www.redhat.com/mailman/options/libguestfs>, <mailto:[email protected]?subject=unsubscribe> List-Archive: <https://www.redhat.com/archives/libguestfs> List-Post: <mailto:[email protected]> List-Help: <mailto:[email protected]?subject=help> List-Subscribe: <https://www.redhat.com/mailman/listinfo/libguestfs>, <mailto:[email protected]?subject=subscribe> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: [email protected] Errors-To: [email protected] X-getmail-retrieved-from-mailbox: INBOX X-Evolution-Source: [email protected] Check the ID in /etc/os-release before checking the other release files, so it's possible to handle distros without them. Also, make sure it is skipped if the value read from os-release is not handled when getting the list of packages. --- tests/test-harder.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/test-harder.sh b/tests/test-harder.sh index ea5dfc8..7e1b8df 100755 --- a/tests/test-harder.sh +++ b/tests/test-harder.sh @@ -25,7 +25,14 @@ set -e # NOTE: This test will only work if the $pkgs listed below # for your distro are installed on the host. SEE LIST BELOW. -if [ -f /etc/arch-release ]; then +if [ -f /etc/os-release ]; then + distro=$(. /etc/os-release && echo $ID) + case "$distro" in + fedora|rhel|centos) distro=redhat ;; + opensuse|sled|sles) distro=suse ;; + ubuntu) distro=debian ;; + esac +elif [ -f /etc/arch-release ]; then distro=arch elif [ -f /etc/debian_version ]; then distro=debian @@ -63,6 +70,10 @@ case $distro in ibm-powerkvm) pkgs="augeas hivex tar" ;; + *) + echo "Unhandled distro '$distro'" + exit 77 + ;; esac test "$USE_NETWORK" = 1 || USE_INSTALLED=--use-installed -- 2.7.4 _______________________________________________ Libguestfs mailing list [email protected] https://www.redhat.com/mailman/listinfo/libguestfs
