[libvirt] [PATCH python 3/7] Add checks for min supported distros

Daniel P. Berrange posted 7 patches 7 years, 4 months ago
[libvirt] [PATCH python 3/7] Add checks for min supported distros
Posted by Daniel P. Berrange 7 years, 4 months ago
Be clear about which distros we aim to support with the specfile, so we know
what we can cleanup in the spec later.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
 libvirt-python.spec.in | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/libvirt-python.spec.in b/libvirt-python.spec.in
index 1619e26..a98b902 100644
--- a/libvirt-python.spec.in
+++ b/libvirt-python.spec.in
@@ -1,3 +1,14 @@
+# This spec file assumes you are building on a Fedora or RHEL version
+# that's still supported by the vendor. It may work on other distros
+# or versions, but no effort will be made to ensure that going forward
+%define min_rhel 6
+%define min_fedora 25
+
+%if (0%{?fedora} && 0%{?fedora} >= %{min_fedora}) || (0%{?rhel} && 0%{?rhel} >= %{min_rhel})
+    %define supported_platform 1
+%else
+    %define supported_platform 0
+%endif
 
 %define _with_python2 1
 %define _with_python3 0
@@ -81,6 +92,11 @@ of recent versions of Linux (and other OSes).
 find examples -type f -exec chmod 0644 \{\} \;
 
 %build
+%if ! %{supported_platform}
+echo "This RPM requires either Fedora >= %{min_fedora} or RHEL >= %{min_rhel}"
+exit 1
+%endif
+
 %if %{with_python2}
 CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
 %endif
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH python 3/7] Add checks for min supported distros
Posted by Pavel Hrdina 7 years, 4 months ago
On Thu, Jan 11, 2018 at 04:43:35PM +0000, Daniel P. Berrange wrote:
> Be clear about which distros we aim to support with the specfile, so we know
> what we can cleanup in the spec later.

Do we really want to have this limitation?  If so, maybe we can alter
the "requires" message to only warn that it's not tested/supported.

Pavel
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH python 3/7] Add checks for min supported distros
Posted by Ján Tomko 7 years, 4 months ago
On Fri, Jan 12, 2018 at 12:36:23PM +0100, Pavel Hrdina wrote:
>On Thu, Jan 11, 2018 at 04:43:35PM +0000, Daniel P. Berrange wrote:
>> Be clear about which distros we aim to support with the specfile, so we know
>> what we can cleanup in the spec later.
>
>Do we really want to have this limitation?

Yes, please.

Building upstream libvirt on such ancient distros will surely require
more complicated patches than just deleting these checks from the
specfile.

> If so, maybe we can alter
>the "requires" message to only warn that it's not tested/supported.
>

Nobody reads warnings, that's why we build with -Werror ;)

Jan

>Pavel



>--
>libvir-list mailing list
>libvir-list@redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH python 3/7] Add checks for min supported distros
Posted by Daniel P. Berrange 7 years, 4 months ago
On Fri, Jan 12, 2018 at 12:36:23PM +0100, Pavel Hrdina wrote:
> On Thu, Jan 11, 2018 at 04:43:35PM +0000, Daniel P. Berrange wrote:
> > Be clear about which distros we aim to support with the specfile, so we know
> > what we can cleanup in the spec later.
> 
> Do we really want to have this limitation?  If so, maybe we can alter
> the "requires" message to only warn that it's not tested/supported.

This matches what we do for the native libvirt RPM build.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH python 3/7] Add checks for min supported distros
Posted by Pavel Hrdina 7 years, 4 months ago
On Fri, Jan 12, 2018 at 03:43:55PM +0000, Daniel P. Berrange wrote:
> On Fri, Jan 12, 2018 at 12:36:23PM +0100, Pavel Hrdina wrote:
> > On Thu, Jan 11, 2018 at 04:43:35PM +0000, Daniel P. Berrange wrote:
> > > Be clear about which distros we aim to support with the specfile, so we know
> > > what we can cleanup in the spec later.
> > 
> > Do we really want to have this limitation?  If so, maybe we can alter
> > the "requires" message to only warn that it's not tested/supported.
> 
> This matches what we do for the native libvirt RPM build.

I was mostly thinking about the possibility to take upstream libvirt
or libvirt-python and be able to simply run "make rpm" on openSUSE.

I'm not even sure if it would work.

Pavel
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH python 3/7] Add checks for min supported distros
Posted by Daniel P. Berrange 7 years, 4 months ago
On Fri, Jan 12, 2018 at 05:32:32PM +0100, Pavel Hrdina wrote:
> On Fri, Jan 12, 2018 at 03:43:55PM +0000, Daniel P. Berrange wrote:
> > On Fri, Jan 12, 2018 at 12:36:23PM +0100, Pavel Hrdina wrote:
> > > On Thu, Jan 11, 2018 at 04:43:35PM +0000, Daniel P. Berrange wrote:
> > > > Be clear about which distros we aim to support with the specfile, so we know
> > > > what we can cleanup in the spec later.
> > > 
> > > Do we really want to have this limitation?  If so, maybe we can alter
> > > the "requires" message to only warn that it's not tested/supported.
> > 
> > This matches what we do for the native libvirt RPM build.
> 
> I was mostly thinking about the possibility to take upstream libvirt
> or libvirt-python and be able to simply run "make rpm" on openSUSE.

That's explicitly not a goal for the RPM specs at this time,


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list