From 1a62e24105e2742a7d8be9ad7cbcc312cdbc1203 Mon Sep 17 00:00:00 2001 From: Liu Shilong Date: Wed, 27 Sep 2023 12:22:55 +0800 Subject: [PATCH] [build] Fix cache caculation, by adding _FILES to cache dependency file list. (#15473) Why I did it When SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT changed, almost all dockers need to be built again. But currently it will be loaded by cache. Work item tracking Microsoft ADO (number only): 25123348 How I did it Add $(DOCKER)_FILES into dependencies. --- Makefile.cache | 6 ++++-- rules/docker-eventd.mk | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile.cache b/Makefile.cache index 8f06161edda7..f12f866db9af 100644 --- a/Makefile.cache +++ b/Makefile.cache @@ -564,10 +564,12 @@ ALL_DEP_FILES_LIST += $(foreach pkg,$(2), $($(filter none,$($(1)_CACHE_MODE)), \ $(addsuffix .$(3).sha,$(addprefix $(pkg)/, $(1))))) $(foreach docker, $(filter $(SONIC_DOCKER_IMAGES), $(1)), \ $(eval $(docker)_DEP_FILES+=$(wildcard files/build/versions/default/*) \ - $(wildcard files/build/versions/dockers/$(basename $(docker))/*))) + $(wildcard files/build/versions/dockers/$(basename $(docker))/*) \ + $(foreach docker_file, $($(docker)_FILES), $(addprefix $(if $($(docker_file)_PATH), $($(docker_file)_PATH), $(FILES_PATH))/, $(docker_file))) )) $(foreach docker, $(filter $(SONIC_DOCKER_DBG_IMAGES), $(1)), \ $(eval $(docker)_DEP_FILES+=$(wildcard files/build/versions/default/*) \ - $(wildcard files/build/versions/dockers/$(patsubst %-$(DBG_IMAGE_MARK).gz,%,$(docker))/*))) + $(wildcard files/build/versions/dockers/$(patsubst %-$(DBG_IMAGE_MARK).gz,%,$(docker))/*) \ + $(foreach docker_file, $($(docker)_FILES), $(addprefix $(if $($(docker_file)_PATH), $($(docker_file)_PATH), $(FILES_PATH))/, $(docker_file))) )) $(addsuffix .$(3),$(addprefix $(2)/, $(1))) : $(2)/%.$(3) : \ $(2)/%.flags $$$$($$$$*_DEP_FILES) $$$$(if $$$$($$$$*_SMDEP_FILES), $(2)/%.smdep) @$$(eval $$*_DEP_FILES_MODIFIED := $$? ) diff --git a/rules/docker-eventd.mk b/rules/docker-eventd.mk index 367b0abecccd..fdfbc2985fac 100644 --- a/rules/docker-eventd.mk +++ b/rules/docker-eventd.mk @@ -30,6 +30,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_EVENTD) SONIC_DOCKER_DBG_IMAGES += $(DOCKER_EVENTD_DBG) SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_EVENTD_DBG) +$(DOCKER_EVENTD)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) $(DOCKER_EVENTD)_CONTAINER_NAME = eventd $(DOCKER_EVENTD)_RUN_OPT += --privileged -t $(DOCKER_EVENTD)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro