[build]: Fixes the missing dependency in the debian package is not triggering the docker rebuild (#5650)

- Fixes the dependency issue in the DPKG dependent SHA calculation. 
- The dependent SHA value of package is derived from the content of all its dependent packages.

SHA_HASH => is an SHA value derived from a module/package dedpendent files ( .flags, .sha and .smsha files) .
SHA_VALUE = > is an SHA value derived from a module/package dependent packages(.deb, .whl, etc)
Eg, For SNMP docker, SNMP and SNMPD packages are the dependency
$(DOCKER_SNMP)_DEPENDS += $(SNMP) $(SNMPD)
So, the SHA value calculation of SNMP would include the SHA value of SNMP and SNMPD packages as well. so that any change in the package should trigger the docker rebuild.
This commit is contained in:
Kalimuthu-Velappan 2020-10-20 10:23:39 +05:30 committed by GitHub
parent a5242a65dc
commit 5c5e42454d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -171,18 +171,22 @@ endef
define GET_MOD_DEP_SHA
$(eval $(1)_MOD_DEP_PKGS := $(foreach dfile,$($(1)_DEPENDS) $($(1)_RDEPENDS) $($(1)_WHEEL_DEPENDS) \
$($(1)_PYTHON_DEBS) $($(1)_PYTHON_WHEELS) \
$($(1)_DBG_DEPENDS) $($(1)_DBG_IMAGE_PACKAGES) $($(1)_LOAD_DOCKERS),\
$($(1)_DBG_DEPENDS) $($(1)_LOAD_DOCKERS),\
$(if $($(dfile)_MAIN_DEB),$($(dfile)_MAIN_DEB),$(dfile))) )
$(if $(MDEBUG), $(info $(1)_MOD_DEP_PKGS: $($(1)_MOD_DEP_PKGS)))
# Warn if there is any missing dependency files
$(eval $(1)_DEP_MOD_SHA_FILES := $(foreach dfile,$($(1)_MOD_DEP_PKGS), \
$($(dfile)_DEP_FLAGS_FILE) $($(dfile)_MOD_HASH_FILE) $($(dfile)_SMOD_HASH_FILE)) )
$($(dfile)_DEP_FLAGS_FILE) $($(dfile)_MOD_HASH_FILE) $($(dfile)_SMOD_HASH_FILE) \
$($(dfile)_DST_PATH)/$(dfile) ))
echo "DEP_MOD_SHA_FILES : $($(1)_DEP_MOD_SHA_FILES)" >> $($(1)_DST_PATH)/$(1).log
$(eval $(1)_DEP_FILES_MISSING := $(filter-out $(wildcard $($(1)_DEP_MOD_SHA_FILES)),$($(1)_DEP_MOD_SHA_FILES)) )
$(if $($(1)_DEP_FILES_MISSING), $(warning "[ DPKG ] Dependecy file(s) are not found for $(1) : $($(1)_DEP_FILES_MISSING)))
$(if $($(1)_DEP_FILES_MISSING), $(warning "[ DPKG ] Dependency file(s) are not found for $(1) : $($(1)_DEP_FILES_MISSING)))
$(eval $(1)_DEP_MOD_SHA := $(shell git hash-object $($(1)_DEP_MOD_SHA_FILES) \
$(eval $(1)_DEP_MOD_SHA_HASH := $(shell git hash-object $($(1)_DEP_MOD_SHA_FILES)))
$(eval $(1)_DEP_MOD_SHA_VALUE:= $(foreach dfile,$($(1)_MOD_DEP_PKGS), $($(dfile)_DEP_MOD_SHA)))
$(eval $(1)_DEP_MOD_SHA := $(shell echo $($(1)_DEP_MOD_SHA_HASH) $($(1)_DEP_MOD_SHA_VALUE) \
| sha1sum | awk '{print substr($$1,0,23);}'))
endef