Thread (35 messages) flat view 35 messages, 6 authors, 2023-10-13

[Buildroot] [PATCH v3 02/16] package/pkg-python: invalidate precompiled _sysconfigdata*.pyc

From: Herve Codina <herve.codina@bootlin.com>
Date: 2021-08-17 08:40:16
Subsystem: the rest · Maintainer: Linus Torvalds

For per-package directories, we fixup the _sysconfigdata*.py files, so
that they get proper path pointing to the current package's direcotry
structure.

However, the corresponding, pre-compiled blobs _sysconfigdata*.pyc were
left around, and thus are inconsistent with their source. They might
also be regenerated when a package would install a python module; this
regeneration would trigger the soon-to-be-introduced overwrite
detection.

This commit simply removes _sysconfigdata*.pyc files; they will anyway
be regenerated by the PYTHON{,3}_CREATE_PYC_FILES target finalize hooks.
This is an efficient way to guarantee the consistency between the source
and precompiled versions, and to not trigger the overwrite detection.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
[yann.morin.1998@free.frs: reword the commit log]
Signed-off-by: Yann E. MORIN <redacted>
---
Changes from v1 to v2:
 - Used separate shells for the two 'find' commands.
 - Used '-deleted' to remove files

Changes v2 to v3:
 - Reworked the find command to avoid failure highlighted in 836528f03eb89fdc64432f7a7470145ddf553b8c
   and reverted in b928074e2d83f5b873bf1ba381b212dfad9bf207.
 - Used find syntax discussed in the previous review.
   https://lore.kernel.org/buildroot/20210709084820.37830e5f@bootlin.com/ (local)
 - Kept Yann's commit log.

 package/pkg-python.mk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/package/pkg-python.mk b/package/pkg-python.mk
index cd48402e02..0f65bd0f75 100644
--- a/package/pkg-python.mk
+++ b/package/pkg-python.mk
@@ -106,7 +106,9 @@ ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),y)
 define PKG_PYTHON_FIXUP_SYSCONFIGDATA
 	$(Q)find $(HOST_DIR) \
 		\( -path '$(HOST_DIR)/lib/python*' -o -path '$(STAGING_DIR)/usr/lib/python*' \) \
-		-name "_sysconfigdata*.py" -print0 | xargs -0 --no-run-if-empty \
+		\(    \( -name "_sysconfigdata*.pyc" -delete \) \
+		   -o \( -name "_sysconfigdata*.py" -print0 \) \) \
+		| xargs -0 --no-run-if-empty \
 		$(SED) 's:$(PER_PACKAGE_DIR)/[^/]\+/:$(PER_PACKAGE_DIR)/$($(PKG)_NAME)/:g'
 endef
 endif
-- 
2.31.1

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help