Blob Blame History Raw
--- libtdb.spec.orig	2017-04-05 13:08:31.109005187 +0200
+++ libtdb.spec	2017-04-21 11:17:34.078002142 +0200
@@ -1,117 +1,96 @@
 %if 0%{?fedora}
-%global with_python3 1
-%else
-%global with_python3 0
+%bcond_without	python3
 %endif
 
-Name: libtdb
-Version: 1.3.12
-Release: 5%{?dist}
-Group: System Environment/Daemons
-Summary: The tdb library
-License: LGPLv3+
-URL: http://tdb.samba.org/
-Source: http://samba.org/ftp/tdb/tdb-%{version}.tar.gz
-
-BuildRequires: libxslt
-BuildRequires: docbook-style-xsl
-BuildRequires: python2-devel
-%if 0%{?with_python3}
-BuildRequires: python3-devel
+Summary:	The tdb library
+Name:		libtdb
+Version:	1.3.12
+Release:	6%{?dist}
+License:	LGPLv3+
+URL:		http://tdb.samba.org/
+Source0:	http://samba.org/ftp/tdb/tdb-%{version}.tar.gz
+Patch0001:	0001-lib-replace-Fix-detection-of-features.patch
+Patch0002:	0002-WAF-Fix-detection-of-linker-features.patch
+Patch0003:	0003-WAF-Fix-detection-os-sysname.patch
+Patch0004:	0004-WAF-Fix-detection-of-IPv6.patch
+BuildRequires:	docbook-style-xsl
+BuildRequires:	libxslt
+BuildRequires:	python2-devel
+%if %{with python3}
+BuildRequires:	python3-devel
+BuildConflicts:	libattr-devel
 %endif
-
-Provides: bundled(libreplace)
-
-# Patches
-Patch0001: 0001-lib-replace-Fix-detection-of-features.patch
-Patch0002: 0002-WAF-Fix-detection-of-linker-features.patch
-Patch0003: 0003-WAF-Fix-detection-os-sysname.patch
-Patch0004: 0004-WAF-Fix-detection-of-IPv6.patch
+Provides:	bundled(libreplace)
 
 %description
-A library that implements a trivial database.
+This is a simple database API. It was inspired by the realisation that in
+Samba we have several ad-hoc bits of code that essentially implement small
+databases for sharing structures between parts of Samba. As I was about to
+add another I realised that a generic database module was called for to
+replace all the ad-hoc bits.
+
+I based the interface on gdbm. I couldn't use gdbm as we need to be able to
+have multiple writers to the databases at one time.
 
 %package devel
-Group: Development/Libraries
-Summary: Header files need to link the Tdb library
-Requires: libtdb = %{version}-%{release}
-Requires: pkgconfig
+Summary:	Header files need to link the Tdb library
+Requires:	libtdb = %{version}-%{release}
 
 %description devel
 Header files needed to develop programs that link against the Tdb library.
 
 %package -n tdb-tools
-Group: Development/Libraries
-Summary: Developer tools for the Tdb library
-Requires: libtdb = %{version}-%{release}
+Summary:	Developer tools for the Tdb library
+Requires:	libtdb = %{version}-%{release}
 
 %description -n tdb-tools
-Tools to manage Tdb files
+Tools to manage Tdb files.
 
 %package -n python2-tdb
-Group: Development/Libraries
-Summary: Python bindings for the Tdb library
-Requires: libtdb = %{version}-%{release}
+Summary:	Python bindings for the Tdb library
+Requires:	libtdb = %{version}-%{release}
 %{?python_provide:%python_provide python2-tdb}
 
 %description -n python2-tdb
-Python bindings for libtdb
+Python bindings for libtdb.
 
-%if 0%{?with_python3}
 %package -n python3-tdb
-Group: Development/Libraries
-Summary: Python3 bindings for the Tdb library
-Requires: libtdb = %{version}-%{release}
+Summary:	Python3 bindings for the Tdb library
+Requires:	libtdb = %{version}-%{release}
 %{?python_provide:%python_provide python3-tdb}
 
 %description -n python3-tdb
-Python3 bindings for libtdb
-%endif
+Python3 bindings for libtdb.
 
 %prep
-%setup -q -n tdb-%{version}
-%patch0001 -p1
-%patch0002 -p1
-%patch0003 -p1
-%patch0004 -p1
+%autosetup -p1 -n tdb-%{version}
 
 %build
-%if 0%{?with_python3}
-PY3_CONFIG_FLAGS=--extra-python=%{__python3}
-%else
-PY3_CONFIG_FLAGS=""
-%endif
+%configure \
+	--bundled-libraries=NONE \
+	--builtin-libraries=replace \
+	--disable-rpath \
+	%{?with_python3:--extra-python=%{__python3}} \
+	--pedantic
 
-%configure --disable-rpath \
-           --bundled-libraries=NONE \
-           --builtin-libraries=replace \
-           $PY3_CONFIG_FLAGS
-
-make %{?_smp_mflags} V=1
+%{make_build}
 
 %install
+%{make_install}
 
-make install DESTDIR=$RPM_BUILD_ROOT
-
-# Shared libraries need to be marked executable for
-# rpmbuild to strip them and include them in debuginfo
-find $RPM_BUILD_ROOT -name "*.so*" -exec chmod -c +x {} \;
-
-rm -f $RPM_BUILD_ROOT%{_libdir}/libtdb.a
+%post   -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
 
 %files
-%defattr(-,root,root,-)
 %{_libdir}/libtdb.so.*
 
 %files devel
-%defattr(-,root,root)
 %doc docs/README
 %{_includedir}/tdb.h
 %{_libdir}/libtdb.so
 %{_libdir}/pkgconfig/tdb.pc
 
 %files -n tdb-tools
-%defattr(-,root,root,-)
 %{_bindir}/tdbbackup
 %{_bindir}/tdbdump
 %{_bindir}/tdbtool
@@ -122,33 +101,34 @@
 %{_mandir}/man8/tdbrestore.8*
 
 %files -n python2-tdb
-%defattr(-,root,root,-)
 %{python_sitearch}/tdb.so
 %{python_sitearch}/_tdb_text.py*
 
-%if 0%{?with_python3}
+%if %{with python3}
 %files -n python3-tdb
-%defattr(-,root,root,-)
 %{python3_sitearch}/__pycache__/_tdb_text.cpython*.py[co]
 %{python3_sitearch}/tdb.cpython*.so
 %{python3_sitearch}/_tdb_text.py
 %endif
 
-%post -p /sbin/ldconfig
-
-%postun -p /sbin/ldconfig
-
-%post -n python2-tdb -p /sbin/ldconfig
-
-%postun -n python2-tdb -p /sbin/ldconfig
-
-%if 0%{?with_python3}
-%post -n python3-tdb -p /sbin/ldconfig
-
-%postun -n python3-tdb -p /sbin/ldconfig
-%endif
-
 %changelog
+* Sun Apr 16 2017 Tomasz Kłoczko <kloczek@fedoraproject.org> - 1.3.12-6
+- added libattr-devel to BuildConflicts (as long libattr-devel is installed libtdb
+  will be build automatically with libattr support)
+- added use %bcond, %%autosetup, %%{make_build} and %{make_install} macros
+- %%defattr() is no longer needed
+- removed Group fields (new packaging policy)
+- executing /sbin/ldconfig in python %%post/%%postun packages is not needed
+  (those packages are not providing libraries but loadable modules)
+- removed delete static libtdb.a in %%install (is not needed)
+- removed not needed pkgconfig from devel subpackage (is not needed)
+- spec indented and other minor cleanups
+- better %%description
+- added --pedantic to expose more compile time warnings in distribution build logs
+- added %%check section to fire tdb test suite. Those tests are running quite long
+  and if you are working on this package please use --nocheck build option to
+  not fire those tests
+
 * Tue Feb 14 2017 Lukas Slebodnik <lslebodn@redhat.com> - 1.3.12-5
 - rhbz#1401175 - Missing symbol versioning provided by libtdb.so
 - Fix configure time detection with -Werror=implicit-function-declaration