Skip to content

Commit

Permalink
Merge pull request #296 from lsm5/packit-cleanup
Browse files Browse the repository at this point in the history
[CI:BUILD] RPM: Cleanup
  • Loading branch information
openshift-merge-robot authored Jun 30, 2023
2 parents b0d4a21 + cfa7c5c commit c9df29c
Showing 1 changed file with 16 additions and 33 deletions.
49 changes: 16 additions & 33 deletions rpm/python-podman.spec
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
# copr_username is only set on copr environments, not on others like koji
# This is used to set custom epoch value for builds on coprs owned by
# rhcontainerbot.
%if "%{?copr_username}" != "rhcontainerbot"
%bcond_with copr
%else
%bcond_without copr
%endif

# RHEL 8 envs can't use autochangelog yet,
# has slightly different python deps
# and also doesn't support generate_buildrequires.
%if !0%{?fedora} && 0%{?rhel} <= 8
%bcond_without changelog
%bcond_without rhel8_py
%else
%bcond_with changelog
%bcond_with rhel8_py
# RHEL 8 envs has slightly different python deps
# and also doesn't support dynamic (build)requires.
%if %{defined rhel} && 0%{?rhel} == 8
%define rhel8_py 1
%endif

%global pypi_name podman
Expand All @@ -24,7 +10,7 @@
%global pypi_dist 4

Name: python-%{pypi_name}
%if %{with copr}
%if %{defined copr_username}
Epoch: 102
%else
Epoch: 3
Expand All @@ -50,19 +36,16 @@ BuildArch: noarch
%package -n python%{python3_pkgversion}-%{pypi_name}
BuildRequires: git-core
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-requests
%if %{with rhel8_py}
BuildRequires: python%{python3_pkgversion}-devel
%if %{defined rhel8_py}
BuildRequires: python%{python3_pkgversion}-rpm-macros
BuildRequires: python%{python3_pkgversion}-pytoml
BuildRequires: python%{python3_pkgversion}-requests
Requires: python%{python3_pkgversion}-pytoml
Requires: python%{python3_pkgversion}-requests
%else
BuildRequires: pyproject-rpm-macros
BuildRequires: python%{python3_pkgversion}-toml
Requires: python%{python3_pkgversion}-toml
%endif
Requires: python%{python3_pkgversion}-requests
Provides: %{pypi_name}-py = %{version}-%{release}
Provides: %{pypi_name}-py = %{epoch}:%{version}-%{release}
Provides: python%{python3_pkgversion}dist(%{pypi_name}) = %{pypi_dist}
Provides: python%{python3_version}dist(%{pypi_name}) = %{pypi_dist}
Obsoletes: python%{python3_pkgversion}-%{pypi_name}-api <= 0.0.0-1
Expand All @@ -76,29 +59,29 @@ Summary: %{summary}
%prep
%autosetup -Sgit -n %{pypi_name}-py-%{version}

%if %{without rhel8_py}
%if !%{defined rhel8_py}
%generate_buildrequires
%pyproject_buildrequires %{?with_tests:-t}
%endif

%build
export PBR_VERSION="0.0.0"
%if %{with rhel8_py}
%if %{defined rhel8_py}
%py3_build
%else
%pyproject_wheel
%endif

%install
export PBR_VERSION="0.0.0"
%if %{with rhel8_py}
%if %{defined rhel8_py}
%py3_install
%else
%pyproject_install
%pyproject_save_files %{pypi_name}
%endif

%if %{with rhel8_py}
%if %{defined rhel8_py}
%files -n python%{python3_pkgversion}-%{pypi_name}
%dir %{python3_sitelib}/%{pypi_name}-*-py%{python3_version}.egg-info
%{python3_sitelib}/%{pypi_name}-*-py%{python3_version}.egg-info/*
Expand All @@ -111,9 +94,9 @@ export PBR_VERSION="0.0.0"
%doc README.md

%changelog
%if %{with changelog}
%if %{defined autochangelog}
%autochangelog
%else
* Mon May 01 2023 RH Container Bot <[email protected]>
- Placeholder changelog for envs that are not autochangelog-ready
%else
%autochangelog
%endif

0 comments on commit c9df29c

Please sign in to comment.