Skip to content
Snippets Groups Projects
Verified Commit 9fb0702c authored by Josef Schlehofer's avatar Josef Schlehofer
Browse files

Merge branch 'hotfix/build-patches-fixes-missing-luci' into hbl

parents 9b5ffff2 2e77bbab
No related branches found
No related tags found
No related merge requests found
From b12243c885540b3cb004b677a3e3f26356750b1e Mon Sep 17 00:00:00 2001
From: Eneas U de Queiroz <cotequeiroz@gmail.com>
Date: Thu, 20 Feb 2020 18:29:02 -0300
Subject: [PATCH 1/3] build: package-ipkg: avoid calling wildcard twice
Instead of calling $(wildcard) to check if the removal list is empty,
then calling it again to actually remove the files, define a function so
that the arguments are expanded only once when it gets called.
Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
---
include/package-ipkg.mk | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
index 442d3854f0..00ebb9197f 100644
--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -18,6 +18,12 @@ IPKG_REMOVE:= \
IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/opkg
+# 1: package name
+# 2: candidate ipk files
+define remove_ipkg_files
+ $(if $(strip $(2)),$(IPKG_REMOVE) $(1) $(2))
+endef
+
# 1: package name
# 2: variable name
# 3: variable suffix
@@ -184,7 +190,7 @@ $(_endef)
$$(IPKG_$(1)) : export DESCRIPTION=$$(Package/$(1)/description)
$$(IPKG_$(1)) : export PATH=$$(TARGET_PATH_PKG)
$(PKG_INFO_DIR)/$(1).provides $$(IPKG_$(1)): $(STAMP_BUILT) $(INCLUDE_DIR)/package-ipkg.mk
- @rm -rf $$(IDIR_$(1)) $$(if $$(call opkg_package_files,$(1)*),; $$(IPKG_REMOVE) $(1) $$(call opkg_package_files,$(1)*))
+ @rm -rf $$(IDIR_$(1)); $$(call remove_ipkg_files,$(1),$$(call opkg_package_files,$(1)*))
mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/CONTROL $(PKG_INFO_DIR)
$(call Package/$(1)/install,$$(IDIR_$(1)))
$(if $(Package/$(1)/install-overlay),mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/rootfs-overlay)
@@ -252,7 +258,7 @@ $(_endef)
@[ -f $$(IPKG_$(1)) ]
$(1)-clean:
- $$(if $$(call opkg_package_files,$(1)*),$$(IPKG_REMOVE) $(1) $$(call opkg_package_files,$(1)*))
+ $$(call remove_ipkg_files,$(1),$$(call opkg_package_files,$(1)*))
clean: $(1)-clean
--
2.26.2
From f66f2d9699b8fcfae64da1568b8db2835fb19101 Mon Sep 17 00:00:00 2001
From: Eneas U de Queiroz <cotequeiroz@gmail.com>
Date: Thu, 20 Feb 2020 18:29:03 -0300
Subject: [PATCH 2/3] 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.
Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
---
include/package-ipkg.mk | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
index 00ebb9197f..cbce90a0f1 100644
--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -18,10 +18,20 @@ IPKG_REMOVE:= \
IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/opkg
+# 1: command and initial arguments
+# 2: arguments list
+# 3: tmp filename
+define maybe_use_xargs
+ $(if $(word 512,$(2)), \
+ $(file >$(3),$(2)) $(XARGS) $(1) < "$(3)"; rm "$(3)", \
+ $(1) $(2))
+endef
+
# 1: package name
# 2: candidate ipk files
define remove_ipkg_files
- $(if $(strip $(2)),$(IPKG_REMOVE) $(1) $(2))
+ $(if $(strip $(2)), \
+ $(call maybe_use_xargs,$(IPKG_REMOVE) $(1),$(2),$(TMP_DIR)/$(1).in))
endef
# 1: package name
--
2.26.2
From 6b63b818dbbfa6ac0200dd2d0eb90280f13a369f Mon Sep 17 00:00:00 2001
From: Eneas U de Queiroz <cotequeiroz@gmail.com>
Date: Thu, 20 Feb 2020 18:29:04 -0300
Subject: [PATCH 3/3] build: reduce number of files passed to ipk-remove
Instead of using xargs to pass a huge number of files to
script/ipkg-remove, which will usually pick only one, use a more
restrictive wildcard so that, currently, at the most 325 files are
examined, instead of up to over 2,300. The 325-file package is python,
which is picking up python3* ipks. It is about to be removed.
Runner-up is ddns-scripts with 7 files.
This makes a second run of make package/luci/compile go from
real 16.40s; user 17.42s; sys 2.73s
to
real 10.71s; user 9.51s; sys 1.27s
There is a caveat though: if one were to remove the ABI_VERSION of a
package that ends in a digit [0-9], then the old package ipk will not be
removed from the bin directory by make package/abc2/clean.
Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
---
include/package-ipkg.mk | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
index cbce90a0f1..581987be95 100644
--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -18,20 +18,16 @@ IPKG_REMOVE:= \
IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/opkg
-# 1: command and initial arguments
-# 2: arguments list
-# 3: tmp filename
-define maybe_use_xargs
- $(if $(word 512,$(2)), \
- $(file >$(3),$(2)) $(XARGS) $(1) < "$(3)"; rm "$(3)", \
- $(1) $(2))
+# Generates a make statement to return a wildcard for candidate ipkg files
+# 1: package name
+define gen_ipkg_wildcard
+ $(1)$$(if $$(filter -%,$$(ABIV_$(1))),,[^a-z-])*
endef
# 1: package name
# 2: candidate ipk files
define remove_ipkg_files
- $(if $(strip $(2)), \
- $(call maybe_use_xargs,$(IPKG_REMOVE) $(1),$(2),$(TMP_DIR)/$(1).in))
+ $(if $(strip $(2)),$(IPKG_REMOVE) $(1) $(2))
endef
# 1: package name
@@ -200,7 +196,8 @@ $(_endef)
$$(IPKG_$(1)) : export DESCRIPTION=$$(Package/$(1)/description)
$$(IPKG_$(1)) : export PATH=$$(TARGET_PATH_PKG)
$(PKG_INFO_DIR)/$(1).provides $$(IPKG_$(1)): $(STAMP_BUILT) $(INCLUDE_DIR)/package-ipkg.mk
- @rm -rf $$(IDIR_$(1)); $$(call remove_ipkg_files,$(1),$$(call opkg_package_files,$(1)*))
+ @rm -rf $$(IDIR_$(1)); \
+ $$(call remove_ipkg_files,$(1),$$(call opkg_package_files,$(call gen_ipkg_wildcard,$(1))))
mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/CONTROL $(PKG_INFO_DIR)
$(call Package/$(1)/install,$$(IDIR_$(1)))
$(if $(Package/$(1)/install-overlay),mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/rootfs-overlay)
@@ -268,7 +265,7 @@ $(_endef)
@[ -f $$(IPKG_$(1)) ]
$(1)-clean:
- $$(call remove_ipkg_files,$(1),$$(call opkg_package_files,$(1)*))
+ $$(call remove_ipkg_files,$(1),$$(call opkg_package_files,$(call gen_ipkg_wildcard,$(1))))
clean: $(1)-clean
--
2.26.2
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment