memcached/memcached.spec

170 lines
5.0 KiB
RPMSpec
Raw Normal View History

2021-06-16 15:38:40 +08:00
%define username memcached
%define groupname memcached
%bcond_without sasl
%bcond_with seccomp
2021-06-16 15:38:40 +08:00
%bcond_without tls
%bcond_with tests
Name: memcached
Version: 1.6.12
Release: 2
Epoch: 0
Summary: A high-performance, distributed memory object caching system
License: GPL-2.0+
URL: https://www.memcached.org/
Source0: https://www.memcached.org/files/memcached-%{version}.tar.gz
2021-06-16 15:38:40 +08:00
Source1: https://releases.pagure.org/memcached-selinux/memcached-selinux-1.0.2.tar.gz
Source2: memcached.sysconfig
Patch0001: memcached-unit.patch
BuildRequires: systemd perl-generators perl(Test::More) perl(Test::Harness)
2021-06-16 15:38:40 +08:00
BuildRequires: selinux-policy-devel libevent-devel make gcc
%{?with_sasl:BuildRequires: cyrus-sasl-devel}
%{?with_seccomp:BuildRequires: libseccomp-devel}
2021-06-16 15:38:40 +08:00
%{?with_tls:BuildRequires: openssl-devel}
Requires: %{name}-help = %{version}-%{release}
Requires(pre): shadow-utils
Requires: (%{name}-selinux if selinux-policy-targeted)
%{?systemd_requires}
%description
2021-06-16 15:38:40 +08:00
memcached is a high-performance, distributed memory object caching
system, generic in nature, but intended for use in speeding up dynamic
web applications by alleviating database load.
2021-06-16 15:38:40 +08:00
%package devel
Summary: Header files for memcached development
Requires: memcached = %{epoch}:%{version}-%{release}
%description devel
2021-06-16 15:38:40 +08:00
Install memcached-devel if you are developing C/C++ applications that require
access to the memcached binary include files.
%package selinux
Summary: Selinux policy module
License: GPLv2
BuildRequires: selinux-policy
Requires: selinux-policy >= 35.5
BuildRequires: selinux-policy-devel
Requires(post): selinux-policy-base >= 35.5
Requires(post): libselinux-utils
Requires(post): policycoreutils
Requires(post): policycoreutils-python3
%description selinux
Install memcached-selinux to ensure your system contains the latest SELinux policy
optimised for use with this version of memcached.
%package_help
%prep
2021-06-16 15:38:40 +08:00
%setup -q -b 1
%patch1 -p1 -b .unit
%build
2021-06-16 15:38:40 +08:00
%configure \
%{?with_sasl: --enable-sasl --enable-sasl-pwdb} \
%{?with_seccomp: --enable-seccomp} \
%{?with_tls: --enable-tls}
make %{?_smp_mflags}
pushd ../memcached-selinux-1.0.2
make
%check
2021-06-16 15:38:40 +08:00
%{!?with_tests: exit 0}
rm -f t/whitespace.t
if [ `id -u` -ne 0 ]; then
rm -f t/daemonize.t t/watcher.t t/expirations.t
fi
make test
%install
2021-06-16 15:38:40 +08:00
make install DESTDIR=%{buildroot} INSTALL="%{__install} -p"
rm -f %{buildroot}%{_bindir}/memcached-debug
install -D -p -m 755 scripts/memcached-tool %{buildroot}%{_bindir}/memcached-tool
install -D -p -m 644 scripts/memcached-tool.1 %{buildroot}%{_mandir}/man1/memcached-tool.1
install -D -p -m 644 scripts/memcached.service %{buildroot}%{_unitdir}/memcached.service
install -D -p -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/memcached
2021-06-16 15:38:40 +08:00
cd ../memcached-selinux-1.0.2
install -d %{buildroot}%{_datadir}/selinux/packages
install -d -p %{buildroot}%{_datadir}/selinux/devel/include/contrib
install -m 644 memcached.pp.bz2 %{buildroot}%{_datadir}/selinux/packages
%pre
2021-06-16 15:38:40 +08:00
getent group %{groupname} >/dev/null || groupadd -r %{groupname}
getent passwd %{username} >/dev/null || \
useradd -r -g %{groupname} -d /run/memcached \
-s /sbin/nologin -c "Memcached daemon" %{username}
exit 0
%pre selinux
%selinux_relabel_pre -s targeted
%post
%systemd_post memcached.service
%post selinux
%selinux_modules_install -s targeted -p 200 %{_datadir}/selinux/packages/memcached.pp.bz2 &> /dev/null
%preun
%systemd_preun memcached.service
%postun
%systemd_postun_with_restart memcached.service
%postun selinux
if [ $1 -eq 0 ]; then
%selinux_modules_uninstall -s targeted -p 200 memcached
fi
%posttrans selinux
%selinux_relabel_post -s targeted &> /dev/null
%files
%license COPYING
%config(noreplace) %{_sysconfdir}/sysconfig/memcached
%{_bindir}/memcached-tool
%{_bindir}/memcached
%{_unitdir}/memcached.service
%files devel
%{_includedir}/memcached/*
%files selinux
%license COPYING
%attr(0644,root,root) %{_datadir}/selinux/packages/memcached.pp.bz2
%ghost %{_sharedstatedir}/selinux/targeted/active/modules/200/memcached
%files help
%doc AUTHORS ChangeLog NEWS README.md doc/CONTRIBUTORS doc/*.txt
%{_mandir}/man1/memcached-tool.1*
%{_mandir}/man1/memcached.1*
%changelog
* Mon Jan 10 2022 xu_ping <xuping33@huawei.com> - 0:1.6.12-2
- Use policycoreutils-python3 to fix install failed
* Wed Dec 29 2021 baizhonggui <baizhonggui@huawei.com> - 0:1.6.12-1
- update to 1.6.12
2021-06-16 15:38:40 +08:00
* Tue Jun 15 2021 liyanan <liyanan32@huawei.com> - 0:1.6.9-1
- update to 1.6.9
2021-01-07 18:02:31 +08:00
* Thu Jan 07 2021 wangyue<wangyue92@huawei.com> - 0:1.5.10-6
- fix CVE-2019-15026
* Fri Nov 06 2020 Ge Wang <wangge20@huawei.com> - 0:1.5.10-5
- set help package as memcached package's install require
2020-02-27 02:26:47 -05:00
* Thu Feb 27 2020 Lijin Yang <yanglijin@huawei.com> - 0:1.5.10-4
- fix install failed
* Fri Nov 29 2019 Lijin Yang <yanglijin@huawei.com> - 0:1.5.10-2
- init package
2020-02-19 15:07:50 +08:00
* Wed Feb 19 2020 yuxiangyang <yuxiangyang4@huawei.com> - 0:1.5.10-3
- fix package compile error