Re: [PATCHv3 1/2] spec: make it easier to autoreconf when building rpm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/08/2011 08:12 AM, Daniel P. Berrange wrote:
> On Thu, Dec 08, 2011 at 01:27:37PM +0000, Daniel P. Berrange wrote:
>> On Thu, Dec 08, 2011 at 01:04:27PM +0000, Daniel P. Berrange wrote:
>>> On Tue, Dec 06, 2011 at 04:47:27PM -0700, Eric Blake wrote:
>>>> Over time, Fedora and RHEL RPMs have often backported upstream
>>>> patches that touched configure.ac and/or Makefile.am; this
>>>> necessitates rerunning the autotools for the patch to be effective.
>>>> Making this a one-liner spec tweak will make it easier for future
>>>> backports to pull patches without having to find all the places
>>>> to touch to properly use the autotools.  Meanwhile, there have been
>>>> historical instances where an update in the autotools caused FTBFS
>>>> situations, so this is not on by default.
>>>>
>>>> * libvirt.spec.in (BuildRequires): Add autotools.
>>>> (%build): Conditionally use them before configure.

>>> +%{?enable_autotools:%define enable_autotools 0}

>> I've just tried this and it doesn't actually work. You need

Ah, you're right.  It says:

if enable_autotools was defined, redefine it to 0
if enable_autotools was not defined, do nothing

>>
>>   %define enable_autotools %{?enable_autotools:0}

That's not quite right, either.  It says:

if enable_autotools was defined, redefine it to 0
if enable_autotools was undefined, define it to an empty string

I did more testing, and one correct answer is:

%{!?enable_autotools:%define enable_autotools 0}

read as:

if enable_autotools is not defined, define it to 0
if enable_autotools is defined, leave it alone (whether 0 or 1)

Another correct answer is:

%define enable_autotools 0%{?enable_autotools}

read as:

if enable_autotools is defined, redefine it to the concatenation of 0
and its previous value
if enable_autotools is undefined, define it to 0

> 
> There also needs to be a 
> 
> BuildRequires: gettext-devel
> 
> since autoreconf runs autopoint which isn't in the build root

Glad we deferred this to post-0.9.8, then.  Pushed with those fixes, as
well as copying to the mingw spec file:

diff --git i/libvirt.spec.in w/libvirt.spec.in
index 0584b0c..0a3b00d 100644
--- i/libvirt.spec.in
+++ w/libvirt.spec.in
@@ -11,7 +11,7 @@
 # Default to skipping autoreconf.  Distros can change just this one line
 # (or provide a command-line override) if they backport any patches that
 # touch configure.ac or Makefile.am.
-%{?enable_autotools:%define enable_autotools 0}
+%{!?enable_autotools:%define enable_autotools 0}

 # A client only build will create a libvirt.so only containing
 # the generic RPC driver, and test driver and no libvirtd
@@ -357,6 +357,7 @@ Requires(postun): systemd-units
 %if 0%{?enable_autotools}
 BuildRequires: autoconf
 BuildRequires: automake
+BuildRequires: gettext-devel
 BuildRequires: libtool
 %endif
 BuildRequires: python-devel
diff --git i/mingw32-libvirt.spec.in w/mingw32-libvirt.spec.in
index 89d1d7f..06ff601 100644
--- i/mingw32-libvirt.spec.in
+++ w/mingw32-libvirt.spec.in
@@ -5,6 +5,11 @@
 %define __find_provides %{_mingw32_findprovides}
 %define __debug_install_post %{_mingw32_debug_install_post}

+# Default to skipping autoreconf.  Distros can change just this one line
+# (or provide a command-line override) if they backport any patches that
+# touch configure.ac or Makefile.am.
+%{!?enable_autotools:%define enable_autotools 0}
+
 # The mingw build is client only.  Set up defaults for hypervisor drivers
 # that talk via a native remote protocol, and for which prereq mingw
 # libraries exist.
@@ -44,6 +49,12 @@ BuildRequires:  mingw32-portablexdr
 BuildRequires:  pkgconfig
 # Need native version for msgfmt
 BuildRequires:  gettext
+%if 0%{?enable_autotools}
+BuildRequires: autoconf
+BuildRequires: automake
+BuildRequires: gettext-devel
+BuildRequires: libtool
+%endif

 %if %{with_phyp}
 BuildRequires: mingw32-libssh2
@@ -81,6 +92,9 @@ MinGW Windows libvirt virtualization library.
 %define _without_xenapi --without-xenapi
 %endif

+%if 0%{?enable_autotools}
+autoreconf -if
+%endif
 # XXX enable SASL in future
 %{_mingw32_configure} \
   --without-xen \

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]