git-buildpackage.spec 6.2 KB

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