build deb packages using debbuild

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
This commit is contained in:
Lokesh Mandvekar 2022-05-27 15:21:42 -04:00
parent 63d70b9263
commit b50add8b9b

View File

@ -1,16 +1,24 @@
%if "%{_vendor}" == "debbuild"
%global python3_pkgversion 3
%endif
%global pypi_name podman %global pypi_name podman
%global desc %{pypi_name} is a library of bindings to use the RESTful API for Podman. %global desc %{pypi_name} is a library of bindings to use the RESTful API for Podman.
%global built_tag v4.0.0 %global built_tag v4.0.0
%global built_tag_strip %(b=%{built_tag}; echo ${b:1})
%global gen_version %(b=%{built_tag_strip}; echo ${b/-/"~"})
Name: python-%{pypi_name} Name: python-%{pypi_name}
Epoch: 3 Epoch: 3
Version: %{gen_version} Version: 4.0.0
Release: %autorelease %if "%{_vendor}" == "debbuild"
Summary: RESTful API for Podman Maintainer: Lokesh Mandvekar <lsm5@fedoraproject.org>
License: ASL-2.0
Release: 0%{?dist}
%else
License: ASL 2.0 License: ASL 2.0
Release: %autorelease
%endif
Summary: RESTful API for Podman
URL: https://github.com/containers/%{pypi_name}-py URL: https://github.com/containers/%{pypi_name}-py
Source0: %{url}/releases/download/%{built_tag}/%{pypi_name}-%{version}.tar.gz Source0: %{url}/releases/download/%{built_tag}/%{pypi_name}-%{version}.tar.gz
BuildArch: noarch BuildArch: noarch
@ -19,16 +27,21 @@ BuildArch: noarch
%desc %desc
%package -n python%{python3_pkgversion}-%{pypi_name} %package -n python%{python3_pkgversion}-%{pypi_name}
%if "%{_vendor}" == "debbuild"
BuildRequires: git
BuildRequires: python%{python3_pkgversion}-dev
%else
BuildRequires: git-core BuildRequires: git-core
BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-devel
%if 0%{?rhel} <= 8 %endif
%if ("%{_vendor}" == "debbuild") || (! 0%{?fedora} && 0%{?rhel} <= 8)
BuildRequires: python%{python3_pkgversion}-pytoml BuildRequires: python%{python3_pkgversion}-pytoml
BuildRequires: python%{python3_pkgversion}-pyxdg
BuildRequires: python%{python3_pkgversion}-requests BuildRequires: python%{python3_pkgversion}-requests
BuildRequires: python%{python3_pkgversion}-setuptools BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: python%{python3_pkgversion}-xdg
Requires: python%{python3_pkgversion}-pytoml Requires: python%{python3_pkgversion}-pytoml
Requires: python%{python3_pkgversion}-pyxdg
Requires: python%{python3_pkgversion}-requests Requires: python%{python3_pkgversion}-requests
Requires: python%{python3_pkgversion}-xdg
%else %else
BuildRequires: pyproject-rpm-macros BuildRequires: pyproject-rpm-macros
%endif %endif
@ -44,7 +57,7 @@ Summary: %{summary}
%desc %desc
%prep %prep
%autosetup -Sgit_am -n %{pypi_name}-%{built_tag_strip} %autosetup -Sgit -n %{pypi_name}-%{version}
%if 0%{?fedora} || 0%{?rhel} >= 9 %if 0%{?fedora} || 0%{?rhel} >= 9
%generate_buildrequires %generate_buildrequires
@ -53,20 +66,28 @@ Summary: %{summary}
%build %build
export PBR_VERSION="0.0.0" export PBR_VERSION="0.0.0"
%if "%{_vendor}" == "debbuild"
python3 setup.py sdist bdist
%else
%if 0%{?rhel} <= 8 %if 0%{?rhel} <= 8
%py3_build %py3_build
%else %else
%pyproject_wheel %pyproject_wheel
%endif %endif
%endif
%install %install
export PBR_VERSION="0.0.0" export PBR_VERSION="0.0.0"
%if "%{_vendor}" == "debbuild"
python3 setup.py install --root %{buildroot}
%else
%if 0%{?rhel} <= 8 %if 0%{?rhel} <= 8
%py3_install %py3_install
%else %else
%pyproject_install %pyproject_install
%pyproject_save_files %{pypi_name} %pyproject_save_files %{pypi_name}
%endif %endif
%endif
%if 0%{?rhel} <= 8 %if 0%{?rhel} <= 8
%files -n python3-podman %files -n python3-podman
@ -81,4 +102,6 @@ export PBR_VERSION="0.0.0"
%endif %endif
%changelog %changelog
%if "%{_vendor}" != "debbuild"
%autochangelog %autochangelog
%endif