From c8e4d2715bd286e5f67da0a987fd3892cf438cc2 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Fri, 9 Jun 2017 17:03:40 +0200 Subject: [PATCH] depot: fix binary-archive handling for libs The depot tool did not consistently distinct libraries from regular targets when handling binary archives. The binary archive of a regular target is located at /// whereas a library is located at ////. Fixes #2438 --- tool/depot/build | 3 --- tool/depot/mk/dependencies.inc | 24 ++++++++++++++++++------ tool/depot/mk/front_end.inc | 8 +++----- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/tool/depot/build b/tool/depot/build index f00c55965..7fba3e2cc 100755 --- a/tool/depot/build +++ b/tool/depot/build @@ -93,9 +93,6 @@ endif # Generate makefile for archive-build stage # -bin_archive_spec = $(word 3,$(subst /, ,$1)) -bin_archive_recipe = $(word 4,$(subst /, ,$1)) - # determine binary-archive path within the depot _api_subdir = $(addsuffix /,$(call file_content,$(call api_file,$(call src_of_bin,$1)))) _dst_bin_spec_path = $(call archive_user,$1)/bin/$(call bin_archive_spec,$1)/ diff --git a/tool/depot/mk/dependencies.inc b/tool/depot/mk/dependencies.inc index fd9d5c675..413478964 100644 --- a/tool/depot/mk/dependencies.inc +++ b/tool/depot/mk/dependencies.inc @@ -39,10 +39,6 @@ ARCHIVES(pkg) := $(sort ${ARCHIVES(pkg)} $(call _pkg_deps,${ARCHIVES(pkg)})) # return list of source archives needed by a given binary package _binpkg_src_archives = $(call pkg_src_archives,$(call pkg_of_binpkg,$1)) -# return list of binary archives contained in a binary package -_binpkg_bin_archives = $(foreach S,$(call _binpkg_src_archives,$1),\ - $(call bin_for_src,$(call bin_archive_spec,$1),$S)) - # return list of package archives contained in a binary package _binpkg_pkg_archives = $(foreach P,$(call pkg_pkg_archives,$(call pkg_of_binpkg,$1)),\ $(call binpkg_for_pkg,$(call bin_archive_spec,$1),$P)) @@ -64,6 +60,24 @@ ARCHIVES(pkg) := $(sort ${ARCHIVES(pkg)} $(foreach P,${ARCHIVES(binpkg)},\ # Extend ARCHIVES(bin) with binary-package dependencies # +_lib_api = $(call file_content,$(call api_file,$1)) + +# return binary-archive path for user ($1), architecture ($2), api ($3), and recipe ($4) +_bin_for_src_api = $(if $3,$1/bin/$2/$3/$4,$1/bin/$2/$4) + +# return non-empty result if source archive exists +_src_exists = $(wildcard $(dir $(call used_apis_file,$1))) + +# return binary-archive path for architecture $1 and source archive $2 +_bin_for_src = $(strip \ + $(if $(call _src_exists,$2),\ + $(call _bin_for_src_api,$(call archive_user,$2),$1,$(call _lib_api,$2),$(call archive_recipe,$2)))) + +# return list of binary archives contained in a binary package +_binpkg_bin_archives = $(foreach S,$(call _binpkg_src_archives,$1),\ + $(call _bin_for_src,$(call bin_archive_spec,$1),$S)) + + ARCHIVES(bin) := $(sort ${ARCHIVES(bin)} $(foreach P,${ARCHIVES(binpkg)},\ $(call _binpkg_bin_archives,$P))) @@ -104,8 +118,6 @@ ARCHIVES(api) := $(sort ${ARCHIVES(api)} $(foreach A,${ARCHIVES(src)},\ # Extend ARCHIVES(api) with the APIs implemented by library ARCHIVES(src) # -_lib_api = $(call file_content,$(call api_file,$1)) - _lib_api_archive = $(addprefix $(call archive_user,$1)/api/,$(call _lib_api,$1)) ARCHIVES(api) := $(sort ${ARCHIVES(api)} $(foreach A,${ARCHIVES(src)},\ diff --git a/tool/depot/mk/front_end.inc b/tool/depot/mk/front_end.inc index b0b1e05c4..107574b55 100644 --- a/tool/depot/mk/front_end.inc +++ b/tool/depot/mk/front_end.inc @@ -36,7 +36,8 @@ recipe_version = $(firstword $(call file_content,$(addsuffix /hash,$(call recipe sanitized = $(subst ..,__,$1) -path_element = $(call sanitized,$(word $1,$(subst /, ,$2))) +path_element = $(call sanitized,$(word $1,$(subst /, ,$2))) +last_path_element = $(call sanitized,$(lastword $(subst /, ,$1))) archive_user = $(call path_element,1,$1) archive_type = $(call path_element,2,$1) @@ -47,7 +48,7 @@ archive_version = $(call recipe_version,$(addprefix $(call archive_type,$1)/,$( # binary archives have the form /bin//{-} bin_archive_spec = $(call path_element,3,$1) -bin_archive_recipe = $(call path_element,4,$1) +bin_archive_recipe = $(call last_path_element,$1) bin_archive_version = $(call recipe_version,src/$(call bin_archive_recipe,$1)) grep_archive_type = $(foreach A,$2,$(if $(call archive_has_type,$A,$1),$A,)) @@ -56,9 +57,6 @@ grep_archive_user = $(foreach A,$2,$(if $(call archive_has_user,$A,$1),$A,)) # return pkg-archive path of given binary-pkg archive path pkg_of_binpkg = $(call archive_user,$1)/pkg/$(call bin_archive_recipe,$1) -# return binary-archive path for architecture $1 and source archive $2 -bin_for_src = $(call archive_user,$2)/bin/$1/$(call archive_recipe,$2) - # return source-archive path for given binary-archive path src_of_bin = $(call archive_user,$1)/src/$(call bin_archive_recipe,$1)