SHA256
1
0
forked from pool/libguestfs

Accepting request 536717 from Virtualization

1

OBS-URL: https://build.opensuse.org/request/show/536717
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libguestfs?expand=0&rev=57
This commit is contained in:
Dominique Leuenberger 2017-10-26 16:45:42 +00:00 committed by Git OBS Bridge
commit 250440d37a
4 changed files with 118 additions and 28 deletions

View File

@ -0,0 +1,103 @@
From 531316cc3f25db22d94310334dc8b61596dc263f Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Mon, 25 Sep 2017 14:29:47 +0200
Subject: [PATCH] build: improve and simplify distro detection
Add a --with-distro=ID argument for configure, so it is possible to
manually specify the distro to use for the packages (in case os-release
does not provide ID=.., or the ID is not recognized yet).
In the case when --with-distro is not set, keep doing the autodetection,
but using os-release only, i.e. dropping the checks for all the other
-release files -- since there is --with-distro, older distros with no
os-release can still be used.
RWMJ: Add documentation to guestfs-building(1).
---
docs/guestfs-building.pod | 14 ++++++++++++++
m4/guestfs_appliance.m4 | 44 +++++++++++++++++++-------------------------
2 files changed, 33 insertions(+), 25 deletions(-)
diff --git a/docs/guestfs-building.pod b/docs/guestfs-building.pod
index ecc27f9d6..187da37be 100644
--- a/docs/guestfs-building.pod
+++ b/docs/guestfs-building.pod
@@ -648,6 +648,20 @@ Note that despite this setting, all backends are built into
libguestfs, and you can override the backend at runtime by setting the
C<$LIBGUESTFS_BACKEND> environment variable (or using API methods).
+=item B<--with-distro=REDHAT|DEBIAN|...>
+
+Libguestfs needs to know which Linux distro is in use so it can choose
+package names for the appliance correctly (see for example
+F<appliance/packagelist.in>). It normally does this automatically.
+
+However if you can building or packaging libguestfs on a new distro
+then you can use I<--with-distro> to specify that the distro is
+similar to an existing one (eg. I<--with-distro=REDHAT> if the distro
+is a new Red Hat or CentOS derivative).
+
+Note that if your distro is completely new then it may still require
+upstream modifications.
+
=item B<--with-extra=">I<distroname>=I<version>,libvirt,...B<">
=item B<--with-extra="local">
diff --git a/m4/guestfs_appliance.m4 b/m4/guestfs_appliance.m4
index fbba3373f..4993f57a1 100644
--- a/m4/guestfs_appliance.m4
+++ b/m4/guestfs_appliance.m4
@@ -94,31 +94,25 @@ dnl names vary slightly across distros. (See
dnl appliance/packagelist.in, appliance/excludefiles.in,
dnl appliance/hostfiles.in)
AC_MSG_CHECKING([which Linux distro for package names])
-if test -f /etc/os-release; then
- ( . /etc/os-release && echo $ID | tr '@<:@:lower:@:>@' '@<:@:upper:@:>@' ) >&AS_MESSAGE_LOG_FD
- DISTRO="`. /etc/os-release && echo $ID | tr '@<:@:lower:@:>@' '@<:@:upper:@:>@'`"
- AS_CASE([$DISTRO],
- [FEDORA | RHEL | CENTOS],[DISTRO=REDHAT],
- [OPENSUSE | SLED | SLES],[DISTRO=SUSE],
- [ARCH],[DISTRO=ARCHLINUX])
-elif test -f /etc/debian_version; then
- DISTRO=DEBIAN
- if grep -q 'DISTRIB_ID=Ubuntu' /etc/lsb-release 2>&AS_MESSAGE_LOG_FD; then
- DISTRO=UBUNTU
- fi
-elif test -f /etc/arch-release; then
- DISTRO=ARCHLINUX
-elif test -f /etc/SuSE-release; then
- DISTRO=SUSE
-elif test -f /etc/frugalware-release; then
- DISTRO=FRUGALWARE
-elif test -f /etc/mageia-release; then
- DISTRO=MAGEIA
-else
-dnl fallback option
- DISTRO=REDHAT
-fi
-AC_MSG_RESULT([$DISTRO])
+AC_ARG_WITH([distro],
+ [AS_HELP_STRING([--with-distro="DISTRO_ID"],
+ [distro ID @<:@default=ID in /etc/os-release@:>@])],[
+ DISTRO="$withval"
+ AC_MSG_RESULT([$DISTRO (manually specified)])
+ ],[
+ if test -f /etc/os-release; then
+ ( . /etc/os-release && echo $ID | tr '@<:@:lower:@:>@' '@<:@:upper:@:>@' ) >&AS_MESSAGE_LOG_FD
+ DISTRO="`. /etc/os-release && echo $ID | tr '@<:@:lower:@:>@' '@<:@:upper:@:>@'`"
+ AS_CASE([$DISTRO],
+ [FEDORA | RHEL | CENTOS],[DISTRO=REDHAT],
+ [OPENSUSE | SLED | SLES],[DISTRO=SUSE],
+ [ARCH],[DISTRO=ARCHLINUX])
+ AC_MSG_RESULT([$DISTRO (from /etc/os-release)])
+ else
+ AC_MSG_ERROR([/etc/os-release not available, please specify the distro using --with-distro=DISTRO])
+ fi
+ ]
+)
AC_SUBST([DISTRO])
dnl Add extra packages to the appliance.
--
2.13.2

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Wed Oct 25 13:24:50 UTC 2017 - cbosdonnat@suse.com
- Move guestfs-data to libguestfs0. bsc#1064399
- Force distro detection
Removed:
* use-idlike.patch
Added:
* 531316cc-build-improve-and-simplify-distro-detection.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Oct 12 14:37:40 CEST 2017 - sbrabec@suse.com Thu Oct 12 14:37:40 CEST 2017 - sbrabec@suse.com

