summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2024-02-06 13:05:16 +0100
committerMichael Olbrich <m.olbrich@pengutronix.de>2024-02-09 17:10:14 +0100
commit5fdf9c0468840814d9de774e4b516077f4ad9f78 (patch)
treef9860272225efdb164d557863fd9ba15a0216fbf
parent372beef835e58639ecc6dda449494cae7ec94807 (diff)
downloadptxdist-5fdf9c0468840814d9de774e4b516077f4ad9f78.tar.gz
ptxdist-5fdf9c0468840814d9de774e4b516077f4ad9f78.tar.xz
ptxd_lib_dgen: introduce <PKG>_PARTS to replace <PKG>_SOURCES
<PKG>_SOURCES cannot be used to match back to the package parts because the same source path may be used by multiple packages. So define <PKG>_PARTS that contains <PKG> and can be extended with <PKG>_EXTRA etc. for additional sources. In that case, <PKG>_EXTRA_SOURCE, etc. is expected to be defined. This makes it possible to extract all components in the default rule among other things. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r--rules/post/export_src.make10
-rw-r--r--rules/post/ptxd_make_world_common.make3
-rw-r--r--rules/post/ptxd_make_world_extract.make6
-rw-r--r--rules/post/ptxd_make_world_get.make21
-rw-r--r--scripts/lib/ptxd_lib_dgen.awk19
5 files changed, 33 insertions, 26 deletions
diff --git a/rules/post/export_src.make b/rules/post/export_src.make
index 9697a5ad3..7c250bb34 100644
--- a/rules/post/export_src.make
+++ b/rules/post/export_src.make
@@ -3,17 +3,17 @@
# input: source=PACKAGE_NAME_SOURCE, output: full path to the source archive
# [HOST|CROSS]_FOO_SOURCE may be empty; try FOO_SOURCE in that case
define ptx/export/get_source
-$(if $($(source)),$($(source)),$($(subst CROSS_,,$(subst HOST_,,$(source)))))
+$(if $($(1)),$($(1)),$($(subst CROSS_,,$(subst HOST_,,$(1)))))
endef
# iterate over $(PACKAGES_SELECTED) "bash busybox" ->
-# convert to "BASH_SOURCE BUSYBOX_SOURCE"
-_ptx_export_packages := $(foreach source,$(PTX_PACKAGES_SELECTED),$(PTX_MAP_TO_PACKAGE_$(source))_SOURCES)
+# convert to "BASH BUSYBOX" including all sub-packages
+_ptx_export_packages := $(foreach pkg,$(PTX_PACKAGES_SELECTED),$($(PTX_MAP_TO_PACKAGE_$(pkg))_PARTS))
-# iterate over $(_ptx_export_packages) "BASH_SOURCES BUSYBOX_SOURCES" ->
+# iterate over $(_ptx_export_packages) "BASH BUSYBOX" ->
# convert to "/path/to/bash.tar.bz2 /path/to/busybox.tar.bz2"
# remove duplicates
-_ptx_export_packages_src := $(sort $(foreach source,$(_ptx_export_packages),$(ptx/export/get_source)))
+_ptx_export_packages_src := $(sort $(foreach source,$(_ptx_export_packages),$(call ptx/export/get_source,$(source)_SOURCE)))
# iterate over $(_ptx_export_packages_src) "/path/to/bash.tar.bz2 /path/to/busybox.tar.bz2" ->
# convert to "/export/bash.tar.bz2 /export/busybox.tar.bz2"
diff --git a/rules/post/ptxd_make_world_common.make b/rules/post/ptxd_make_world_common.make
index d4bd87920..4b6f691b6 100644
--- a/rules/post/ptxd_make_world_common.make
+++ b/rules/post/ptxd_make_world_common.make
@@ -87,9 +87,10 @@ world/env/impl = \
pkg_path="$(call ptx/escape,$($(1)_PATH))" \
pkg_patch_series="$(call ptx/escape,$(call remove_quotes, $(PTXCONF_$(strip $(1))_SERIES)))"\
pkg_patch_dir="$(call ptx/escape,$($(1)_PATCH_DIR))" \
+ pkg_parts="$(call ptx/escape,$($(1)_PARTS))" \
pkg_src="$(call ptx/escape,$($(1)_SOURCE))" \
pkg_srcs="$(call ptx/escape,$($(1)_SOURCES))" \
- pkg_md5s="$(call ptx/escape,$(foreach s,$($(1)_SOURCES),$($($(s))_MD5):))"\
+ pkg_md5s="$(call ptx/escape,$(foreach s,$($(1)_PARTS),$($(s)_MD5):))" \
pkg_md5="$(call ptx/escape,$($(1)_MD5))" \
pkg_url="$(call ptx/escape,$($(1)_URL))" \
pkg_cfghash="$(call ptx/escape,$($(1)_CFGHASH))" \
diff --git a/rules/post/ptxd_make_world_extract.make b/rules/post/ptxd_make_world_extract.make
index 4d1b717e3..6dde7e6d8 100644
--- a/rules/post/ptxd_make_world_extract.make
+++ b/rules/post/ptxd_make_world_extract.make
@@ -30,6 +30,10 @@ extract = \
pkg_deprecated_extract_dir="$(call ptx/escape, $(strip $(2)))" \
ptxd_make_world_extract
+extract-all = \
+ $(foreach part, $($(strip $(1))_PARTS), \
+ $(call extract, $(part))$(ptx/nl))
+
world/patchin/post = \
$(call world/env, $(1)) \
ptxd_make_world_patchin_post
@@ -37,7 +41,7 @@ world/patchin/post = \
$(STATEDIR)/%.extract:
@$(call targetinfo)
@$(call clean, $($(PTX_MAP_TO_PACKAGE_$(*))_DIR))
- @$(call extract, $(PTX_MAP_TO_PACKAGE_$(*)))
+ @$(call extract-all, $(PTX_MAP_TO_PACKAGE_$(*)))
@$(call patchin, $(PTX_MAP_TO_PACKAGE_$(*)), $($(PTX_MAP_TO_PACKAGE_$(*))_DIR))
@$(call touch)
diff --git a/rules/post/ptxd_make_world_get.make b/rules/post/ptxd_make_world_get.make
index 6ec369a75..3cbdf41b0 100644
--- a/rules/post/ptxd_make_world_get.make
+++ b/rules/post/ptxd_make_world_get.make
@@ -21,21 +21,12 @@ $(call remove_quotes, $(PTXCONF_PROJECT_DEVPKGDIR))/%-dev.tar.gz:
@$(call getdev, $@)
endif
-#
-# Use the current package for the primary source file.
-# This avoids strange effects when multiple packages share a source file.
-# For anything else $($(src)) is special and must be used.
-#
-define _ptx_source_to_pkg
-$(if $(filter $($(PTX_MAP_TO_PACKAGE_$(1))_SOURCE),$(2)),$(PTX_MAP_TO_PACKAGE_$(1)),$($(2)))
-endef
-
$(STATEDIR)/%.get:
@$(call targetinfo)
- @$(foreach src,$($(PTX_MAP_TO_PACKAGE_$(*))_SOURCES), \
- $(call world/get, $(call _ptx_source_to_pkg,$(*),$(src)))$(ptx/nl))
- @$(foreach src,$($(PTX_MAP_TO_PACKAGE_$(*))_SOURCES), \
- $(call world/check_src, $(call _ptx_source_to_pkg,$(*),$(src)))$(ptx/nl))
+ @$(foreach part,$($(PTX_MAP_TO_PACKAGE_$(*))_PARTS), \
+ $(call world/get, $(part))$(ptx/nl))
+ @$(foreach part,$($(PTX_MAP_TO_PACKAGE_$(*))_PARTS), \
+ $(call world/check_src, $(part))$(ptx/nl))
@$(call touch)
world/get = \
@@ -49,8 +40,8 @@ world/check_src = \
$(STATEDIR)/%.urlcheck:
@$(call targetinfo)
- @$(foreach src,$($(PTX_MAP_TO_PACKAGE_$(*))_SOURCES), \
- $(call world/urlcheck, $(call _ptx_source_to_pkg,$(*),$(src)))$(ptx/nl))
+ @$(foreach part,$($(PTX_MAP_TO_PACKAGE_$(*))_PARTS), \
+ $(call world/urlcheck, $(part))$(ptx/nl))
@$(call touch)
world/urlcheck = \
diff --git a/scripts/lib/ptxd_lib_dgen.awk b/scripts/lib/ptxd_lib_dgen.awk
index 3a6d88856..d7df07a7b 100644
--- a/scripts/lib/ptxd_lib_dgen.awk
+++ b/scripts/lib/ptxd_lib_dgen.awk
@@ -409,11 +409,11 @@ function write_vars_pkg_all(this_PKG, this_pkg, prefix) {
this_devpkg = "$(" this_PKG ")-$(PTXCONF_ARCH_STRING)-$(" this_PKG "_CFGHASH)-dev.tar.gz"
#
- # define ${PKG}_PKGDIR, ${PKG}_DEVPKG & ${PKG}_SOURCES
+ # define ${PKG}_PKGDIR, ${PKG}_DEVPKG & ${PKG}_PARTS
#
print this_PKG "_PKGDIR = $(PKGDIR)/" prefix "$(" this_PKG ")" > DGEN_DEPS_PRE;
print this_PKG "_DEVPKG = " prefix this_devpkg > DGEN_DEPS_PRE;
- print this_PKG "_SOURCES = $(" this_PKG "_SOURCE)" > DGEN_DEPS_PRE
+ print this_PKG "_PARTS = " this_PKG > DGEN_DEPS_PRE;
target_PKG = gensub(/^HOST_|^CROSS_/, "", 1, this_PKG);
PREFIX = gensub(/^(HOST_|CROSS_).*/, "\\1", 1, this_PKG);
@@ -436,6 +436,15 @@ function write_vars_pkg_all(this_PKG, this_pkg, prefix) {
}
}
+function write_sources(this_PKG) {
+ print "ifneq ($(" this_PKG "_SOURCES),)" > DGEN_DEPS_POST;
+ print this_PKG "_PARTS := $(" this_PKG "_PARTS) $(foreach source,$(" this_PKG "_SOURCES),$($(source)))" > DGEN_DEPS_POST;
+ print this_PKG "_SOURCES := $(" this_PKG "_SOURCE) $(" this_PKG "_SOURCES)" > DGEN_DEPS_POST;
+ print "else" > DGEN_DEPS_POST;
+ print this_PKG "_SOURCES += $(foreach part,$(" this_PKG "_PARTS),$($(part)_SOURCE))" > DGEN_DEPS_POST;
+ print "endif" > DGEN_DEPS_POST;
+}
+
function write_deps_pkg_all(this_PKG, this_pkg) {
#
# .get rule
@@ -464,7 +473,8 @@ function write_deps_pkg_active_cfghash(this_PKG, this_pkg) {
target_PKG = gensub(/^HOST_|^CROSS_/, "", 1, this_PKG);
if (prefix != "" && target_PKG in active_PKG_to_pkg)
print "ifneq ($(" this_PKG "_SOURCE),$(" target_PKG "_SOURCE))" > DGEN_DEPS_POST;
- print "$(if $(" this_PKG "_SOURCE),$(eval $(" this_PKG "_SOURCE) := " this_PKG "))" > DGEN_DEPS_POST;
+ print "$(foreach part,$(" this_PKG "_PARTS), $(eval " \
+ "$(if $($(part)_SOURCE),$(eval $($(part)_SOURCE) := $(part)))))" > DGEN_DEPS_POST;
if (prefix != "" && target_PKG in active_PKG_to_pkg)
print "endif" > DGEN_DEPS_POST;
@@ -484,7 +494,7 @@ function write_deps_pkg_active_cfghash(this_PKG, this_pkg) {
print "endif" > DGEN_DEPS_POST;
print "ifneq ($(" this_PKG "_SOURCE),)" > DGEN_DEPS_POST;
print "ifdef PTXDIST_SETUP_ONCE" > DGEN_DEPS_POST;
- print "_tmp :=$(foreach source, $(" this_PKG "_SOURCES),$($($(source))_MD5) $(notdir $(source)))" > DGEN_DEPS_POST;
+ print "_tmp :=$(foreach part, $(" this_PKG "_PARTS),$($(part)_MD5) $(notdir $($(part)_SOURCE)))" > DGEN_DEPS_POST;
print "$(file >>" PTXDIST_TEMPDIR "/pkghash-" this_PKG "_EXTRACT,$(_tmp))" > DGEN_DEPS_POST;
print "endif" > DGEN_DEPS_POST;
print "endif" > DGEN_DEPS_POST;
@@ -696,6 +706,7 @@ END {
this_pkg = PKG_to_pkg[this_PKG];
write_maps(this_PKG, "R")
write_maps(this_PKG, "B")
+ write_sources(this_PKG)
}
# extend pkghash files fist
for (this_PKG in active_PKG_to_pkg)