git-buildpackage.spec 6.61 KB
Newer Older
1 2 3 4 5
# Add --without docs rpmbuild option, i.e. docs are enabled by default
%bcond_without docs

Name:       git-buildpackage
Summary:    Build packages from git
6
Version:    0.9.7
7 8 9 10 11 12 13 14
Release:    0
Group:      Development/Tools/Building
License:    GPLv2
BuildArch:  noarch
URL:        https://honk.sigxcpu.org/piki/projects/git-buildpackage/
Source0:    %{name}_%{version}.tar.gz

# Conditional package names for requirements
15
%if 0%{?fedora} || 0%{?centos_ver} >= 7
16 17
%define dpkg_pkg_name dpkg-dev
%else
18
%if 0%{?centos_ver}
19 20 21 22 23 24 25 26 27 28 29 30
%define dpkg_pkg_name dpkg-devel
%else
%define dpkg_pkg_name dpkg
%endif
%endif

%if 0%{?fedora}
%define man_pkg_name man-db
%else
%define man_pkg_name man
%endif

31
%if 0%{?suse_version}
32
%define python_pkg_name python-base
33 34
%else
%define python_pkg_name python
35 36 37 38 39 40 41 42 43 44
%endif

%if 0%{?tizen_version:1}
%define rpm_python_pkg_name python-rpm
%else
%define rpm_python_pkg_name rpm-python
%endif

Requires:   %{name}-common = %{version}-%{release}
Requires:   %{dpkg_pkg_name}
45
Requires:   devscripts
46 47
BuildRequires:  python3
BuildRequires:  python3-setuptools
48 49

%if %{with docs}
50
BuildRequires:  docbook2x
51
BuildRequires:  gtk-doc
52
BuildRequires:  libxslt-tools
53 54 55 56 57 58
%if 0%{?fedora}
BuildRequires:  perl-podlators
%endif
%endif

%if 0%{?do_unittests}
59 60 61
BuildRequires:  python3-coverage
BuildRequires:  python3-mock
BuildRequires:  python3-nose
62 63 64
BuildRequires:  git-core
BuildRequires:  %{man_pkg_name}
BuildRequires:  %{dpkg_pkg_name}
65
BuildRequires:  devscripts
66 67
BuildRequires:  rpm-build
BuildRequires:  %{rpm_python_pkg_name}
68
BuildRequires:  pristine-tar
69
BuildRequires:  unzip
70
BuildRequires:  /usr/bin/zipmerge
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
BuildRequires:  gnupg
# Missing dep of dpkg in openSUSE
%if 0%{?suse_version}
BuildRequires:  perl-TimeDate
%endif
%endif

%description
Set of tools from Debian that integrate the package build system with Git.
This package contains the original Debian tools.


%package common
Summary:    Common files for git-buildpackage debian and rpm tools
Group:      Development/Tools/Building
Requires:   git-core
Requires:   %{man_pkg_name}
Requires:   %{python_pkg_name}
89 90
Requires:   python3-setuptools
Requires:   python3-dateutil
91
%if 0%{?centos_ver} && 0%{?centos_ver} <= 7
92
Requires:       unzip
93
Requires:       /usr/bin/zipmerge
94 95
%else
Recommends:     unzip
96
Recommends:     /usr/bin/zipmerge
97
Recommends:     pristine-tar
98
%endif
99 100 101 102 103 104 105 106 107 108 109

%description common
Common files and documentation, used by both git-buildpackage debian and rpm tools


%package rpm
Summary:    Build RPM packages from git
Group:      Development/Tools/Building
Requires:   %{name}-common = %{version}-%{release}
Requires:   rpm
Requires:   %{rpm_python_pkg_name}
110
%if 0%{?centos_ver} && 0%{?centos_ver} <= 7
111
Requires:   rpm-build
112 113
%else
Recommends: rpm-build
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
%endif

%description rpm
Set of tools from Debian that integrate the package build system with Git.
This package contains the tools for building RPM packages.

%if %{with docs}
%package doc
Summary:    Documentation for the git-buildpackage suite
Group:      Development/Tools/Building

%description doc
This package contains documentation for the git-buildpackage suite - both the
Debian and the RPM tool set.
%endif


%prep
%setup -q -n %{name}-%{version}



%build
137
WITHOUT_NOSETESTS=1 %{__python3} ./setup.py build
138 139 140 141 142 143 144 145 146 147 148 149

%if %{with docs}
# HTML docs
HAVE_SGML2X=0 make -C docs/
%endif


%if 0%{?do_unittests}
%check
GIT_CEILING_DIRECTORIES=%{_builddir} \
    GIT_AUTHOR_EMAIL=rpmbuild@example.com GIT_AUTHOR_NAME=rpmbuild \
    GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL \
150
    %{__python3} setup.py nosetests
151 152 153 154 155
%endif


