]> git.pld-linux.org Git - packages/rpmlint.git/blob - rpmlint.spec
- fix running all tests
[packages/rpmlint.git] / rpmlint.spec
1 #
2 # Conditional build:
3 %bcond_without  tests           # build without tests
4 %bcond_with     rpm4            # build for rpm4
5
6 Summary:        Tool for checking common errors in RPM packages
7 Summary(pl.UTF-8):      Narzędzie do sprawdzania pakietów RPM pod kątem częstych błędów
8 Name:           rpmlint
9 Version:        1.11
10 Release:        0.7
11 License:        GPL v2
12 Group:          Development/Building
13 Source0:        https://github.com/rpm-software-management/rpmlint/archive/%{name}-%{version}.tar.gz
14 # Source0-md5:  2642bb6f08f6e2a2f2c0fe9f07634d49
15 Source1:        %{name}.config
16 Source3:        %{name}-etc.config
17 Patch0:         %{name}-groups.patch
18 Patch1:         pythonpath.patch
19 Patch2:         %{name}-licenses.patch
20 Patch3:         postshell.patch
21 Patch4:         rpm5.patch
22 Patch5:         bash-completion.patch
23 Patch6:         revert-9f71923e.patch
24 Patch7:         rpm4.15.patch
25 Patch8:         python3.patch
26 Patch9:         libc-warnings.patch
27 Patch10:        fix-tests.patch
28 URL:            https://github.com/rpm-software-management/rpmlint
29 %if %{with rpm4}
30 BuildRequires:  python3
31 BuildRequires:  python3-modules
32 %if %{with tests}
33 BuildRequires:  python3-pytest
34 BuildRequires:  python3-flake8
35 BuildRequires:  python3-rpm >= 1:4.16
36 %endif
37 %else
38 BuildRequires:  python >= 1:2.6
39 BuildRequires:  python-modules
40 %if %{with tests}
41 BuildRequires:  python-flake8
42 BuildRequires:  python-pytest
43 BuildRequires:  python-rpm >= 5.4.10-12}
44 %endif
45 %endif
46 BuildRequires:  rpm-pythonprov
47 BuildRequires:  rpmbuild(macros) >= 1.673
48 Requires:       /bin/bash
49 Requires:       /lib/cpp
50 Requires:       binutils
51 Requires:       bzip2
52 Requires:       cpio
53 Requires:       desktop-file-utils
54 Requires:       file
55 Requires:       findutils
56 Requires:       grep
57 Requires:       gzip
58 %if %{with rpm4}
59 Requires:       python3
60 Requires:       python3-magic
61 Requires:       python3-pyenchant
62 Requires:       python3-rpm >= 1:4.16
63 %else
64 Requires:       python >= 1.5.2
65 Requires:       python-magic
66 Requires:       python-pyenchant
67 Requires:       python-rpm >= 5.4.10-12
68 %endif
69 Requires:       xz
70 BuildArch:      noarch
71 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
72
73 %description
74 Rpmlint is a tool to check common errors on rpm packages. Binary and
75 source packages can be checked.
76
77 %description -l pl.UTF-8
78 rpmlint to narzędzie do sprawdzania pakietów RPM pod kątem często
79 występujących błędów. Można sprawdzać pakiety źródłowe i binarne.
80
81 %package -n bash-completion-%{name}
82 Summary:        bash-completion for rpmlint
83 Summary(pl.UTF-8):      Bashowe uzupełnianie parametrów dla polecenia rpmlint
84 Group:          Applications/Shells
85 Requires:       %{name} = %{version}-%{release}
86 Requires:       bash-completion >= 2.0
87
88 %description -n bash-completion-%{name}
89 bash-completion for rpmlint.
90
91 %description -n bash-completion-%{name} -l pl.UTF-8
92 Bashowe uzupełnianie parametrów dla polecenia rpmlint.
93
94 %prep
95 %setup -q -n %{name}-rpmlint-%{version}
96 %{!?with_rpm4:%patch0 -p1}
97 %patch1 -p1
98 %patch2 -p1
99 %patch3 -p1
100 %patch5 -p1
101 %if %{with rpm4}
102 %patch7 -p1
103 %patch8 -p1
104 %else
105 %patch4 -p1
106 %patch6 -p1
107 %endif
108 %patch9 -p1
109 %patch10 -p1
110
111 cp -p config config.example
112 cp -p %{SOURCE3} config
113
114 touch __init__.py
115 %if %{with rpm4}
116 %{__sed} -i -e '1s,/usr/bin/python,%{__python3},' rpmdiff rpmlint
117 %else
118 %{__sed} -i -e '1s,/usr/bin/python,%{__python},' rpmdiff rpmlint
119 %endif
120
121 %build
122 %if %{without rpm4}
123 # Create GROUPS for -groups.patch
124 rpmnv=$(rpm -q rpm --qf '%{N}-%{V}')
125 gzip -dc "%{_docdir}/$rpmnv/groups.gz" | awk '/^[A-Z].*/ { print }' > GROUPS
126 test -s GROUPS
127 %endif
128
129 %{__make} \
130         bash_compdir=%{bash_compdir} \
131 %if %{with rpm4}
132         PYTHON=%{__python3} \
133 %else
134         PYTHON=%{__python} \
135 %endif
136         COMPILE_PYC=1
137
138 %if %{with tests}
139 %{__make} check \
140 %if %{with rpm4}
141         PYTHON=%{__python3} \
142         PYTEST=py.test-3 \
143         FLAKE8=flake8-3 \
144 %else
145         PYTHON=%{__python} \
146         PYTEST=py.test \
147         FLAKE8=flake8 \
148 %endif
149 %endif
150
151 %install
152 rm -rf $RPM_BUILD_ROOT
153 %{__make} install \
154         bash_compdir=%{bash_compdir} \
155 %if %{with rpm4}
156         PYTHON=%{__python3} \
157         LIBDIR=%{py3_sitescriptdir}/%{name} \
158 %else
159         PYTHON=%{__python} \
160         LIBDIR=%{py_sitescriptdir}/%{name} \
161 %endif
162         ETCDIR=%{_sysconfdir} \
163         MANDIR=%{_mandir} \
164         BINDIR=%{_bindir} \
165         DESTDIR=$RPM_BUILD_ROOT
166
167 %if %{with rpm4}
168 %{__mv} $RPM_BUILD_ROOT%{_bindir}/rpmlint $RPM_BUILD_ROOT%{py3_sitescriptdir}/%{name}/rpmlint.py
169 cat <<'EOF' > $RPM_BUILD_ROOT%{_bindir}/rpmlint
170 #!/bin/sh
171 exec %{__python3} -tt -u -O %{py3_sitescriptdir}/%{name}/rpmlint.py "$@"
172 EOF
173 %else
174 %{__mv} $RPM_BUILD_ROOT%{_bindir}/rpmlint $RPM_BUILD_ROOT%{py_sitescriptdir}/%{name}/rpmlint.py
175 cat <<'EOF' > $RPM_BUILD_ROOT%{_bindir}/rpmlint
176 #!/bin/sh
177 exec %{__python} -tt -u -O %{py_sitescriptdir}/%{name}/rpmlint.pyc "$@"
178 EOF
179 %endif
180
181 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}
182 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/%{name}/config
183 %{!?with_rpm4:cp -p GROUPS $RPM_BUILD_ROOT%{_datadir}/%{name}}
184
185 %if %{without rpm4}
186 %py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir}
187 %py_comp $RPM_BUILD_ROOT%{py_sitescriptdir}
188 %py_postclean
189 %endif
190
191 %clean
192 rm -rf $RPM_BUILD_ROOT
193
194 %files
195 %defattr(644,root,root,755)
196 %doc README* config.example
197 %dir %{_sysconfdir}/rpmlint
198 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/rpmlint/config
199 %attr(755,root,root) %{_bindir}/rpmdiff
200 %attr(755,root,root) %{_bindir}/rpmlint
201 %{_mandir}/man1/rpmdiff.1*
202 %{_mandir}/man1/rpmlint.1*
203 %dir %{_datadir}/%{name}
204 %{_datadir}/%{name}/config
205 %if %{with rpm4}
206 %dir %{py3_sitescriptdir}/%{name}
207 %{py3_sitescriptdir}/%{name}/__pycache__
208 %{py3_sitescriptdir}/%{name}/*.py
209 %else
210 %dir %{py_sitescriptdir}/%{name}
211 %{py_sitescriptdir}/%{name}/*.py[co]
212 %{_datadir}/%{name}/GROUPS
213 %endif
214
215 %files -n bash-completion-%{name}
216 %defattr(644,root,root,755)
217 %{bash_compdir}/rpmlint
218 %{bash_compdir}/rpmdiff
This page took 0.133732 seconds and 3 git commands to generate.