generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the ability to build Python 3.11 and 3.12
Signed-off-by: Stephen Brennan <[email protected]>
- Loading branch information
Showing
1 changed file
with
82 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,24 @@ | ||
# Copyright (c) 2024, Oracle and/or its affiliates. | ||
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ | ||
%if 0%{?rhel} == 8 || 0%{?rhel} == 9 | ||
%global with_python311 1 | ||
%global with_python312 1 | ||
%else | ||
%global with_python311 0 | ||
%global with_python312 0 | ||
%endif | ||
|
||
%if %{with_python311} | ||
%global __python311 /usr/bin/python3.11 | ||
%global python311_sitelib /usr/lib/python3.11/site-packages | ||
%endif | ||
|
||
%if %{with_python312} | ||
%global __python312 /usr/bin/python3.12 | ||
%global python312_sitelib /usr/lib/python3.12/site-packages | ||
%endif | ||
|
||
|
||
Name: python-drgn-tools | ||
Version: 1.1.0 | ||
Release: 1%{?dist} | ||
|
@@ -15,8 +34,20 @@ BuildRequires: python%{python3_pkgversion}-devel | |
BuildRequires: python%{python3_pkgversion}-setuptools | ||
BuildRequires: python%{python3_pkgversion}-pip | ||
BuildRequires: python%{python3_pkgversion}-wheel | ||
|
||
%global python_wheelname drgn_tools-%{version}-py3-none-any.whl | ||
%if %{with_python311} | ||
BuildRequires: python3.11-devel | ||
BuildRequires: python3.11-setuptools | ||
BuildRequires: python3.11-pip | ||
BuildRequires: python3.11-wheel | ||
%endif | ||
%if %{with_python312} | ||
BuildRequires: python3.12-devel | ||
BuildRequires: python3.12-setuptools | ||
BuildRequires: python3.12-pip | ||
BuildRequires: python3.12-wheel | ||
%endif | ||
|
||
%global platform_python %{__python3} | ||
|
||
%global _description %{expand: | ||
drgn-tools extends the drgn debugger with scripts & helpers developed by the | ||
|
@@ -25,23 +56,52 @@ allows users to extract diagnostic information from a kernel core dump, or from | |
a running kernel image (via /proc/kcore).} | ||
%description %{_description} | ||
|
||
%package -n drgn-tools | ||
Summary: %{summary} | ||
# The drgn dependency can be fulfilled by drgn with, or without, CTF support. | ||
# However, drgn-tools is tied to specific drgn releases. | ||
Requires: drgn >= 0.0.25, drgn < 0.0.30 | ||
%global drgn_min 0.0.25 | ||
%global drgn_max 0.0.30 | ||
|
||
%package -n drgn-tools | ||
Summary: %{summary} | ||
Requires: drgn >= %{drgn_min}, drgn < %{drgn_max} | ||
%description -n drgn-tools %{_description} | ||
|
||
%if %{with_python311} | ||
%package -n python3.11-drgn-tools | ||
Summary: %{summary} | ||
Requires: python3.11-drgn >= %{drgn_min}, python3.11-drgn < %{drgn_max} | ||
%description -n python3.11-drgn-tools %{_description} | ||
%endif | ||
|
||
%if %{with_python312} | ||
%package -n python3.12-drgn-tools | ||
Summary: %{summary} | ||
Requires: python3.12-drgn >= %{drgn_min}, python3.12-drgn < %{drgn_max} | ||
%description -n python3.12-drgn-tools %{_description} | ||
%endif | ||
|
||
%prep | ||
%autosetup -n drgn-tools-%{version} | ||
echo '__version__ = "%{version}"' > drgn_tools/_version.py | ||
|
||
%build | ||
%py3_build_wheel | ||
%py3_build | ||
|
||
|
||
%install | ||
%py3_install_wheel %{python_wheelname} | ||
# Install alternative Python versions first, so that the corelens script points | ||
# to the last one which is installed: the platform python. | ||
%if %{with_python311} | ||
%global __python3 %{__python311} | ||
%py3_install | ||
%endif | ||
%if %{with_python312} | ||
%global __python3 %{__python312} | ||
%py3_install | ||
%endif | ||
%global __python3 %{platform_python} | ||
|
||
%py3_install | ||
gzip man/corelens.1 | ||
install -m644 -D man/corelens.1.gz %{buildroot}%{_mandir}/man1/corelens.1.gz | ||
|
||
|
@@ -52,11 +112,25 @@ rm %{buildroot}/usr/bin/DRGN | |
|
||
%files -n drgn-tools | ||
%license LICENSE.txt | ||
%{python3_sitelib}/drgn_tools-*.dist-info/ | ||
%{python3_sitelib}/drgn_tools-*.egg-info/ | ||
%{python3_sitelib}/drgn_tools/* | ||
/usr/bin/corelens | ||
%{_mandir}/man1/corelens.1.gz | ||
|
||
%if %{with_python311} | ||
%files -n python3.11-drgn-tools | ||
%license LICENSE.txt | ||
%{python311_sitelib}/drgn_tools-*.egg-info/ | ||
%{python311_sitelib}/drgn_tools/* | ||
%endif | ||
|
||
%if %{with_python312} | ||
%files -n python3.12-drgn-tools | ||
%license LICENSE.txt | ||
%{python312_sitelib}/drgn_tools-*.egg-info/ | ||
%{python312_sitelib}/drgn_tools/* | ||
%endif | ||
|
||
%changelog | ||
* Tue Aug 27 2024 Stephen Brennan <[email protected]> - 1.1.0-1 | ||
- Update to 1.1.0 | ||
|