-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmirrmaid.spec
191 lines (165 loc) · 6.76 KB
/
mirrmaid.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
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
# vim: foldmethod=marker
%global min_py_ver 3.6
%global python_package_name mirrmaid
# These values were arbitrarily chosen so as to be within the range of modern
# (201-999) and legacy (201-499) SYS_UID_MIN/SYS_UID_MAX.
# For a proper Fedora/EPEL package these would require assignment from FPC.
# In our case were exempt from their rules, but also subject to potential,
# eventual breakage, hence a fairly high value but still in a safe range.
# See also:
# - http://fedoraproject.org/wiki/Packaging:UsersAndGroups
# - /etc/login.defs for SYS_UID_MIN and SYS_UID_MAX
# - /usr/share/doc/setup*/uidgid for soft static allocations already
# assigned by FPC.
%global sys_uid 468
%global sys_gid 468
Name: mirrmaid
Version: 0.26.0
Release: 1%{?dist}
# {{{1 package meta-data
Summary: efficient mirror manager
Group: Applications/Internet
Vendor: doubledog.org
License: GPLv3+
URL: http://www.doubledog.org/trac/%{name}/
Source0: %{name}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: pandoc
BuildRequires: python%{python3_pkgversion}-devel
%if 0%{?rhel} || 0%{?fedora} && 0%{?fedora} < 30
BuildRequires: systemd
%else
BuildRequires: systemd-rpm-macros
%endif
Requires(pre): shadow-utils
Requires: coreutils
Requires: crontabs
Requires: python%{python3_pkgversion} >= %{min_py_ver}
Requires: python%{python3_pkgversion}-PyYAML
Requires: python3-doubledog >= 3.0.0, python3-doubledog < 4.0.0
Requires: rsync
Requires: util-linux
%description
This package efficiently maintains synchronized target mirrors of source
resources. This is primarily accomplished by a sophisticated wrapper around
the venerable rsync package. The primary advantage of this package over rsync
is the simple yet powerful configuration, automatic cron scheduling and
locking to prevent concurrently running instances from working against each
other.
# {{{1 prep & build
%prep
%setup -q
%build
make build
# {{{1 install
%install
%{__python3} lib/%{name}/setup.py install -O1 --skip-build --root %{buildroot}
install -d -m 0755 %{buildroot}%{_var}/lib/%{name}
install -d -m 0755 %{buildroot}%{_var}/log/%{name}
install -d -m 0755 %{buildroot}/run/lock/%{name}
install -Dp -m 0644 etc/%{name}.conf %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
install -Dp -m 0644 etc/%{name}.cron %{buildroot}%{_sysconfdir}/cron.d/%{name}
install -Dp -m 0644 etc/logging.yaml %{buildroot}%{_sysconfdir}/%{name}/logging.yaml
install -Dp -m 0644 lib/tmpfiles.d/%{name}.conf %{buildroot}%{_tmpfilesdir}/%{name}.conf
# Install bash-completion facilities.
pushd share/bash-completion
for f in *
do
install -Dp -m 0644 $f %{buildroot}%{_datadir}/bash-completion/completions/$f
done
popd
# Compress and install man pages.
pushd share/man/
for section in {1..8}
do
glob=*.${section}.roff
if stat -t $glob &> /dev/null
then
for page in $glob
do
install -dp %{buildroot}/%{_mandir}/man${section}/
base=$(basename $page .roff)
gzip < $page > %{buildroot}/%{_mandir}/man${section}/${base}.gz
done
fi
done
popd
# {{{1 pre
%pre
getent group %{name} >/dev/null || groupadd -f -g %{sys_gid} -r %{name}
if ! getent passwd %{name} >/dev/null
then
if ! getent passwd %{sys_uid} >/dev/null
then
useradd -r -u %{sys_uid} -g %{name} -d /etc/%{name} -s /sbin/nologin \
-c 'efficient mirror manager' %{name}
else
useradd -r -g %{name} -d /etc/%{name} -s /sbin/nologin \
-c 'efficient mirror manager' %{name}
fi
fi
exit 0
# {{{1 files
%files
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
%config(noreplace) %{_sysconfdir}/%{name}/logging.yaml
%config(noreplace) %{_sysconfdir}/cron.d/%{name}
%dir %{python3_sitelib}/%{python_package_name}
%doc %{_mandir}/man[1-8]/*.*
%doc CHANGELOG.md README.md
%doc doc/*
%{_bindir}/%{name}
%{_datadir}/bash-completion/completions/
%{python3_sitelib}/%{python_package_name}/*
%{python3_sitelib}/*egg-info
%defattr(-,%{name},%{name},-)
%{_tmpfilesdir}/%{name}.conf
%{_var}/lib/%{name}
%{_var}/log/%{name}
/run/lock/%{name}
# {{{1 changelog
%changelog
* Thu Dec 03 2020 John Florian <[email protected]> 0.26.0-1
- New - [PyCharm] project inspection scope ([email protected])
- Bug - some failure messages duplicated ([email protected])
- Change - fail more gracefully if privileges cannot be dropped
- New - --dry-run|-n CLI option ([email protected])
- New - bash-completion facilities ([email protected])
- New - README.md ([email protected])
- New - mirrmaid(1) man page ([email protected])
- New - MirrmaidCLI class ([email protected])
- Change - [PyCharm] upgrade caused config schema ([email protected])
- New - max_workers config opt to limit concurrency ([email protected])
- Refactor - replace str.format() with f-string literals
- Bug - rsync orphans after stop/kill ([email protected])
- New - Synchronizer.stop method ([email protected])
- New - Synchronizer._subprocess field ([email protected])
- Change - defer log formatting to logging system ([email protected])
- Janitorial - global code reformat ([email protected])
- Change - Synchronizer now subclasses Thread ([email protected])
- Janitorial - indent yaml by 2 not 4 ([email protected])
- Refactor - rename property Synchronizer._source ([email protected])
- Refactor - rename property Synchronizer._target ([email protected])
- Change - [PyCharm] squelch PEP8 naming convention violation
- Bug - incorrect return type annotation ([email protected])
- New - formal CHANGELOG ([email protected])
- Change - [PyCharm] bump SDK to Python 3.8 ([email protected])
- New - [tito] targets for Fedora 33 ([email protected])
- Drop - [tito] targets for Fedora 30 ([email protected])
- New - [tito] targets for Fedora 32 ([email protected])
- Drop - [tito] targets for Fedora 29 ([email protected])
- New - [tito] targets for CentOS 8 ([email protected])
- New - [tito] targets for Fedora 31 ([email protected])
* Fri Sep 27 2019 John Florian <[email protected]> 0.25.1-3
- Bug - [spec] systemd-tmpfiles s/b under /usr not /etc
- Drop - [tito] targets for Fedora 28 ([email protected])
- New - [tito] targets for Fedora 30 ([email protected])
* Sun Apr 07 2019 John Florian <[email protected]> 0.25.1-2
- Change - bump for EPEL moving to Python 3.6 ([email protected])
- New - [tito] test targets per Fedora release ([email protected])
- Change - [tito] use HTTPS instead of HTTP ([email protected])
- Drop - [tito] targets for Fedora 27 ([email protected])