%install
rm -rf %{buildroot}
156 157
WITHOUT_NOSETESTS=1 %{__python3} ./setup.py install --root=%{buildroot} --prefix=/usr --install-lib=%{python_sitelib}
find %{buildroot} -name __pycache__ | xargs rm -r
158 159
mkdir -p %{buildroot}/usr/share/%{name}
mv %{buildroot}/usr/bin/gbp-builder-mock %{buildroot}/usr/share/%{name}/
160 161
mkdir -p %{buildroot}/%{_sysconfdir}/git-buildpackage/
mv %{buildroot}/usr/share/%{name}/gbp.conf %{buildroot}/%{_sysconfdir}/git-buildpackage/
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179

%if %{with docs}
# Install man pages
install -d  %{buildroot}%{_mandir}/man1 %{buildroot}%{_mandir}/man5
install docs/*.1 %{buildroot}%{_mandir}/man1/
install docs/*.5 %{buildroot}%{_mandir}/man5/

# Install html documentation
mkdir -p %{buildroot}%{_docdir}/%{name}
cp -r docs/manual-html %{buildroot}%{_docdir}/%{name}
%endif

cat > files.list << EOF
%{_bindir}/git-pbuilder
%{python_sitelib}/gbp/deb
%{python_sitelib}/gbp/scripts/pq.py*
%{python_sitelib}/gbp/scripts/buildpackage.py*
%{python_sitelib}/gbp/scripts/dch.py*
180
%{python_sitelib}/gbp/scripts/export_orig.py*
181 182 183 184 185 186 187 188 189 190 191
%{python_sitelib}/gbp/scripts/import_dsc.py*
%{python_sitelib}/gbp/scripts/import_dscs.py*
%{python_sitelib}/gbp/scripts/import_orig.py*
%{python_sitelib}/gbp/scripts/create_remote_repo.py*
EOF

%if %{with docs}
cat >> files.list << EOF
%{_mandir}/man1/gbp-buildpackage.1*
%{_mandir}/man1/gbp-create-remote-repo.1*
%{_mandir}/man1/gbp-dch.1*
192
%{_mandir}/man1/gbp-export-orig.1*
193 194 195 196 197 198 199 200 201
%{_mandir}/man1/gbp-import-dsc.1*
%{_mandir}/man1/gbp-import-dscs.1*
%{_mandir}/man1/gbp-import-orig.1*
%{_mandir}/man1/gbp-pq.1*
%{_mandir}/man1/git-pbuilder.1*
EOF
%endif

# Disable the Debian tools for old CentOS
202
%if 0%{?centos_ver} && 0%{?centos_ver} < 7
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225
for f in `cat files.list`; do
    rm -rfv %{buildroot}/$f
done

%else

%files -f files.list
%defattr(-,root,root,-)
%endif

%files common
%defattr(-,root,root,-)
%{_bindir}/gbp
%dir %{python_sitelib}/gbp
%dir %{python_sitelib}/gbp/git
%dir %{python_sitelib}/gbp/pkg
%dir %{python_sitelib}/gbp/scripts
%dir %{python_sitelib}/gbp/scripts/common
%{python_sitelib}/gbp-*
%{python_sitelib}/gbp/*.py*
%{python_sitelib}/gbp/scripts/__init__.py*
%{python_sitelib}/gbp/scripts/clone.py*
%{python_sitelib}/gbp/scripts/config.py*
226
%{python_sitelib}/gbp/scripts/pristine_tar.py*
227
%{python_sitelib}/gbp/scripts/pull.py*
228
%{python_sitelib}/gbp/scripts/push.py*
229
%{python_sitelib}/gbp/scripts/supercommand.py*
Guido Günther's avatar
Guido Günther committed
230
%{python_sitelib}/gbp/scripts/tag.py*
231 232 233 234 235 236 237 238
%{python_sitelib}/gbp/scripts/common/*.py*
%{python_sitelib}/gbp/git/*.py*
%{python_sitelib}/gbp/pkg/*.py*
%config %{_sysconfdir}/git-buildpackage
%if %{with docs}
%{_mandir}/man1/gbp.1*
%{_mandir}/man1/gbp-clone.1*
%{_mandir}/man1/gbp-config.1*
239
%{_mandir}/man1/gbp-pristine-tar.1*
240
%{_mandir}/man1/gbp-pull.1*
241
%{_mandir}/man1/gbp-push.1*
Guido Günther's avatar
Guido Günther committed
242
%{_mandir}/man1/gbp-tag.1*
243 244 245 246 247 248 249 250 251
%{_mandir}/man5/*.5*
%endif


%files rpm
%defattr(-,root,root,-)
%dir %{python_sitelib}/gbp/rpm
%{python_sitelib}/gbp/scripts/*rpm*.py*
%{python_sitelib}/gbp/rpm/*py*
252
/usr/share/git-buildpackage/gbp-builder-mock
253
%if %{with docs}
254
%{_mandir}/man1/gbp-buildpackage-rpm.1*
Guido Günther's avatar
Guido Günther committed
255 256
%{_mandir}/man1/gbp-pq-rpm.1*
%{_mandir}/man1/gbp-import-srpm.1*
Markus Lehtonen's avatar
Markus Lehtonen committed
257
%{_mandir}/man1/gbp-rpm-ch.1*
258 259 260 261 262 263 264 265
%endif


%if %{with docs}
%files doc
%defattr(-,root,root,-)
%{_docdir}/%{name}/
%endif