-
-
Notifications
You must be signed in to change notification settings - Fork 94
/
loudml.spec
115 lines (85 loc) · 2.65 KB
/
loudml.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
%global srcname loudml
# Turn off Python bytecode compilation to reduce package size
# See #manual-bytecompilation on docs.fedoraproject.org
%undefine __brp_python_bytecompile
%global __python %{__python3}
%global _enable_debug_package 0
%global debug_package %{nil}
%global __os_install_post /usr/lib/rpm/brp-compress %{nil}
Name: loudml
Version: 1.6.0
Release: 1%{?dist}
Summary: Loud ML core package
Group: Applications/System
License: MIT
URL: www.loudml.io
# Source is created by:
# git clone %%url
# tito build --tgz --tag %%name-%%version-%%release
Source0: %name-%version.tar.gz
BuildRequires: git
BuildRequires: gcc
BuildRequires: python3-devel
BuildRequires: python3-pip
BuildRequires: python3-rpm-macros
BuildRequires: systemd
BuildRequires: systemd-units
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
Requires: python3-setuptools
%{?systemd_requires}
AutoReqProv: no
# Disable debug package
%define debug_package %{nil}
%description
%prep
%setup -q
%build
make clean
%py3_build
%pre
if ! getent group loudml; then
groupadd --system loudml
fi
if ! getent passwd loudml; then
useradd --comment "Loud ML" --gid loudml --no-create-home --system --shell /sbin/nologin loudml
fi
%post
%systemd_post loudmld.service
%preun
%systemd_preun loudmld.service
%postun
%systemd_postun_with_restart loudmld.service
%install
PYTHONUSERBASE=%{buildroot}/opt/venvs/loudml/ \
pip3 install --user -r requirements.txt .[cpu]
PYTHONUSERBASE=%{buildroot}/opt/venvs/loudml/ \
%py3_install
find %{buildroot}/opt/venvs/loudml/lib -name "*.so" \
| xargs strip --strip-unneeded
install -m 0755 -d %{buildroot}/%{_datarootdir}/loudml
install -m 0644 LICENSE %{buildroot}/%{_datarootdir}/loudml/LICENSE
# Loud ML daemon configuration
install -m 0755 -d %{buildroot}/%{_sysconfdir}/loudml
install -m 0755 -d %{buildroot}/%{_sysconfdir}/loudml/plugins.d
install -m 0644 examples/config.yml %{buildroot}/%{_sysconfdir}/loudml/config.yml
%{__install} -m 0644 -D systemd/loudmld.service %{buildroot}/%{_unitdir}/loudmld.service
install -m 0775 -d %{buildroot}/%{_sharedstatedir}/loudml
cp -r templates %{buildroot}/%{_sharedstatedir}/loudml
%files
%defattr(-,root,root,-)
%{_bindir}/*
%license %{_datarootdir}/loudml/LICENSE
%attr(2775,loudml,loudml) /opt/venvs/loudml/
%{python3_sitelib}/%{srcname}-*.egg-info/
%{python3_sitelib}/%{srcname}/
# Loud ML daemon configuration
%attr(2777,root,loudml) %{_sysconfdir}/loudml/
%config(noreplace) %{_sysconfdir}/loudml/config.yml
%{_unitdir}/loudmld.service
%attr(2775,loudml,loudml) %{_sharedstatedir}/loudml/
%doc
%changelog
* Sun Feb 02 2020 Sebastien Leger <[email protected]>
- new package built with tito