summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffery To <jeffery.to@gmail.com>2018-12-13 01:33:36 +0800
committerJo-Philipp Wich <jo@mein.io>2019-01-30 12:40:16 +0100
commitb98b55a64fb633d7901f9db5529e52e3175300e9 (patch)
tree9461fe9f8cd6ff5d54f805df6f6e05220077b053
parente6c2f3feb1e5bf30f25b333f91ec2be6f5b7102d (diff)
downloadopenwrt-b98b55a64fb633d7901f9db5529e52e3175300e9.tar.gz
openwrt-b98b55a64fb633d7901f9db5529e52e3175300e9.tar.bz2
openwrt-b98b55a64fb633d7901f9db5529e52e3175300e9.zip
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 <jeffery.to@gmail.com> (cherry picked from commit a1170936798e519776de605d6986ccb72f04cb06)
-rw-r--r--include/package.mk7
-rwxr-xr-xscripts/clean-package.sh2
2 files changed, 5 insertions, 4 deletions
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
diff --git a/scripts/clean-package.sh b/scripts/clean-package.sh
index d1a257889d..e580566a52 100755
--- a/scripts/clean-package.sh
+++ b/scripts/clean-package.sh
@@ -14,7 +14,7 @@ cat "$1" | (
[ -f "$entry" ] && rm -f $entry
done
)
-cat "$1" | (
+sort -r "$1" | (
cd "$2"
while read entry; do
[ -n "$entry" ] || break