%define clickhouse_user clickhouse %define clickhouse_group clickhouse %global commit 96485e41c5b1d65fa2fbf016523f5e1fb37d3ffd %global shortcommit %(c=%{commit}; echo ${c:0:7}) Name: clickhouse Version: 1.1.54236 Release: 3%{?dist} Summary: A free analytic DBMS for big data Group: Applications/Databases License: Apache-2.0 URL: https://clickhouse.yandex/ Source0: https://github.com/yandex/ClickHouse/archive/%{commit}/ClickHouse-%{shortcommit}.tar.gz %if 0%{?rhel} == 7 Source1: clickhouse.service Source2: clickhouse.tmpfilesd Source3: clickhouse.logrotate BuildRequires: cmake BuildRequires: devtoolset-6-gcc-c++ BuildRequires: libicu-devel BuildRequires: libtool-ltdl-devel BuildRequires: unixODBC-devel BuildRequires: openssl-devel BuildRequires: readline-devel BuildRequires: mariadb-devel BuildRequires: libzstd-devel BuildRequires: expat-devel BuildRequires: re2-devel BuildRequires: zlib-devel %endif %description ClickHouse is an open source column-oriented database management system capable of real time generation of analytical data reports using SQL queries. %package common Summary: clickhouse common files %description common %{summary}. %package server Summary: clickhouse server files Requires: %{name}-common = %{version}-%{release} %if 0%{?rhel} == 7 Requires(post): systemd Requires(preun): systemd Requires(postun): systemd %endif %description server %{summary}. %package client Summary: clickhouse client files Requires: %{name}-common = %{version}-%{release} %description client %{summary}. %prep %setup -q -n ClickHouse-%{commit} %build %if 0%{?rhel} == 7 %{__cat} </dev/null || groupadd -r %{clickhouse_group} getent passwd %{clickhouse_user} >/dev/null || \ useradd -r -g %{clickhouse_group} -s /sbin/nologin \ --no-create-home -c "clickhouse user" %{clickhouse_user} exit 0 %post server %if 0%{?rhel} == 7 %systemd_post clickhouse.service %endif %preun server %if 0%{?rhel} == 7 %systemd_preun clickhouse.service %endif %postun server %if 0%{?rhel} == 7 %systemd_postun_with_restart clickhouse.service %endif %files common %defattr(-,root,root,-) %{_bindir}/clickhouse %{_bindir}/config-processor %{_libdir}/libclickhouse.so* %files server %defattr(-,root,root,-) %{_bindir}/clickhouse-benchmark %{_bindir}/clickhouse-compressor %{_bindir}/clickhouse-local %{_bindir}/clickhouse-server %{_bindir}/clickhouse-zookeeper-cli %{_bindir}/corrector_utf8 %if 0%{?rhel} == 7 %config(noreplace) %{_sysconfdir}/clickhouse-server/config.xml %config(noreplace) %{_sysconfdir}/clickhouse-server/users.xml %{_unitdir}/clickhouse.service %{_sysconfdir}/tmpfiles.d/clickhouse.conf %attr(0755, %{clickhouse_user}, %{clickhouse_group}) %dir %{_sysconfdir}/clickhouse %attr(0755, %{clickhouse_user}, %{clickhouse_group}) %dir %{_localstatedir}/lib/clickhouse %attr(0755, %{clickhouse_user}, %{clickhouse_group}) %dir %{_localstatedir}/lib/clickhouse/tmp %attr(0755, %{clickhouse_user}, %{clickhouse_group}) %dir %{_localstatedir}/log/clickhouse-server %attr(0755, %{clickhouse_user}, %{clickhouse_group}) %dir %{_localstatedir}/run/clickhouse-server %config(noreplace) %{_sysconfdir}/logrotate.d/clickhouse-server %endif %files client %defattr(-,root,root,-) %{_bindir}/clickhouse-client %config(noreplace) %{_sysconfdir}/clickhouse-client/config.xml %changelog * Tue Aug 22 2017 Mykola Marzhan - 1.1.54236-3 - fix %{_sysconfdir}/clickhouse-server owner - fix %{_localstatedir}/lib/clickhouse location * Mon Aug 21 2017 Mykola Marzhan - 1.1.54236-2 - fix Requires - fix fix package name for %pre/%post actions * Mon Jun 12 2017 Hiroaki Nakamura - 1.1.54236-1 - Initial packaging