From 6ebb5b1dc5ebb42b1dc7f5e0def4ae82a0b0c553 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Jul 05 2018 00:55:46 +0000 Subject: Add Debian/Ubuntu support --- diff --git a/README.md b/README.md new file mode 100644 index 0000000..01d0fa3 --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# Python 3.6 based on Fedora's "flatpackage" with added Debian/Ubuntu support + +This repository contains the packaging for Python 3.6 derived from Fedora's [`python36` package](https://src.fedoraproject.org/rpms/python36) +with added support for being built for Debian/Ubuntu using [`debbuild`](https://github.com/ascherer/debbuild). + +## How to build the package (rpm) + +On a RPM system, + +1. Install the `rpm-build` package +2. Create the folder tree: `mkdir -p ~/rpmbuild/{SPECS,SOURCES,BUILD,BUILDROOT,RPMS,SRPMS}` +3. Copy all the source files into `~/rpmbuild/SOURCES` +4. Download the Python 3.6 source tarball referenced in the spec and put it in `~/rpmbuild/SOURCES` +5. Copy the spec to `~/rpmbuild/SPECS` +6. Run rpmbuild: `rpmbuild -ba ~/rpmbuild/SPECS/python36.spec` + +## How to build the package (deb) + +On a Debian/Ubuntu system, + +1. Install `debbuild` using the deb from the project releases page. +2. Create the folder tree: `mkdir -p ~/debbuild/{SPECS,SOURCES,BUILD,BUILDROOT,DEBS,SDEBS}` +3. Copy all the source files into `~/debbuild/SOURCES` +4. Download the Python 3.6 source tarball referenced in the spec and put it in `~/debbuild/SOURCES` +5. Copy the spec to `~/debbuild/SPECS` +6. Run debbuild: `debbuild -ba ~/debbuild/SPECS/python36.spec` + diff --git a/python36.spec b/python36.spec index 8926092..94f10b7 100644 --- a/python36.spec +++ b/python36.spec @@ -1,3 +1,9 @@ +# ============== +# RPM/DEB compat +# ============== +%global _buildshell /bin/bash +%{!?_gnu:%global _gnu -gnu} + # ================== # Top-level metadata # ================== @@ -11,10 +17,19 @@ Name: python%{pyshortver} Summary: Version %{pybasever} of the Python interpreter URL: https://www.python.org/ +%if %{_vendor} == "debbuild" +# Required for deb-control output +# Packager <-> Maintainer field in deb control +Packager: Neal Gompa +# Required for deb-control output +# Group <-> Section field in deb control +Group: python +%endif + # WARNING When rebasing to a new Python version, # remember to update the python3-docs package as well Version: %{pybasever}.5 -Release: 5%{?dist} +Release: 6%{?dist} License: Python @@ -129,8 +144,8 @@ License: Python %global LDVERSION_optimized %{pybasever}%{ABIFLAGS_optimized} %global LDVERSION_debug %{pybasever}%{ABIFLAGS_debug} -%global SOABI_optimized cpython-%{pyshortver}%{ABIFLAGS_optimized}-%{_arch}-linux%{_gnu} -%global SOABI_debug cpython-%{pyshortver}%{ABIFLAGS_debug}-%{_arch}-linux%{_gnu} +%global SOABI_optimized cpython-%{pyshortver}%{ABIFLAGS_optimized}-%{_target_cpu}-linux%{_gnu} +%global SOABI_debug cpython-%{pyshortver}%{ABIFLAGS_debug}-%{_target_cpu}-linux%{_gnu} # All bytecode files are in a __pycache__ subdirectory, with a name # reflecting the version of the bytecode. @@ -177,49 +192,112 @@ License: Python # (keep this list alphabetized) BuildRequires: autoconf +%if %{_vendor} == "debbuild" +BuildRequires: libbluetooth-dev +%else BuildRequires: bluez-libs-devel +%endif BuildRequires: bzip2 +%if %{_vendor} == "debbuild" +BuildRequires: libbz2-dev +%else BuildRequires: bzip2-devel +%endif BuildRequires: desktop-file-utils + +%if %{_vendor} == "debbuild" +BuildRequires: libexpat1-dev +%else BuildRequires: expat-devel +%endif BuildRequires: findutils + +%if %{_vendor} == "debbuild" +BuildRequires: g++ +%else BuildRequires: gcc-c++ +%endif + %if %{with gdbm} -BuildRequires: gdbm-devel >= 1:1.13 +%if %{_vendor} == "debbuild" +BuildRequires: libgdbm-dev +%else +BuildRequires: gdbm-devel %endif +%endif + +%if %{_vendor} == "debbuild" +BuildRequires: libc6-dev +BuildRequires: libgmp-dev +BuildRequires: appstream-util +BuildRequires: libffi-dev +BuildRequires: libtirpc-dev +BuildRequires: libgl1-mesa-dev +BuildRequires: libx11-dev +BuildRequires: libncurses5-dev +%else BuildRequires: glibc-devel BuildRequires: gmp-devel -BuildRequires: libappstream-glib +BuildRequires: /usr/bin/appstream-util BuildRequires: libffi-devel BuildRequires: libnsl2-devel BuildRequires: libtirpc-devel BuildRequires: libGL-devel BuildRequires: libX11-devel BuildRequires: ncurses-devel +%endif +%if %{_vendor} == "debbuild" +BuildRequires: libssl-dev +BuildRequires: pkg-config +BuildRequires: libreadline-dev +BuildRequires: libsqlite3-dev +%else BuildRequires: openssl-devel BuildRequires: pkgconfig BuildRequires: readline-devel BuildRequires: sqlite-devel +%endif BuildRequires: gdb BuildRequires: tar + +%if %{_vendor} == "debbuild" +BuildRequires: tcl-dev +BuildRequires: tix-dev +BuildRequires: tk-dev +%else BuildRequires: tcl-devel BuildRequires: tix-devel BuildRequires: tk-devel +%endif %if %{with valgrind} +%if %{_vendor} == "debbuild" +BuildRequires: valgrind +%else BuildRequires: valgrind-devel %endif +%endif +%if %{_vendor} == "debbuild" +BuildRequires: liblzma-dev +BuildRequires: zlib1g-dev +%else BuildRequires: xz-devel BuildRequires: zlib-devel +%endif +%if %{_vendor} == "debbuild" +BuildRequires: systemtap-sdt-dev +BuildRequires: net-tools +%else BuildRequires: /usr/bin/dtrace # workaround http://bugs.python.org/issue19804 (test_uuid requires ifconfig) BuildRequires: /usr/sbin/ifconfig +%endif %if %{with rewheel} BuildRequires: python3-setuptools @@ -619,16 +697,21 @@ so extensions for both versions can co-exist in the same directory. %else # with flatpackage +%if %{_vendor} == "redhat" +# This is only necessary on RH/Fedora systems Requires: redhat-rpm-config +%endif # We'll not provide this, on purpose # No package in Fedora shall ever depend on flatpackage via this %global __requires_exclude ^python\\(abi\\) = 3\\..$ %global __provides_exclude ^python\\(abi\\) = 3\\..$ +%if %{_vendor} != "debbuild" # We keep those inside on purpose Provides: bundled(python3-pip) = 9.0.3 Provides: bundled(python3-setuptools) = 39.0.1 +%endif # The description for the flat package %description @@ -851,7 +934,7 @@ InstallPython() { %if %{with gdb_hooks} # See comment on $DirHoldingGdbPy above - PathOfGdbPy=$DirHoldingGdbPy/$PyInstSoName-%{version}-%{release}.%{_arch}.debug-gdb.py + PathOfGdbPy=$DirHoldingGdbPy/$PyInstSoName-%{version}-%{release}.%{_target_cpu}.debug-gdb.py cp Tools/gdb/libpython.py %{buildroot}$PathOfGdbPy %endif # with gdb_hooks @@ -1072,6 +1155,7 @@ CheckPython() { -x test_distutils \ -x test_bdist_rpm \ -x test_gdb \ +%if %{_vendor} != "debbuild" %ifarch ppc64le aarch64 -x test_faulthandler \ %endif @@ -1081,6 +1165,7 @@ CheckPython() { %ifarch ppc64le -x test_buffer \ %endif +%endif echo FINISHED: CHECKING OF PYTHON FOR CONFIGURATION: $ConfName @@ -1336,8 +1421,8 @@ CheckPython optimized # "Makefile" and the config-32/64.h file are needed by # distutils/sysconfig.py:_init_posix(), so we include them in the core # package, along with their parent directories (bug 531901): -%dir %{pylibdir}/config-%{LDVERSION_optimized}-%{_arch}-linux%{_gnu}/ -%{pylibdir}/config-%{LDVERSION_optimized}-%{_arch}-linux%{_gnu}/Makefile +%dir %{pylibdir}/config-%{LDVERSION_optimized}-%{_target_cpu}-linux%{_gnu}/ +%{pylibdir}/config-%{LDVERSION_optimized}-%{_target_cpu}-linux%{_gnu}/Makefile %dir %{_includedir}/python%{LDVERSION_optimized}/ %{_includedir}/python%{LDVERSION_optimized}/%{_pyconfig_h} @@ -1353,9 +1438,9 @@ CheckPython optimized %{_bindir}/2to3-%{pybasever} %endif -%{pylibdir}/config-%{LDVERSION_optimized}-%{_arch}-linux%{_gnu}/* +%{pylibdir}/config-%{LDVERSION_optimized}-%{_target_cpu}-linux%{_gnu}/* %if %{without flatpackage} -%exclude %{pylibdir}/config-%{LDVERSION_optimized}-%{_arch}-linux%{_gnu}/Makefile +%exclude %{pylibdir}/config-%{LDVERSION_optimized}-%{_target_cpu}-linux%{_gnu}/Makefile %exclude %{_includedir}/python%{LDVERSION_optimized}/%{_pyconfig_h} %endif %{pylibdir}/distutils/command/wininst-*.exe @@ -1514,7 +1599,7 @@ CheckPython optimized %{_libdir}/%{py_INSTSONAME_debug} # Analog of the -devel subpackage's files: -%{pylibdir}/config-%{LDVERSION_debug}-%{_arch}-linux%{_gnu} +%{pylibdir}/config-%{LDVERSION_debug}-%{_target_cpu}-linux%{_gnu} %{_includedir}/python%{LDVERSION_debug} %{_bindir}/python%{LDVERSION_debug}-config %{_bindir}/python%{LDVERSION_debug}-*-config @@ -1558,5 +1643,8 @@ CheckPython optimized # ====================================================== %changelog +* Wed Jul 04 2018 Neal Gompa - 3.6.5-6 +- Add Debian/Ubuntu support + * Mon Jun 18 2018 Miro HronĨok - 3.6.5-5 - Introduce python36 package