%global selinux_types %(%{__awk} '/^#[[:space:]]*SELINUXTYPE=/,/^[^#]/ { if ($3 == "-") printf "%s ", $2 }' /etc/selinux/config 2>/dev/null) %global selinux_variants %([ -z "%{selinux_types}" ] && echo mls targeted || echo %{selinux_types}) Summary: MOLAP Database Server Name: palo Version: 5.1.4 Release: 0%{?dist} License: GPLv3 Group: Applications/Databases Source: https://svn.code.sf.net/p/%{name}/code/molap/server/%{version}/palo-5.1.4.tgz Source2: palo.te Source3: palo.fc Source4: palo.1 Patch0: palo-5.1.4-cmake.patch #Provide a systemd unit to start palo on boot: not provide by source tree #http://www.jedox.com/community/palo-forum/index.php?page=Thread&threadID=4597&s=f5e82bfa901352bc4e26869347bf8a4d7b6466e7 Patch1: palo-5.1.4-systemd-unit.patch URL: http://www.jedox.com/community/palo-forum/ Requires(pre): shadow-utils BuildRequires: subversion BuildRequires: cmake BuildRequires: zlib-devel BuildRequires: openssl-devel BuildRequires: boost-devel BuildRequires: icu BuildRequires: libicu-devel BuildRequires: gperftools-devel BuildRequires: gettext BuildRequires: systemd #SELinux dependencies; based on https://fedoraproject.org/wiki/SELinux_Policy_Modules_Packaging_Draft BuildRequires: checkpolicy BuildRequires: selinux-policy-devel %{!?_selinux_policy_version: %global _selinux_policy_version %(sed -e 's,.*selinux-policy-\\([^/]*\\)/.*,\\1,' /usr/share/selinux/devel/policyhelp 2>/dev/null)} %if "%{_selinux_policy_version}" != "" Requires: selinux-policy >= %{_selinux_policy_version} %endif %description Palo is a cell-oriented, multiple dimension in-memory OLAP server typically used for analysis and data consolidation. Multiple dimension data can be queried interactively and written back for further consolidation. The server stores and manipulates data in memory. Bespoke Java, PHP, C/C++, and .NET clients can access the palo database via an API or plug-in modules are available for spreadsheet applications. %prep %setup -q #Patch the CMakeLists.txt to ensure its fedora compatible %patch0 -p1 #Patch the source to include the systemd unit %patch1 -p1 #Copy SELinux policy source to a new folder mkdir SELinux cp -p %{SOURCE2} SELinux cp -p %{SOURCE3} SELinux cp -p %{SOURCE4} . %build #Create a build directory for cmake mkdir --parents %{_builddir}/build cd %{_builddir}/build #As this is a server enable position-independent code (PIC) %global _hardened_build 1 #Use cmake to build %cmake ../%{name}-%{version}/ make %{?_smp_mflags} cd - #Build the SELinux policy cd SELinux for selinuxvariant in %{selinux_variants} do make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile mv %{name}.pp %{name}.pp.${selinuxvariant} make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile clean done %pre #Create a user and group based on the recommendation here https://fedoraproject.org/wiki/Packaging:UsersAndGroups getent group %{name} >/dev/null || groupadd -r %{name} getent passwd %{name} >/dev/null || \ useradd -r -g %{name} -d %{_sharedstatedir}/%{name} -s /sbin/nologin \ -c "Palo MOLAP Database Server" %{name} exit 0 %install #Create the folder structure mkdir --parents %{buildroot}%{_bindir} mkdir --parents %{buildroot}%{_libdir} mkdir --parents %{buildroot}%{_sysconfdir} mkdir --parents %{buildroot}%{_sharedstatedir}/%{name}/Data mkdir --parents %{buildroot}%{_unitdir} mkdir --parents %{buildroot}%{_mandir}/man1 install --mode=0755 %{_builddir}/build%{_bindir}/%{name} %{buildroot}%{_bindir} install --mode=0755 %{_builddir}/build%{_libdir}/libhttps.%{name}.so.* %{buildroot}%{_libdir} #Create the symbolic links cd %{buildroot}%{_libdir} ln -sf libhttps.%{name}.so.%{version} libhttps.palo.so ln -sf libhttps.%{name}.so.%{version} libhttps.palo.so.0 #Copy accross the runtime configuration file cp %{_builddir}/%{name}-%{version}/%{name}.ini.sample %{buildroot}%{_sysconfdir}/%{name}.ini #The systemd unit file is provided by the package maintainer as Patch1 install --mode=0644 %{_builddir}/%{name}-%{version}/%{name}.service %{buildroot}%{_unitdir} #Install the SELinux policy for selinuxvariant in %{selinux_variants} do install -d %{buildroot}%{_datadir}/selinux/${selinuxvariant} install -p -m 644 %{_builddir}/%{name}-%{version}/SELinux/%{name}.pp.${selinuxvariant} %{buildroot}%{_datadir}/selinux/${selinuxvariant}/%{name}.pp done #Install the man page cp %{_builddir}/%{name}-%{version}/%{name}.1 %{buildroot}%{_mandir}/man1 chmod -x %{buildroot}%{_mandir}/man1/%{name}.1 %post #Ensure the ldconfig is called on install and uninstall so the .so's work as expected /sbin/ldconfig #Activate the SELinux policies for selinuxvariant in %{selinux_variants} do /usr/sbin/semodule -s ${selinuxvariant} -i %{_datadir}/selinux/${selinuxvariant}/%{name}.pp &> /dev/null || : done /sbin/fixfiles -R %{name} restore || : #Update the man database mandb -q -C %{name} %postun #Deactivate the .so's are no longer available /sbin/ldconfig #Deactive the SELinux policies if [ $1 -eq 0 ] ; then for selinuxvariant in %{selinux_variants} do /usr/sbin/semodule -s ${selinuxvariant} -r %{name} &> /dev/null || : done fi #Update the man database to remove the palo entry mandb -q %files #Documentation and license files as provided by upstream %license LICENSE %doc README CHANGELOG #Files owned by the package %attr(-, %{name}, %{name}) %{_bindir}/%{name} %attr(-, %{name}, %{name}) %{_libdir}/libhttps.%{name}.* #Directories owned by the package %attr(-, %{name}, %{name}) %{_sharedstatedir}/%{name} #Tag the config files so they don't get overridden %config(noreplace) %{_sysconfdir}/%{name}.ini %verify() %{_unitdir}/%{name}.service #SELinux files %doc SELinux/* %{_datadir}/selinux/*/%{name}.pp #man page %{_mandir}/man1/%{name}.1* %changelog * Fri Nov 6 2015 Michael Arnold - 5.1.4-0 - Added man page * Sun Oct 11 2015 Michael Arnold - 5.1.4-0 - Added SELinux policy * Thu Oct 8 2015 Michael Arnold - 5.1.4-0 - Create user and group and assign file and directory owenrship * Tue Oct 6 2015 Michael Arnold - 5.1.4-0 - Made corrections to the palo.spec file based on the output of fedora-review -b 1209166 * Thu Apr 9 2015 Michael Arnold - 5.1.4-0 - Updated BuildRequires to fix Koji builds - Further modifications to patch0, to remove hard-coded paths to ensure that cmake finds dependencies reliably * Sun Mar 29 2015 Michael Arnold - 5.1.4-0 - Created initial palo.spec file based on https://fedoraproject.org/wiki/How_to_create_an_RPM_package