Skip to content

Commit ac9a97e

Browse files
efahlPolynomialDivision
authored andcommitted
build: call ipkg-remove using xargs if #args>=512
The wildcard call to clean up luci package (luci*) can pick up over 2,300 files when the full tree is built. Running make package/luci/clean or a second run of make package/luci/compile would fail with an 'Argument list too long' error. To avoid that, a maybe_use_xargs function was created that runs the command straight as usual if the number of arguments is < 512, or saves the list in a temporary file and feeds it to xargs otherwise. This is an update to current file names and resubmission of https://lists.openwrt.org/pipermail/openwrt-devel/2020-February/027525.html Fixes: openwrt/openwrt#19510 Fixes: openwrt/luci#7869 Authored-by: Eneas U de Queiroz <[email protected]> Signed-off-by: Kuan-Yi Li <[email protected]> Signed-off-by: Eric Fahlgren <[email protected]> Link: openwrt/openwrt#19516 Signed-off-by: Nick Hainke <[email protected]>
1 parent 19bc6e8 commit ac9a97e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

include/package-pack.mk

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,20 @@ define gen_package_wildcard
1818
$(1)$$(if $$(filter -%,$$(ABIV_$(1))),,[^a-z$(if $(CONFIG_USE_APK),,-)])*
1919
endef
2020

21+
# 1: command and initial arguments
22+
# 2: arguments list
23+
# 3: tmp filename
24+
define maybe_use_xargs
25+
$(if $(word 512,$(2)), \
26+
$(file >$(3),$(2)) $(XARGS) $(1) < "$(3)"; rm "$(3)", \
27+
$(1) $(2))
28+
endef
29+
2130
# 1: package name
2231
# 2: candidate ipk files
2332
define remove_ipkg_files
24-
$(if $(strip $(2)),$(SCRIPT_DIR)/ipkg-remove $(1) $(2))
33+
$(if $(strip $(2)), \
34+
$(call maybe_use_xargs,$(SCRIPT_DIR)/ipkg-remove $(1),$(2),$(TMP_DIR)/$(1).in))
2535
endef
2636

2737
# 1: package name

0 commit comments

Comments
 (0)