From 3e95a42faedca0c6905442d18f1abf964e307a5f Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 4 Jul 2017 14:08:51 +0200 Subject: [PATCH] depot: remove bin// subdir Fixes #2459 --- doc/depot.txt | 16 +++++----------- tool/depot/build | 3 +-- tool/depot/mk/build_bin_archive | 19 ++++++------------- tool/depot/mk/dependencies.inc | 9 +++------ tool/run/depot.inc | 17 +---------------- 5 files changed, 16 insertions(+), 48 deletions(-) diff --git a/doc/depot.txt b/doc/depot.txt index a4300e351e..a0877c9c9d 100644 --- a/doc/depot.txt +++ b/doc/depot.txt @@ -221,7 +221,6 @@ is structured as follows: ! /raw/-/ ! /pkg/-/ ! /bin//-/ -! /bin//-/-/ The stands for the origin of the contained archives. For example, the official archives provided by Genode Labs reside in a _genodelabs/_ @@ -243,10 +242,7 @@ easily combined. The actual archives are stored in the subdirectories named after the archive types ('raw', 'api', 'src', 'bin', 'pkg'). Archives contained in the _bin/_ subdirectories are further subdivided in the various architectures (like -'x86_64', or 'arm_v7'). Note that for binaries created for source archives -that implement an API (libraries), there exists a further nesting level with -API version. Therefore, multiple library implementations (or versions) that -implement the same API are located in the same API subdirectory. +'x86_64', or 'arm_v7'). Depot management @@ -331,12 +327,10 @@ Note that the command expects a specific version of the source archive as argument. The depot may contain several versions. So the user has to decide, which one to build. -After the tool is finished, the freshly built binary archive can be found in the -depot within the _genodelabs/bin/_ subdirectory. If the source archive -implements an API (if it is a library), the result is stored at -_bin//-/-/_. Otherwise, the result is stored -at _bin//-/_. Only the final result of the built process -is preserved. In the example above, that would be the _zlib.lib.so_ library. +After the tool is finished, the freshly built binary archive can be found in +the depot within the _genodelabs/bin//-/_ subdirectory. +Only the final result of the built process is preserved. In the example above, +that would be the _zlib.lib.so_ library. For debugging purposes, it might be interesting to inspect the intermediate state of the build. This is possible by adding 'KEEP_BUILD_DIR=1' as argument diff --git a/tool/depot/build b/tool/depot/build index 7fba3e2cc5..e9a3688f6b 100755 --- a/tool/depot/build +++ b/tool/depot/build @@ -94,9 +94,8 @@ endif # # 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)/ -dst_archive_path = $(call _dst_bin_spec_path,$1)$(call _api_subdir,$1)$(call bin_archive_recipe,$1) +dst_archive_path = $(call _dst_bin_spec_path,$1)$(call bin_archive_recipe,$1) BUILD_MK_FILE := $(DEPOT_DIR)/var/build.mk diff --git a/tool/depot/mk/build_bin_archive b/tool/depot/mk/build_bin_archive index 4e0eeee41d..3669011eb1 100755 --- a/tool/depot/mk/build_bin_archive +++ b/tool/depot/mk/build_bin_archive @@ -102,20 +102,10 @@ endif # -# Look for src/api to determine whether to build a library or a target. -# If building a library, concatenate archive dir as /. -# Otherwise use has archive dir. +# Define build-directory location # -API_FILE := $(wildcard $(addsuffix /api,$(SRC_DIR))) - -ifneq ($(API_FILE),) -API := $(call file_content,$(API_FILE)) -DEPOT_ARCHIVE_DIR := $(DEPOT_BIN_DIR)/$(SPEC)/$(API)/$(VERSIONED_ARCHIVE) -else -DEPOT_ARCHIVE_DIR := $(DEPOT_BIN_DIR)/$(SPEC)/$(VERSIONED_ARCHIVE) -endif - +DEPOT_ARCHIVE_DIR := $(DEPOT_BIN_DIR)/$(SPEC)/$(VERSIONED_ARCHIVE) DEPOT_ARCHIVE_BUILD_DIR := $(addsuffix .build,$(DEPOT_ARCHIVE_DIR)) @@ -128,7 +118,10 @@ DEPOT_ARCHIVE_BUILD_DIR := $(addsuffix .build,$(DEPOT_ARCHIVE_DIR)) # # if building a library, always incorporate the API implemented by the library -USED_APIS += $(API) +API_FILE := $(wildcard $(addsuffix /api,$(SRC_DIR))) +ifneq ($(API_FILE),) +USED_APIS += $(call file_content,$(API_FILE)) +endif # incorporate all APIs used by the source archive USED_APIS_FILE := $(SRC_DIR)/used_apis diff --git a/tool/depot/mk/dependencies.inc b/tool/depot/mk/dependencies.inc index 413478964d..53aa5aa59b 100644 --- a/tool/depot/mk/dependencies.inc +++ b/tool/depot/mk/dependencies.inc @@ -60,18 +60,13 @@ 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)))) + $(call archive_user,$2)/bin/$1/$(call archive_recipe,$2))) # return list of binary archives contained in a binary package _binpkg_bin_archives = $(foreach S,$(call _binpkg_src_archives,$1),\ @@ -118,6 +113,8 @@ 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/run/depot.inc b/tool/run/depot.inc index 7386595001..d15e1d86a5 100644 --- a/tool/run/depot.inc +++ b/tool/run/depot.inc @@ -91,20 +91,6 @@ proc _import_src_archive_from_depot { user name } { set bin_archive "$user/bin/[depot_spec]/$name" - # - # If the binary archive contains a library, direct 'bin_archive' to the - # correct API sub directory. - # - set api_file_path "[depot_dir]/$user/src/$name/api" - if {[file exists $api_file_path]} { - set fh [open "$api_file_path" "RDONLY"] - set api [read $fh] - close $fh - regsub -all {\s} $api {} api - if {$api != ""} { - set bin_archive "$user/bin/[depot_spec]/$api/$name" } - } - if {[file exists [depot_dir]/$bin_archive]} { _copy_directory_content_to_run_dir "[depot_dir]/$bin_archive" } else { @@ -261,8 +247,7 @@ proc check_for_missing_depot_archives { } { } else { lappend foreign_archives $archive } - } elseif {[regexp [_depot_lib_archive_path_pattern] $archive dummy user spec name] - || [regexp [_depot_bin_archive_path_pattern] $archive dummy user spec name]} { + } elseif {[regexp [_depot_bin_archive_path_pattern] $archive dummy user spec name]} { # source code is present in the current source tree set recipe [_locally_available_recipe $user src $name]