Enable missed cache for local debs (#14794)

- Why I did it
To be able to cache, and then retrieve cached "copied" debs

- How I did it
Add missed caching and cache retrieval steps

- How to verify it
Build with cache and then clean and rebuild again. The targets added to SONIC_COPY_DEBS should be taken from a cache.

Signed-off-by: Yevhen Fastiuk <yfastiuk@nvidia.com>
This commit is contained in:
Yevhen Fastiuk 2023-05-03 13:24:42 +03:00 committed by GitHub
parent 9f680cb67c
commit ef2d08b2ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -544,10 +544,25 @@ endef
# SOME_NEW_DEB = some_new_deb.deb
# $(SOME_NEW_DEB)_PATH = path/to/some_new_deb.deb
# SONIC_COPY_DEBS += $(SOME_NEW_DEB)
$(addprefix $(DEBS_PATH)/, $(SONIC_COPY_DEBS)) : $(DEBS_PATH)/% : .platform
$(addprefix $(DEBS_PATH)/, $(SONIC_COPY_DEBS)) : $(DEBS_PATH)/% : .platform \
$(call dpkg_depend,$(DEBS_PATH)/%.dep)
$(HEADER)
$(foreach deb,$* $($*_DERIVED_DEBS), \
{ cp $($(deb)_PATH)/$(deb) $(DEBS_PATH)/ $(LOG) || exit 1 ; } ; )
# Load the target deb from DPKG cache
$(call LOAD_CACHE,$*,$@)
# Skip building the target if it is already loaded from cache
if [ -z '$($*_CACHE_LOADED)' ] ; then
$(foreach deb,$* $($*_DERIVED_DEBS), \
{ cp $($(deb)_PATH)/$(deb) $(DEBS_PATH)/ $(LOG) || exit 1 ; } ; )
# Save the target deb into DPKG cache
$(call SAVE_CACHE,$*,$@)
fi
$(FOOTER)