View File

@ -143,8 +143,8 @@ Patch0: 0000-hotfix.patch
# PATCH-FIX-UPSTREAM - python3 fixes # PATCH-FIX-UPSTREAM - python3 fixes
Patch1: 9d25b4e5-python-add-simple-wrappers-for-PyObject-string-funct.patch Patch1: 9d25b4e5-python-add-simple-wrappers-for-PyObject-string-funct.patch
Patch2: f3f99a09-python-use-right-func-when-PyString_FromStringAndSiz.patch Patch2: f3f99a09-python-use-right-func-when-PyString_FromStringAndSiz.patch
# PATCH-FIX-OPENSUSE - pending upstream review, fixing distro detection in OBS # PATCH-FIX-UPSTREAM - add configure --with-distro parameter
Patch3: use-idlike.patch Patch3: 531316cc-build-improve-and-simplify-distro-detection.patch
Patch100: appliance.patch Patch100: appliance.patch
Source0: http://download.libguestfs.org/1.36-stable/libguestfs-%{version}.tar.gz Source0: http://download.libguestfs.org/1.36-stable/libguestfs-%{version}.tar.gz
@ -195,7 +195,6 @@ Requires: perl(Win::Hivex)
Requires: perl(Win::Hivex::Regedit) Requires: perl(Win::Hivex::Regedit)
%endif %endif
%endif %endif
Requires: guestfs-data >= %{version}
%if %{with fuse} %if %{with fuse}
Requires: fuse Requires: fuse
@ -274,7 +273,6 @@ BuildRequires: perl(Win::Hivex::Regedit)
# #
Provides: libguestfs-perl = %{version} Provides: libguestfs-perl = %{version}
Obsoletes: libguestfs-perl < %{version} Obsoletes: libguestfs-perl < %{version}
Requires: guestfs-data >= %{version}
Requires: perl(File::Temp) Requires: perl(File::Temp)
Requires: perl(Locale::TextDomain) Requires: perl(Locale::TextDomain)
%perl_requires %perl_requires
@ -289,7 +287,6 @@ Summary: Lua bindings for libguestfs
License: GPL-2.0 License: GPL-2.0
Group: Development/Languages/Lua Group: Development/Languages/Lua
BuildRequires: lua-devel BuildRequires: lua-devel
Requires: guestfs-data >= %{version}
%define _configure_lua --enable-lua %define _configure_lua --enable-lua
# #
@ -313,7 +310,6 @@ BuildRequires: python-rpm-macros
Obsoletes: libguestfs-python < %{version} Obsoletes: libguestfs-python < %{version}
Obsoletes: python-libguestfs < %{version} Obsoletes: python-libguestfs < %{version}
Provides: python-libguestfs = %{version} Provides: python-libguestfs = %{version}
Requires: guestfs-data >= %{version}
%description -n python2-libguestfs %description -n python2-libguestfs
Allows Python 2 scripts to directly use libguestfs. Allows Python 2 scripts to directly use libguestfs.
@ -327,7 +323,6 @@ Group: Development/Languages/Python
Obsoletes: libguestfs-python < %{version} Obsoletes: libguestfs-python < %{version}
Obsoletes: python-libguestfs < %{version} Obsoletes: python-libguestfs < %{version}
Provides: python-libguestfs = %{version} Provides: python-libguestfs = %{version}
Requires: guestfs-data >= %{version}
%description -n python3-libguestfs %description -n python3-libguestfs
Allows Python 3 scripts to directly use libguestfs. Allows Python 3 scripts to directly use libguestfs.
@ -341,7 +336,6 @@ Group: Development/Languages/Ruby
BuildRequires: ruby BuildRequires: ruby
BuildRequires: ruby-devel BuildRequires: ruby-devel
BuildRequires: rubygem-rake BuildRequires: rubygem-rake
Requires: guestfs-data >= %{version}
%define _configure_ruby --enable-ruby %define _configure_ruby --enable-ruby
# #
@ -495,6 +489,7 @@ Summary: Runtime library of libguestfs
License: LGPL-2.1 License: LGPL-2.1
Group: System/Libraries Group: System/Libraries
Requires: %{kvm_binary} Requires: %{kvm_binary}
Requires: guestfs-data >= %{version}
Requires: qemu >= 2.0 Requires: qemu >= 2.0
Requires: qemu-tools Requires: qemu-tools
Requires: supermin >= 5.1.6 Requires: supermin >= 5.1.6
@ -599,7 +594,8 @@ fi
%{_configure_python} \ %{_configure_python} \
%{_configure_ruby} \ %{_configure_ruby} \
--disable-rpath \ --disable-rpath \
--disable-static --disable-static \
--with-distro=SUSE
#Workaround an autotools bug #Workaround an autotools bug
make -j1 -C builder index-parse.c make -j1 -C builder index-parse.c
# 'INSTALLDIRS' ensures that perl libs are installed in the vendor dir instead of the site dir # 'INSTALLDIRS' ensures that perl libs are installed in the vendor dir instead of the site dir

View File

@ -1,19 +0,0 @@
Index: libguestfs-1.36.5/m4/guestfs_appliance.m4
===================================================================
--- libguestfs-1.36.5.orig/m4/guestfs_appliance.m4
+++ libguestfs-1.36.5/m4/guestfs_appliance.m4
@@ -101,6 +101,14 @@ if test -f /etc/os-release; then
[FEDORA | RHEL | CENTOS],[DISTRO=REDHAT],
[OPENSUSE | SLED | SLES],[DISTRO=SUSE],
[ARCH],[DISTRO=ARCHLINUX])
+ dnl All SUSE-based distros have ID_LIKE containing 'suse', check for it if
+ dnl ID wasn't helpful.
+ if test -z "$DISTRO"; then
+ DISTRO_LIKE="`. /etc/os-release && echo $ID_LIKE`"
+ if echo $DISTRO_LIKE | tr " " "\n" | grep -i "^SUSE$"; then
+ DISTRO=SUSE
+ fi
+ fi
elif test -f /etc/debian_version; then
DISTRO=DEBIAN
if grep -q 'DISTRIB_ID=Ubuntu' /etc/lsb-release 2>&AS_MESSAGE_LOG_FD; then