From ee66f55213b1fd5a006e8638d524e490c9f65f3b Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Fri, 7 Apr 2006 20:30:43 +0000 Subject: rework fakeroot handling to avoid races during parallel make causing several fakeroot instances stomping eachother's temp files. --- target/ext2/ext2root.mk | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'target/ext2') diff --git a/target/ext2/ext2root.mk b/target/ext2/ext2root.mk index fec8795b5..06ab3d2f3 100644 --- a/target/ext2/ext2root.mk +++ b/target/ext2/ext2root.mk @@ -65,24 +65,24 @@ else EXT2_TARGET := $(EXT2_BASE) endif -$(EXT2_BASE): host-fakeroot makedevs $(STAGING_DIR)/fakeroot.env genext2fs +$(EXT2_BASE): host-fakeroot makedevs genext2fs -@find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIP) 2>/dev/null || true; @rm -rf $(TARGET_DIR)/usr/man @rm -rf $(TARGET_DIR)/usr/share/man @rm -rf $(TARGET_DIR)/usr/info -/sbin/ldconfig -r $(TARGET_DIR) 2>/dev/null # Use fakeroot to pretend all target binaries are owned by root + rm -f $(STAGING_DIR)/_fakeroot.$(EXT2_TARGET) + cat $(STAGING_DIR)/.fakeroot* > $(STAGING_DIR)/_fakeroot.$(EXT2_TARGET) -$(STAGING_DIR)/usr/bin/fakeroot \ - -i $(STAGING_DIR)/fakeroot.env \ - -s $(STAGING_DIR)/fakeroot.env -- \ + -i $(STAGING_DIR)/_fakeroot.$(EXT2_TARGET) \ + -s $(STAGING_DIR)/_fakeroot.$(EXT2_TARGET) -- \ chown -R root:root $(TARGET_DIR) # Use fakeroot to pretend to create all needed device nodes $(STAGING_DIR)/usr/bin/fakeroot \ - -i $(STAGING_DIR)/fakeroot.env \ - -s $(STAGING_DIR)/fakeroot.env -- \ - $(STAGING_DIR)/bin/makedevs \ - -d $(TARGET_DEVICE_TABLE) \ - $(TARGET_DIR) + -i $(STAGING_DIR)/_fakeroot.$(EXT2_TARGET) \ + -s $(STAGING_DIR)/_fakeroot.$(EXT2_TARGET) -- \ + $(STAGING_DIR)/bin/makedevs -d $(TARGET_DEVICE_TABLE) $(TARGET_DIR) # Use fakeroot so genext2fs believes the previous fakery ifeq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0) GENEXT2_REALSIZE=`LANG=C du -l -s -c -k $(TARGET_DIR) | grep total | sed -e "s/total//"`; \ @@ -92,22 +92,23 @@ ifeq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0) GENEXT2_INODES=`expr $$GENEXT2_ADDTOINODESIZE + 400`; \ set -x; \ $(STAGING_DIR)/usr/bin/fakeroot \ - -i $(STAGING_DIR)/fakeroot.env \ - -s $(STAGING_DIR)/fakeroot.env -- \ - $(GENEXT2_DIR)/genext2fs \ + -i $(STAGING_DIR)/_fakeroot.$(EXT2_TARGET) \ + -s $(STAGING_DIR)/_fakeroot.$(EXT2_TARGET) -- \ + $(GENEXT2_DIR)/genext2fs \ -b $$GENEXT2_SIZE \ -i $$GENEXT2_INODES \ -d $(TARGET_DIR) \ $(EXT2_OPTS) $(EXT2_BASE) else $(STAGING_DIR)/usr/bin/fakeroot \ - -i $(STAGING_DIR)/fakeroot.env \ - -s $(STAGING_DIR)/fakeroot.env -- \ - $(GENEXT2_DIR)/genext2fs \ + -i $(STAGING_DIR)/_fakeroot.$(EXT2_TARGET) \ + -s $(STAGING_DIR)/_fakeroot.$(EXT2_TARGET) -- \ + $(GENEXT2_DIR)/genext2fs \ -d $(TARGET_DIR) \ $(EXT2_OPTS) \ $(EXT2_BASE) endif + -@rm -f $(STAGING_DIR)/_fakeroot.$(EXT2_TARGET) $(EXT2_BASE).gz: $(EXT2_BASE) @gzip --best -fv $(EXT2_BASE) -- cgit v1.2.3