summaryrefslogtreecommitdiffstats
path: root/receptor.spec
blob: 0d6e8829be7524e8a117e1d4726f29ae2a977125 (plain)
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# Generated by go2rpm 1.9.0
%bcond check 1
%bcond bundled 1
%bcond golang_library %{without bundled}

# https://github.com/ansible/receptor
%global goipath         github.com/ansible/receptor
Version:                1.4.1

%gometa -f

%global goname receptor

%global common_description %{expand:
Receptor is an overlay network intended to ease the distribution of work across
a large and dispersed collection of workers. Receptor nodes establish
peer-to-peer connections with each other via existing networks. Once connected,
the Receptor mesh provides datagram (UDP-like) and stream (TCP-like)
capabilities to applications, as well as robust unit-of-work handling with
resiliency against transient network failures.

See the readthedocs page for Receptor at:

https://receptor.readthedocs.io/en/latest}

%global golicenses      LICENSE.md %{?with_bundled:vendor/modules.txt} license.go
%global godocs          docs tools README.md

Name:           %{goname}
Release:        %autorelease
Summary:        Multi-service relayer with remote execution and orchestration capabilities

# License for github.com/ansible/receptor: Apache-2.0
# License for github.com/creack/pty: MIT
# License for github.com/davecgh/go-spew: ISC
# License for github.com/emicklei/go-restful/v3: MIT
# License for github.com/fortytw2/leaktest: BSD-3-Clause
# License for github.com/fsnotify/fsnotify: BSD-3-Clause
# License for github.com/ghjm/cmdline: Apache-2.0
# License for github.com/go-logr/logr: Apache-2.0
# License for github.com/go-openapi/jsonpointer: Apache-2.0
# License for github.com/go-openapi/jsonreference: Apache-2.0
# License for github.com/go-openapi/swag: Apache-2.0
# License for github.com/go-task/slim-sprig: MIT
# License for github.com/gogo/protobuf: BSD-3-Clause
# License for github.com/golang-jwt/jwt/v4: MIT
# License for github.com/golang/mock: Apache-2.0
# License for github.com/golang/protobuf: BSD-3-Clause
# License for github.com/google/gnostic: Apache-2.0
# License for github.com/google/go-cmp: BSD-3-Clause
# License for github.com/google/gofuzz: Apache-2.0
# License for github.com/google/pprof: Apache-2.0
# License for github.com/google/shlex: Apache-2.0
# License for github.com/google/uuid: BSD-3-Clause
# License for github.com/gorilla/websocket: BSD-2-Clause
# License for github.com/imdario/mergo: BSD-3-Clause
# License for github.com/josharian/intern: MIT
# License for github.com/json-iterator/go: MIT
# License for github.com/jupp0r/go-priority-queue: MIT
# License for github.com/mailru/easyjson: MIT
# License for github.com/minio/highwayhash: Apache-2.0
# License for github.com/moby/spdystream: Apache-2.0
# License for github.com/modern-go/concurrent: Apache-2.0
# License for github.com/modern-go/reflect2: Apache-2.0
# License for github.com/munnerz/goautoneg: BSD-3-Clause
# License for github.com/onsi/ginkgo/v2: MIT
# License for github.com/pbnjay/memory: BSD-3-Clause
# License for github.com/pmezard/go-difflib: BSD-3-Clause
# License for github.com/prep/socketpair: BSD-3-Clause
# License for github.com/quic-go/qtls-go1-19: BSD-3-Clause
# License for github.com/quic-go/qtls-go1-20: BSD-3-Clause
# License for github.com/quic-go/quic-go: MIT
# License for github.com/rogpeppe/go-internal: BSD-3-Clause
# License for github.com/songgao/water: BSD-3-Clause
# License for github.com/spf13/pflag: BSD-3-Clause
# License for github.com/stretchr/testify: MIT
# License for github.com/vishvananda/netlink: Apache-2.0
# License for github.com/vishvananda/netns: Apache-2.0
# License for golang.org/x/crypto: BSD-3-Clause
# License for golang.org/x/exp: BSD-3-Clause
# License for golang.org/x/mod: BSD-3-Clause
# License for golang.org/x/net: BSD-3-Clause
# License for golang.org/x/oauth2: BSD-3-Clause
# License for golang.org/x/sys: BSD-3-Clause
# License for golang.org/x/term: BSD-3-Clause
# License for golang.org/x/text: BSD-3-Clause
# License for golang.org/x/time: BSD-3-Clause
# License for golang.org/x/tools: BSD-3-Clause
# License for google.golang.org/appengine: Apache-2.0
# License for google.golang.org/protobuf: BSD-3-Clause
# License for gopkg.in/inf.v0: BSD-3-Clause
# License for gopkg.in/yaml.v2: Apache-2.0 AND MIT
# License for gopkg.in/yaml.v3: MIT AND Apache-2.0
# License for k8s.io/api: Apache-2.0
# License for k8s.io/apimachinery: Apache-2.0
# License for k8s.io/client-go: Apache-2.0
# License for k8s.io/klog/v2: Apache-2.0
# License for k8s.io/kube-openapi: Apache-2.0
# License for k8s.io/utils: Apache-2.0
# License for sigs.k8s.io/json: Apache-2.0 AND BSD-3-Clause
# License for sigs.k8s.io/structured-merge-diff/v4: Apache-2.0
# License for sigs.k8s.io/yaml: MIT AND BSD-3-Clause
License:        Apache-2.0 AND ISC AND MIT AND BSD-3-Clause AND BSD-2-Clause
URL:            %{gourl}
Source0:        %{gosource}
Source1:        vendor-%{version}.tar.gz
Source2:        bundle_go_deps_for_rpm.sh
Source3: 	receptor.service
Source4: 	receptor@.service
Source5: 	receptor.conf
Source6: 	receptor.conf.example
Source7: 	receptor.pp
Source8:	receptor.sysusers
Source9:	receptor.logrotate
SOurce10:	receptor_tmp.conf
# https://github.com/ansible/receptor/pull/816
Patch:          0001-Bump-quic-go-to-0.37.4.patch

BuildRequires:  python3-devel
BuildRequires:	python3dist(pip)
BuildRequires:	python3dist(setuptools)
BuildRequires:	python3dist(wheel)
BuildRequires:	python3dist(tox)
# For Python tests
BuildRequires:  psmisc
BuildRequires:  openssh
BuildRequires:	openssl
BuildRequires:  systemd-rpm-macros
%{?sysusers_requires_compat}

Requires:	receptorctl
Requires:	python3-receptor-python-worker
Requires:	sos
Requires:	logrotate

Requires(post): libselinux-utils, policycoreutils
Requires(postun): libselinux-utils, policycoreutils

%description %{common_description}

%package -n receptorctl
Summary:        Front-end CLI and importable Python library that interacts with Receptor
Requires:	receptor
Requires:	python3-receptor-python-worker

%description -n receptorctl
Receptorctl is a front-end CLI and importable Python library that interacts
with Receptor over its control socket interface.

%package -n python3-receptor-python-worker
Summary:        Python plugin called by Receptor

%description -n python3-receptor-python-worker
The receptor-python-worker command is called by Receptor to supervise the
operation of a Python worker plugin."

%if %{with golang_library}
%gopkg
%endif

%prep
%autosetup -p1 %{forgesetupargs} %{?with_bundled:-a1}
%goprep -e %{?with_bundled:-k}

# Set versions
echo "%{version}" > receptor-python-worker/.VERSION
echo "%{version}" > receptorctl/.VERSION

%generate_buildrequires
%if %{without bundled}
%go_generate_buildrequires
%endif
cd receptorctl
%pyproject_buildrequires -t

%build
%if %{with bundled}
%global gomodulesmode GO111MODULE=on
export GOFLAGS=-mod=vendor
%endif
export LDFLAGS="-X 'github.com/ansible/receptor/internal/version.Version=%{VERSION}' "
%gobuild -o %{gobuilddir}/bin/receptor %{goipath}/cmd/receptor-cl
pushd receptorctl
%pyproject_wheel
popd
pushd receptor-python-worker
%pyproject_wheel
popd

%install
%if %{with golang_library}
%gopkginstall
%endif
mkdir -p %{buildroot}%{_tmpfilesdir}
install -m 0644 %{SOURCE10}		%{buildroot}%{_tmpfilesdir}/receptor.conf
install -m 0755 -vd			%{buildroot}/var/run/receptor
install -m 0755 -vd                     %{buildroot}/var/log/receptor
install -m 0700 -vd                     %{buildroot}/var/lib/receptor
install -m 0755 -vd                     %{buildroot}%{_sysconfdir}/logrotate.d
install -m 0644 -vp %{SOURCE9}          %{buildroot}%{_sysconfdir}/logrotate.d/receptor
install -m 0755 -vd                     %{buildroot}%{_bindir}
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/
install -m 0755 -vd                     %{buildroot}%{_unitdir}
install -m 0644 -vp %{SOURCE3}          %{buildroot}%{_unitdir}/receptor.service
install -m 0644 -vp %{SOURCE4}          %{buildroot}%{_unitdir}/receptor@.service
install -m 0755 -vd                     %{buildroot}%{_sysconfdir}/receptor
install -m 0644 -vp %{SOURCE5}          %{buildroot}%{_sysconfdir}/receptor/receptor.conf
install -m 0644 -vp %{SOURCE6}          %{buildroot}%{_sysconfdir}/receptor/receptor.conf.example
install -m 0755 -vd                     %{buildroot}%{_datadir}/selinux/packages
install -m 0644 -vp %{SOURCE7}          %{buildroot}%{_datadir}/selinux/packages/receptor.pp
rm -rf tools/examples/simple-network/.gitignore
rm -rf tools/examples/simple-network/socks/.gitignore
%pyproject_install

%pre
%sysusers_create_compat %{SOURCE8}

%post
semodule -n -i %{_datadir}/selinux/packages/receptor.pp
if /usr/sbin/selinuxenabled ; then
    /usr/sbin/load_policy
fi;
exit 0;
%systemd_post receptor.service

%preun
%systemd_preun receptor.service

%postun
if [ $1 -eq 0 ]; then
    semodule -n -r receptor
    if /usr/sbin/selinuxenabled ; then
       /usr/sbin/load_policy
    fi;
fi;
exit 0
%systemd_postun_with_restart receptor.service

%if %{with check}
%check
export PATH="%{gobuilddir}/bin:$PATH"
# Disable various test relying on Kube and network
%gocheck -t tests/functional/mesh
pushd receptorctl
rm -rfv tests/test_mesh.py
%tox
popd
%endif

%files
%license LICENSE.md %{?with_bundled:vendor/modules.txt}
%doc docs tools README.md
%attr(0755,receptor,receptor) %{_bindir}/receptor
%{_datadir}/selinux/packages/receptor.pp
%config(noreplace) %attr(0644,receptor,receptor) %{_sysconfdir}/receptor/receptor.conf
%config(noreplace) %attr(0644,receptor,receptor) %{_sysconfdir}/receptor/receptor.conf.example
%{_unitdir}/receptor.service
%{_unitdir}/receptor@.service
%dir %attr(0700,receptor,receptor) /var/lib/receptor
%dir %attr(0755,receptor,receptor) /var/log/receptor
%dir %attr(0755,receptor,receptor) /var/run/receptor
%{_sysconfdir}/logrotate.d/receptor
%{_tmpfilesdir}/receptor.conf

%files -n receptorctl
%doc receptorctl/README.md
%{_bindir}/receptorctl
%{python3_sitelib}/receptorctl/
%{python3_sitelib}/receptorctl-%{version}.dist-info/

%files -n python3-receptor-python-worker
%doc receptor-python-worker/README.md
%{_bindir}/receptor-python-worker
%{python3_sitelib}/receptor_python_worker/
%{python3_sitelib}/receptor_python_worker-%{version}.dist-info/

%if %{with golang_library}
%gopkgfiles
%endif

%changelog
%autochangelog