Skip to content
Snippets Groups Projects
Commit 425a6862 authored by Simon Rose's avatar Simon Rose
Browse files

Updated dependency fetcher to add build number if need be

parent 29089e50
No related branches found
No related tags found
No related merge requests found
......@@ -17,3 +17,5 @@ e3.cfg
tools/ess-env.conf
.vscode
require-ess/require.Makefile
require-ess/Db/*.db
require-ess/Db/*.d
\ No newline at end of file
......@@ -3,10 +3,10 @@
# The only way to exclude header files is to set $(module)_VERSION to a blank.
# We first collect all installed modules from $(E3_SITEMODS_PATH) ...
$(foreach dir,$(patsubst $(E3_SITEMODS_PATH)/%,%,$(wildcard $(E3_SITEMODS_PATH)/*)),$(eval DECOUPLE_MODULES += $(dir)))
#$(foreach dir,$(patsubst $(E3_SITEMODS_PATH)/%,%,$(wildcard $(E3_SITEMODS_PATH)/*)),$(eval DECOUPLE_MODULES += $(dir)))
# ... except that we don't want to overwrite the versions from required modules, so keep those.
$(foreach mod,$(filter-out $(REQ),$(DECOUPLE_MODULES)),$(eval $(mod)_VERSION =))
#$(foreach mod,$(filter-out $(REQ),$(DECOUPLE_MODULES)),$(eval $(mod)_VERSION =))
# In addition to decouple the existent e3 module,
# We use this opportunatiy in order to apply global configuration
......
......@@ -547,24 +547,31 @@ EPICS_INCLUDES =
# endef
# $(eval $(foreach m,$(filter-out $(PRJ),$(notdir $(wildcard ${EPICS_MODULES}/*))),$(call ADD_FOREIGN_INCLUDES,$m)))
# Note: Due to the addition of build numbers, we have to be somewhat more careful here.
# If module A depends on module B version 3.1.0, then it should record the current build number and save
# that. Otherwise we can end up in a situation where a new module being installed can cause dependencies
# to fail to load correctly. The goal of the below is to explicitly add the latest build number, if none
# is specified. It works as follows:
# $(if $(shell [[ "$($1_VERSION)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$$ ]] && echo match), ## We test that the module version is of the form x.y.z exactly. In that case...
# $(notdir $(firstword $(shell ls -dvr $(E3_SITEMODS_PATH)/$1/$($1_VERSION)?(-+([0-9])) 2> /dev/null ))), ## ...find the highest build number with the given version...
# $($1_VERSION)) ## ... else preserve the module number as is.
define ADD_SITEMODS_INCLUDES
$(eval $(1)_VERSION := $(patsubst ${E3_SITEMODS_PATH}/$(1)/%/include,%,$(firstword $(shell ls -dvr ${E3_SITEMODS_PATH}/$(1)/$(VERSIONGLOB)/include 2>/dev/null))))
INSTALL_INCLUDES += $$(patsubst %,-I${E3_SITEMODS_PATH}/$(1)/%/include,$$($(1)_VERSION))
INSTALL_INCLUDES += $$(patsubst %,-I$(E3_SITEMODS_PATH)/$1/%/include,$$(if $$(shell [[ "$$($1_VERSION)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$$$$ ]] && echo match),$$(notdir $$(firstword $$(shell ls -dvr $(E3_SITEMODS_PATH)/$1/$$($1_VERSION)?(-+([0-9])) 2> /dev/null ))),$$($1_VERSION)))
endef
$(eval $(foreach m,$(filter-out $(PRJ),$(notdir $(wildcard ${E3_SITEMODS_PATH}/*))),$(call ADD_SITEMODS_INCLUDES,$m)))
define ADD_SITEAPPS_INCLUDES
$(eval $(1)_VERSION := $(patsubst ${E3_SITEAPPS_PATH}/$(1)/%/include,%,$(firstword $(shell ls -dvr ${E3_SITEAPPS_PATH}/$(1)/$(VERSIONGLOB)/include 2>/dev/null))))
INSTALL_INCLUDES += $$(patsubst %,-I${E3_SITEAPPS_PATH}/$(1)/%/include,$$($(1)_VERSION))
INSTALL_INCLUDES += $$(patsubst %,-I$(E3_SITEAPPS_PATH)/$1/%/include,$$(if $$(shell [[ "$$($1_VERSION)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$$$$ ]] && echo match),$$(notdir $$(firstword $$(shell ls -dvr $(E3_SITEAPPS_PATH)/$1/$$($1_VERSION)?(-+([0-9])) 2> /dev/null ))),$$($1_VERSION)))
endef
$(eval $(foreach m,$(filter-out $(PRJ),$(notdir $(wildcard ${E3_SITEAPPS_PATH}/*))),$(call ADD_SITEAPPS_INCLUDES,$m)))
# Manually required modules.
define ADD_MANUAL_DEPENDENCIES
$(eval $(1)_VERSION := $(patsubst ${E3_SITEMODS_PATH}/$(1)/%,%,$(firstword $(shell ls -dvr ${E3_SITEMODS_PATH}/$(1)/$(VERSIONGLOB) 2>/dev/null))))
$1_VERSION_BUILD = $$(if $$(shell [[ "$$($1_VERSION)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$$$$ ]] && echo match),$$(notdir $$(firstword $$(shell ls -dvr $(E3_SITEMODS_PATH)/$1/$$($1_VERSION)?(-+([0-9])) 2> /dev/null ))),$$($1_VERSION))
endef
$(eval $(foreach m,${REQ},$(call ADD_MANUAL_DEPENDENCIES,$m)))
$(foreach m,${REQ},$(eval $(call ADD_MANUAL_DEPENDENCIES,$m)))
BASERULES=${EPICS_BASE}/configure/RULES
......@@ -1016,7 +1023,7 @@ ${DEPFILE}: ${LIBOBJS} $(USERMAKEFILE)
cat *.d 2>/dev/null | sed 's/ /\n/g' | sed -n '$(DEP_PARSER)' | grep -v "include" | sort -u >> $@
ifneq ($(strip ${REQ}),)
# Manully added dependencies: ${REQ}
@$(foreach m,${REQ},echo "$m $(or ${$m_VERSION},$(and $(wildcard ${E3_SITEMODS_PATH}/$m),$(error REQUIRED module $m has no numbered version. Set $m_VERSION)),$(warning REQUIRED module $m not found for ${T_A}.))" >> $@;)
@$(foreach m,${REQ},echo "$m $(or ${$m_VERSION_BUILD},$(and $(wildcard ${E3_SITEMODS_PATH}/$m),$(error REQUIRED module $m has no numbered version. Set $m_VERSION)),$(warning REQUIRED module $m not found for ${T_A}.))" >> $@;)
endif
# Update the version numbers to ensure that the build number is included
sed -i 's/^\([a-z_][a-z0-9_]*\) \([0-9]\+\.[0-9]\+\.[0-9]\+\)$$/\1 \2-0/' $@
......
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