The code to find OVERLAY_MAKEFILE_APPENDS for each package took
about 0.3 seconds which can create a big overhad during
"./scripts/feeds update" processing, where OpenWrt process each
package that exists in all feeds, not only packages targeted for
installation.
To reduce processing time we will re-use the
"$(TMP_DIR)/info/.files-packageinfo-$(SCAN_COOKIE)" file that
created on each run of "make" in OpenWrt root directory and,
after the 1ff5427954 commit,
contains list of all relevant Makefile.append files.
In cases when this file missed, the plain search implementation
would be used to get list of Makefile.append's.
References: PPW-1162
Signed-off-by: Nikolai Merinov <n.merinov@inango-systems.com>
Problem: OpenWRT Build system provide no way to extend package from 3rd party feed.
As a result in order to manage CVE patches or small modification to a single package
we should make copy of package in feeds that we own and monitor any changes in the
package original feed to not miss upstream updates.
Solution: Include all $(PKG_DIR_NAME)/Makefile.append files as part of first
$(eval $(call BuildPackage,packagename)) call in original $(PKG_DIR_NAME)/Makefile.
Add append directories to PKG_FILE_DEPENDS in order to invalidate build when
append files changed.
Together with this change provide several useful functions and variables:
Variable $(THISDIR) -- defined in context of Makefile.append files to and points to
the directory where Makefile.append recipe. Can be used to find additional patches,
config fragments, etc.
Variable $(OVERLAY_PATCHES) -- can be used to provide additional patch files for package
sources in the following manner:
OVERLAY_PATCHES := $(OVERLAY_PATCHES) $(THISDIR)/patches/filename.patch
OVERLAY_PATCHES := $(OVERLAY_PATCHES) $(wildcard $(THISDIR)/patches/*.patch)
Variable $(newline) -- contains single "\n" symbol. Required to append/prepend
OpenWRT multiline variables with additional line.
Functions (append,VARNAME,value[,override]) -- used to append "value" string to variable VARNAME.
Behave like "+=" with two exceptions:
1. Append "value" without extra space before the value
2. The "value" expanded immediately before the assignment, while VARNAME is treated
as recursive expand variable. Such behavior allow you to use $(THISDIR) variable
together with "append" function. For example the following call will expand
$(THISDIR) immediately:
$(call append,Package/helloworld/config,$(newline)source "$(THISDIR)/Config.in")
Function (prepend,VARNAME,value[,override]) -- used to prepend "value" string to variable VARNAME.
Shares "append" function behavior regards expansion time. In order to append string
with delayed expansion time you can replace $(...) with $$(...). For exaple the
following call will delay $(Build/IncludeOverlay) expansion:
$(call prepend,BuildPackage,$$(Build/IncludeOverlay)$(newline))
Function (remove,VARNAME,value[,override]) -- behave like "filter-out" function, but allow to
control expansion time of the passed "value".
Function (rewrite,VARNAME,value[,override]) -- generalized function that allow arbitrary change
of VARNAME variable value controlling "value" expansion time.
All this functions support optional last argument that allow to modify "override VARNAME" instead
of non-override version of VARNAME.
References: PCF-1615
Signed-off-by: Ivan Efimov <i.efimov@inango-systems.com>
Signed-off-by: Nicolai Scurtu <n.scurtu@inango-systems.com>
Signed-off-by: Vadym Omelchuk <v.omelchuk@inango-systems.com>
Signed-off-by: Vladimir Shulika <v.shulika@inango-systems.com>
Signed-off-by: Nikolai Merinov <n.merinov@inango-systems.com>