From 0e713eea893104ec71cc7929c399e3fec07c8fee Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Sun, 27 May 2018 10:52:38 +0200 Subject: [PATCH 1/4] Update SPEC file to support multiple SUSE versions and CentOS Manage different package names and versions to support different openSUSE/SLES versions and CentOS for OBS. Do not use the %makeinstall marko, it does not expand correctly for CentOS. CentOS also needs to create %{buildroot}%{_libdir} to install correctly within the RPM build system. Signed-off-by: Danny Al-Gaaf Co-authored-by: Giacomo Tenaglia --- rpm/dovecot-ceph-plugin.spec | 68 ++++++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 18 deletions(-) diff --git a/rpm/dovecot-ceph-plugin.spec b/rpm/dovecot-ceph-plugin.spec index 2b3ac822..d63995d6 100644 --- a/rpm/dovecot-ceph-plugin.spec +++ b/rpm/dovecot-ceph-plugin.spec @@ -1,5 +1,5 @@ # -# spec file for package dovecot22-rados-plugins +# spec file for package dovecot-ceph-plugins # # Copyright (c) 2017-2018 Tallence AG and the authors # @@ -8,8 +8,33 @@ # License version 2.1, as published by the Free Software # Foundation. See file COPYING. -%{!?dovecot_devel: %define dovecot_devel dovecot22-devel} %{!?librados_version: %define librados_version 10.2.5} +%{!?dovecot_min_version: %define dovecot_version 2.2.21} + +%if 0%{?suse_version} || 0%{?sle_version} + %{!?libjansson_devel: %define libjansson_devel libjansson-devel} + %{!?pkg_config: %define pkg_config pkg-config} +%endif + +# openSUSE Tumbleweed +%if 0%{?suse_version} > 1500 + %{!?dovecot_devel: %define dovecot_devel dovecot23-devel} +%else + %if 0%{?sle_version} + # openSUSE Leap 42.3 and SLE 12 SP3 + %if 0%{?sle_version} == 120300 + %{!?dovecot_devel: %define dovecot_devel dovecot22-devel} + %else + %{!?dovecot_devel: %define dovecot_devel dovecot23-devel} + %endif + %else + %if 0%{?centos_version} == 700 + %{!?dovecot_devel: %define dovecot_devel dovecot22u-devel} + %{!?libjansson_devel: %define libjansson_devel jansson-devel} + %{!?pkg_config: %define pkg_config pkgconfig} + %endif + %endif +%endif Name: dovecot-ceph-plugin Summary: Dovecot Ceph RADOS plugins @@ -18,19 +43,21 @@ Release: 0%{?dist} URL: https://github.com/ceph-dovecot/dovecot-ceph-plugin Group: Productivity/Networking/Email/Servers License: LGPL-2.1 -Source: %{name}_%{version}-%{release}.tar.gz +Source: %{name}-%{version}.tar.xz -Provides: dovecot-ceph-plugin = %{version}-%{release} +Provides: dovecot-ceph-plugins = %{version}-%{release} Requires: librmb0 >= %{version}-%{release} -Conflicts: otherproviders(dovecot-ceph-plugin) +Requires: librados2 >= %{librados_version} +Conflicts: otherproviders(dovecot-ceph-plugins) -BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: %dovecot_devel -BuildRequires: librados-devel >= %librados_version -BuildRequires: libjansson-devel >= 2.9 -BuildRequires: gcc-c++ -BuildRequires: libtool -BuildRequires: pkg-config + +BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildRequires: %{dovecot_devel} >= %{dovecot_min_version} +BuildRequires: librados-devel >= %{librados_version} +BuildRequires: %{libjansson_devel} >= 2.9 +BuildRequires: gcc-c++ +BuildRequires: libtool +BuildRequires: %{pkg_config} %description Dovecot is an IMAP and POP3 server for Linux and UNIX-like systems, @@ -75,11 +102,14 @@ export LIBS="-pie" ./autogen.sh %configure \ --prefix=%{_prefix} \ - --with-dovecot=%{_libdir}/dovecot + --with-dovecot=%{_libdir}dovecot %{__make} %install -%makeinstall +%{__rm} -rf %{buildroot} +mkdir -p %{buildroot}%{_libdir}/ +%make_install +install -m 0644 -D COPYING-LGPL2.1 %{buildroot}%{_docdir}/dovecot-ceph-plugin/COPYING # clean up unused files find %{buildroot}%{_libdir}/ -type f -name \*.la -delete @@ -95,6 +125,8 @@ find %{buildroot}%{_libdir}/dovecot/ -type f -name \*.a -delete %files %defattr(-,root,root) +%dir %{_docdir}/dovecot-ceph-plugin +%doc %{_docdir}/dovecot-ceph-plugin/COPYING %dir %{_libdir}/dovecot %{_libdir}/dovecot/lib*.so* @@ -108,13 +140,13 @@ find %{buildroot}%{_libdir}/dovecot/ -type f -name \*.a -delete %files -n librmb-devel %defattr(-,root,root) -%{_includedir}/* +%dir %{_includedir}/dovecot-ceph-plugin +%{_includedir}/dovecot-ceph-plugin/*.h %{_libdir}/librmb.so %files -n rmb-tools %defattr(-,root,root) -%attr(0755, root, root) %{_bindir}/rmb -%doc %{_mandir}/man1/rmb.1* +%{_bindir}/rmb +/usr/share/man/man1/rmb.1.gz %changelog - From c91212a1db212773a26988f4c268b414da1b1056 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Sun, 27 May 2018 10:58:49 +0200 Subject: [PATCH 2/4] make package name consistant, use dovecot-ceph-plugin Signed-off-by: Danny Al-Gaaf --- rpm/dovecot-ceph-plugin.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rpm/dovecot-ceph-plugin.spec b/rpm/dovecot-ceph-plugin.spec index d63995d6..664cb35e 100644 --- a/rpm/dovecot-ceph-plugin.spec +++ b/rpm/dovecot-ceph-plugin.spec @@ -1,5 +1,5 @@ # -# spec file for package dovecot-ceph-plugins +# spec file for package dovecot-ceph-plugin # # Copyright (c) 2017-2018 Tallence AG and the authors # @@ -45,10 +45,10 @@ Group: Productivity/Networking/Email/Servers License: LGPL-2.1 Source: %{name}-%{version}.tar.xz -Provides: dovecot-ceph-plugins = %{version}-%{release} +Provides: dovecot-ceph-plugin = %{version}-%{release} Requires: librmb0 >= %{version}-%{release} Requires: librados2 >= %{librados_version} -Conflicts: otherproviders(dovecot-ceph-plugins) +Conflicts: otherproviders(dovecot-ceph-plugin) BuildRoot: %{_tmppath}/%{name}-%{version}-build From 1804ce0b4e5aff03717879a5022a18f0684b6db5 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Sun, 27 May 2018 11:07:07 +0200 Subject: [PATCH 3/4] README: add link to OBS packages for SLES, openSUSE and CentOS Signed-off-by: Danny Al-Gaaf --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 7c95998e..b7967fa1 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,11 @@ If you are using CentOS make sure you also have the following package installed: ./configure --with-dovecot=/home/user/workspace/core make install +## Packages + +Packages of the latest tagged versions for different versions of openSUSE, SLES and CentOS 7 +can be downloaded from the [Open Build Service](https://download.opensuse.org/repositories/home:/dalgaaf:/dovecot-ceph-plugin/). + ## Thanks From 49ea19e7edd738129c7239755f4a1516df6c6285 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Tue, 29 May 2018 10:17:23 +0200 Subject: [PATCH 4/4] spec: fix small typo Signed-off-by: Danny Al-Gaaf --- rpm/dovecot-ceph-plugin.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpm/dovecot-ceph-plugin.spec b/rpm/dovecot-ceph-plugin.spec index 664cb35e..7e607a04 100644 --- a/rpm/dovecot-ceph-plugin.spec +++ b/rpm/dovecot-ceph-plugin.spec @@ -102,7 +102,7 @@ export LIBS="-pie" ./autogen.sh %configure \ --prefix=%{_prefix} \ - --with-dovecot=%{_libdir}dovecot + --with-dovecot=%{_libdir}/dovecot %{__make} %install