Quellcode durchsuchen

package/python3: use depth first search for directory removal

Previously, Python builds could intermittently fail when removing files
if `find` removed a directory before searching within it [0].

An arbitrary example:

  /tmp/tmp.h9KMUse5zO $ find . -type d -name __pycache__ -exec rm -rvf {} \; ; echo -e "RETURN CODE: $?"
  removed directory './a/b/c/d/e/__pycache__'
  find: ‘./a/b/c/d/e/__pycache__’: No such file or directory
  removed directory './a/b/c/d/e/f/__pycache__'
  find: ‘./a/b/c/d/e/f/__pycache__’: No such file or directory
  removed directory './a/b/c/d/e/f/g/__pycache__'
  RETURN CODE: 1

Now, pass the `-depth` argument to `find` so a depth-first search is
performed to avoid trying to search within an already deleted folder.

Fixes: 54d48c8cad4e ("package/python3: miscellaneous fixups")
Fixes: http://autobuild.buildroot.net/results/ba1d4213ae9912d53412ded6d8e257b67a4f7c0e/
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Vincent Fazio vor 1 Jahr
Ursprung
Commit
ec531a271b
1 geänderte Dateien mit 2 neuen und 2 gelöschten Zeilen
  1. 2 2
      package/python3/python3.mk

+ 2 - 2
package/python3/python3.mk

@@ -205,8 +205,8 @@ define PYTHON3_REMOVE_USELESS_FILES
 	rm -f $(TARGET_DIR)/usr/bin/python$(PYTHON3_VERSION_MAJOR)-config
 	rm -f $(TARGET_DIR)/usr/bin/python3-config
 	find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/config-$(PYTHON3_VERSION_MAJOR)*/ \
-		-type f -not -name Makefile -exec rm -rf {} \;
-	find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/ -type d \
+		-depth -type f -not -name Makefile -exec rm -rf {} \;
+	find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/ -depth -type d \
 		-name __pycache__ -exec rm -rf {} \;
 endef