From a1170936798e519776de605d6986ccb72f04cb06 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Thu, 13 Dec 2018 01:33:36 +0800 Subject: build: fix STAGING_DIR cleaning for packages This fixes two issues with cleaning package files from STAGING_DIR: * CleanStaging currently can only remove files and not directories. This changes CleanStaging to use clean-package.sh, which does remove directories. * Because of the way directories are ordered in the staging files list, clean-package.sh currently tries (and fails) to remove parent directories before removing subdirectories. This changes clean-package.sh to process the staging files list in reverse, so that subdirectories are removed first. Signed-off-by: Jeffery To --- include/package.mk | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/package.mk b/include/package.mk index a03db11119..569ad647d6 100644 --- a/include/package.mk +++ b/include/package.mk @@ -81,9 +81,10 @@ STAGING_FILES_LIST:=$(PKG_DIR_NAME)$(if $(BUILD_VARIANT),.$(BUILD_VARIANT),).lis define CleanStaging rm -f $(STAMP_INSTALLED) @-(\ - cd "$(STAGING_DIR)"; \ - if [ -f packages/$(STAGING_FILES_LIST) ]; then \ - cat packages/$(STAGING_FILES_LIST) | xargs -r rm -f 2>/dev/null; \ + if [ -f $(STAGING_DIR)/packages/$(STAGING_FILES_LIST) ]; then \ + $(SCRIPT_DIR)/clean-package.sh \ + "$(STAGING_DIR)/packages/$(STAGING_FILES_LIST)" \ + "$(STAGING_DIR)"; \ fi; \ ) endef -- cgit v1.2.3