e58e31872e6dcb85679c93308ba7d74b26e7f289
[tools/git-buildpackage.git] / packaging / git-buildpackage.spec
1 # Add --without docs rpmbuild option, i.e. docs are enabled by default
2 %bcond_without docs
3
4 Name:       git-buildpackage
5 Summary:    Build packages from git
6 Version:    0.6.6
7 Release:    0
8 Group:      Development/Tools/Building
9 License:    GPLv2
10 BuildArch:  noarch
11 URL:        https://honk.sigxcpu.org/piki/projects/git-buildpackage/
12 Source0:    %{name}_%{version}.tar.gz
13
14 # Conditional package names for requirements
15 %if 0%{?fedora} || 0%{?centos_ver}
16 %define dpkg_pkg_name dpkg-devel
17 %else
18 %define dpkg_pkg_name dpkg
19 %endif
20
21 %if 0%{?suse_version} && 0%{?suse_version} < 1230
22 %define devscripts_pkg_name devscripts-fixes
23 %else
24 %define devscripts_pkg_name devscripts
25 %endif
26
27 %if 0%{?fedora}
28 %define man_pkg_name man-db
29 %else
30 %define man_pkg_name man
31 %endif
32
33 %if 0%{?fedora} || 0%{?centos_ver} || 0%{?tizen_version:1}
34 %define python_pkg_name python
35 %else
36 %define python_pkg_name python-base
37 %endif
38
39 %if 0%{?tizen_version:1}
40 %define rpm_python_pkg_name python-rpm
41 %else
42 %define rpm_python_pkg_name rpm-python
43 %endif
44
45 Requires:   %{name}-common = %{version}-%{release}
46 Requires:   %{dpkg_pkg_name}
47 Requires:   %{devscripts_pkg_name}
48 BuildRequires:  python
49 BuildRequires:  python-setuptools
50
51 %if %{with docs}
52 BuildRequires:  docbook-utils
53 BuildRequires:  gtk-doc
54 BuildRequires:  epydoc
55 %if 0%{?fedora}
56 BuildRequires:  perl-podlators
57 %endif
58 %endif
59
60 %if 0%{?do_unittests}
61 BuildRequires:  python-coverage
62 BuildRequires:  python-nose
63 BuildRequires:  git-core
64 BuildRequires:  %{man_pkg_name}
65 BuildRequires:  %{dpkg_pkg_name}
66 BuildRequires:  %{rpm_python_pkg_name}
67 BuildRequires:  pristine-tar
68 BuildRequires:  unzip
69 BuildRequires:  libzip
70 BuildRequires:  gnupg
71 # Missing dep of dpkg in openSUSE
72 %if 0%{?suse_version}
73 BuildRequires:  perl-TimeDate
74 %endif
75 %endif
76
77 %description
78 Set of tools from Debian that integrate the package build system with Git.
79 This package contains the original Debian tools.
80
81
82 %package common
83 Summary:    Common files for git-buildpackage debian and rpm tools
84 Group:      Development/Tools/Building
85 Requires:   git-core
86 Requires:   %{man_pkg_name}
87 Requires:   %{python_pkg_name}
88 %if 0%{?suse_version} || 0%{?tizen_version:1}
89 Recommends:     pristine-tar
90 Recommends:     unzip
91 Recommends:     libzip
92 %else
93 Requires:       pristine-tar
94 Requires:       unzip
95 Requires:       libzip
96 %endif
97
98 %description common
99 Common files and documentation, used by both git-buildpackage debian and rpm tools
100
101
102 %package rpm
103 Summary:    Build RPM packages from git
104 Group:      Development/Tools/Building
105 Requires:   %{name}-common = %{version}-%{release}
106 Requires:   rpm
107 Requires:   %{rpm_python_pkg_name}
108 %if 0%{?suse_version} || 0%{?tizen_version:1}
109 Recommends: rpm-build
110 %else
111 Requires:   rpm-build
112 %endif
113 Provides:   tizen-gbp-rpm = 20130902
114
115 %description rpm
116 Set of tools from Debian that integrate the package build system with Git.
117 This package contains the tools for building RPM packages.
118
119
120 %if %{with docs}
121 %package doc
122 Summary:    Documentation for the git-buildpackage suite
123 Group:      Development/Tools/Building
124
125 %description doc
126 This package contains documentation for the git-buildpackage suite - both the
127 Debian and the RPM tool set.
128 %endif
129
130
131 %prep
132 %setup -q -n %{name}-%{version}
133
134
135
136 %build
137 WITHOUT_NOSETESTS=1 %{__python} ./setup.py build
138
139 %if %{with docs}
140 # Prepare apidocs
141 epydoc -n git-buildpackage --no-sourcecode -o docs/apidocs/ \
142     gbp*.py git*.py gbp/
143
144 # HTML docs
145 HAVE_SGML2X=0 make -C docs/
146 %endif
147
148
149 %if 0%{?do_unittests}
150 %check
151 GIT_CEILING_DIRECTORIES=%{_builddir} \
152     GIT_AUTHOR_EMAIL=rpmbuild@example.com GIT_AUTHOR_NAME=rpmbuild \
153     GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL \
154     %{__python} setup.py nosetests
155 %endif
156
157
158 %install
159 rm -rf %{buildroot}
160 WITHOUT_NOSETESTS=1 %{__python} ./setup.py install --root=%{buildroot} --prefix=/usr
161 rm -rf %{buildroot}%{python_sitelib}/*info
162
163 %if %{with docs}
164 # Install man pages
165 install -d  %{buildroot}%{_mandir}/man1 %{buildroot}%{_mandir}/man5
166 install docs/*.1 %{buildroot}%{_mandir}/man1/
167 install docs/*.5 %{buildroot}%{_mandir}/man5/
168
169 # Install html documentation
170 mkdir -p %{buildroot}%{_docdir}/%{name}
171 cp -r docs/manual-html %{buildroot}%{_docdir}/%{name}
172 cp -r docs/apidocs %{buildroot}%{_docdir}/%{name}
173 %endif
174
175 cat > files.list << EOF
176 %{_bindir}/gbp-pq
177 %{_bindir}/git-buildpackage
178 %{_bindir}/git-dch
179 %{_bindir}/git-import-dsc
180 %{_bindir}/git-import-dscs
181 %{_bindir}/git-import-orig
182 %{_bindir}/git-pbuilder
183 %{_bindir}/gbp-create-remote-repo
184 %{python_sitelib}/gbp/deb
185 %{python_sitelib}/gbp/scripts/pq.py*
186 %{python_sitelib}/gbp/scripts/buildpackage.py*
187 %{python_sitelib}/gbp/scripts/dch.py*
188 %{python_sitelib}/gbp/scripts/import_dsc.py*
189 %{python_sitelib}/gbp/scripts/import_dscs.py*
190 %{python_sitelib}/gbp/scripts/import_orig.py*
191 %{python_sitelib}/gbp/scripts/create_remote_repo.py*
192 EOF
193
194 %if %{with docs}
195 cat >> files.list << EOF
196 %{_mandir}/man1/gbp-buildpackage.1*
197 %{_mandir}/man1/gbp-create-remote-repo.1*
198 %{_mandir}/man1/gbp-dch.1*
199 %{_mandir}/man1/gbp-import-dsc.1*
200 %{_mandir}/man1/gbp-import-dscs.1*
201 %{_mandir}/man1/gbp-import-orig.1*
202 %{_mandir}/man1/gbp-pq.1*
203 %{_mandir}/man1/git-pbuilder.1*
204 EOF
205 %endif
206
207 # Disable the debian tools for CentOS
208 %if 0%{?centos_version}
209 for f in `cat files.list`; do
210     rm -rfv %{buildroot}/$f
211 done
212
213 %else
214
215 %files -f files.list
216 %defattr(-,root,root,-)
217 %endif
218
219 %files common
220 %defattr(-,root,root,-)
221 %{_bindir}/gbp
222 %{_bindir}/gbp-clone
223 %{_bindir}/gbp-pull
224 %dir %{python_sitelib}/gbp
225 %dir %{python_sitelib}/gbp/git
226 %dir %{python_sitelib}/gbp/pkg
227 %dir %{python_sitelib}/gbp/scripts
228 %dir %{python_sitelib}/gbp/scripts/common
229 %{python_sitelib}/gbp/*.py*
230 %{python_sitelib}/gbp/scripts/__init__.py*
231 %{python_sitelib}/gbp/scripts/clone.py*
232 %{python_sitelib}/gbp/scripts/config.py*
233 %{python_sitelib}/gbp/scripts/pull.py*
234 %{python_sitelib}/gbp/scripts/supercommand.py*
235 %{python_sitelib}/gbp/scripts/common/*.py*
236 %{python_sitelib}/gbp/git/*.py*
237 %{python_sitelib}/gbp/pkg/*.py*
238 %config %{_sysconfdir}/git-buildpackage
239 %if %{with docs}
240 %{_mandir}/man1/gbp.1*
241 %{_mandir}/man1/gbp-clone.1*
242 %{_mandir}/man1/gbp-config.1*
243 %{_mandir}/man1/gbp-pull.1*
244 %{_mandir}/man5/*.5*
245 %endif
246
247
248 %files rpm
249 %defattr(-,root,root,-)
250 %dir %{python_sitelib}/gbp/rpm
251 %{python_sitelib}/gbp/scripts/*rpm*.py*
252 %{python_sitelib}/gbp/rpm/*py*
253
254
255 %if %{with docs}
256 %files doc
257 %defattr(-,root,root,-)
258 %{_docdir}/%{name}/
259 %endif