python-setuptools: Add reproducibility patches from Debian

This adds the ability to patch setuptools (and pip), and adds 3
reproducibility patches from Debian[1].
(003-PKG-INFO-output-reproducible.patch addresses the issue identified
in #9039.)

The patching is not perfect, in that the patches are applied to
setuptools and pip after they have been installed, since they are
installed from wheels which are already "precompiled".

Also, patching for the host install cannot be updated in place, for
example if a patch is added or removed.

[1]: https://sources.debian.org/patches/python-setuptools/40.8.0-1/

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
This commit is contained in:
Jeffery To
2019-05-24 13:18:09 +08:00
parent 3d62778f6e
commit da35e6770d
10 changed files with 114 additions and 2 deletions

View File

@@ -178,6 +178,7 @@ define Build/Compile/python3-setuptools
--ignore-installed \
--root=$(PKG_BUILD_DIR)/install-setuptools --prefix=. \
$(PKG_BUILD_DIR)/Lib/ensurepip/_bundled/setuptools-$(PYTHON3_SETUPTOOLS_VERSION)-py2.py3-none-any.whl
$(call PatchDir,$(PKG_BUILD_DIR)/install-setuptools/lib/python$(PYTHON3_VERSION)/site-packages,./patches-setuptools,)
endef
endif # CONFIG_PACKAGE_python3-setuptools
@@ -187,6 +188,7 @@ define Build/Compile/python3-pip
--ignore-installed \
--root=$(PKG_BUILD_DIR)/install-pip --prefix=. \
$(PKG_BUILD_DIR)/Lib/ensurepip/_bundled/pip-$(PYTHON3_PIP_VERSION)-py2.py3-none-any.whl
$(call PatchDir,$(PKG_BUILD_DIR)/install-pip/lib/python$(PYTHON3_VERSION)/site-packages,./patches-pip,)
endef
endif # CONFIG_PACKAGE_python3-pip
@@ -299,6 +301,14 @@ define Host/Install
$(MAKE) -C $(HOST_BUILD_DIR) install
$(INSTALL_DIR) $(HOST_PYTHON3_DIR)/bin/
$(INSTALL_BIN) $(HOST_BUILD_DIR)/Parser/pgen $(HOST_PYTHON3_DIR)/bin/pgen3
ifeq ($(wildcard $(HOST_PYTHON3_PKG_DIR)/.setuptools-patched),)
$(call HostPatchDir,$(HOST_PYTHON3_PKG_DIR),./patches-setuptools,)
touch $(HOST_PYTHON3_PKG_DIR)/.setuptools-patched
endif
ifeq ($(wildcard $(HOST_PYTHON3_PKG_DIR)/.pip-patched),)
$(call HostPatchDir,$(HOST_PYTHON3_PKG_DIR),./patches-pip,)
touch $(HOST_PYTHON3_PKG_DIR)/.pip-patched
endif
endef
$(eval $(call HostBuild))