From b50add8b9b8d6fa80a93ab62aa7c3069822806a9 Mon Sep 17 00:00:00 2001 From: Lokesh Mandvekar Date: Fri, 27 May 2022 15:21:42 -0400 Subject: [PATCH] build deb packages using debbuild Signed-off-by: Lokesh Mandvekar --- python-podman.spec | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/python-podman.spec b/python-podman.spec index 9e2f964..ea6f42d 100644 --- a/python-podman.spec +++ b/python-podman.spec @@ -1,16 +1,24 @@ +%if "%{_vendor}" == "debbuild" +%global python3_pkgversion 3 +%endif + %global pypi_name 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_strip %(b=%{built_tag}; echo ${b:1}) -%global gen_version %(b=%{built_tag_strip}; echo ${b/-/"~"}) Name: python-%{pypi_name} Epoch: 3 -Version: %{gen_version} -Release: %autorelease -Summary: RESTful API for Podman +Version: 4.0.0 +%if "%{_vendor}" == "debbuild" +Maintainer: Lokesh Mandvekar +License: ASL-2.0 +Release: 0%{?dist} +%else License: ASL 2.0 +Release: %autorelease +%endif +Summary: RESTful API for Podman URL: https://github.com/containers/%{pypi_name}-py Source0: %{url}/releases/download/%{built_tag}/%{pypi_name}-%{version}.tar.gz BuildArch: noarch @@ -19,16 +27,21 @@ BuildArch: noarch %desc %package -n python%{python3_pkgversion}-%{pypi_name} +%if "%{_vendor}" == "debbuild" +BuildRequires: git +BuildRequires: python%{python3_pkgversion}-dev +%else BuildRequires: git-core 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}-pyxdg BuildRequires: python%{python3_pkgversion}-requests BuildRequires: python%{python3_pkgversion}-setuptools +BuildRequires: python%{python3_pkgversion}-xdg Requires: python%{python3_pkgversion}-pytoml -Requires: python%{python3_pkgversion}-pyxdg Requires: python%{python3_pkgversion}-requests +Requires: python%{python3_pkgversion}-xdg %else BuildRequires: pyproject-rpm-macros %endif @@ -44,7 +57,7 @@ Summary: %{summary} %desc %prep -%autosetup -Sgit_am -n %{pypi_name}-%{built_tag_strip} +%autosetup -Sgit -n %{pypi_name}-%{version} %if 0%{?fedora} || 0%{?rhel} >= 9 %generate_buildrequires @@ -53,20 +66,28 @@ Summary: %{summary} %build export PBR_VERSION="0.0.0" +%if "%{_vendor}" == "debbuild" +python3 setup.py sdist bdist +%else %if 0%{?rhel} <= 8 %py3_build %else %pyproject_wheel %endif +%endif %install export PBR_VERSION="0.0.0" +%if "%{_vendor}" == "debbuild" +python3 setup.py install --root %{buildroot} +%else %if 0%{?rhel} <= 8 %py3_install %else %pyproject_install %pyproject_save_files %{pypi_name} %endif +%endif %if 0%{?rhel} <= 8 %files -n python3-podman @@ -81,4 +102,6 @@ export PBR_VERSION="0.0.0" %endif %changelog +%if "%{_vendor}" != "debbuild" %autochangelog +%endif