Skip to content

Commit 6324fe1

Browse files
authored
Add log files into the cache tar for improved debugging (sonic-net#18026)
### Why I did it Cache currently does not save the log of the deb. But it's useful to have the log to understand any cache related problems. ### How I did it #### How to verify it ``` vkarri@s-build-sonic-01:/sonic-buildimage$ tar -tvf /sonic/sonic_caches/libnl-3-200_3.5.0-1_amd64.deb-adc83b19e793491b1c6ea0f-0ea77d65c49ae3a11dffbca.tgz -rw-r--r-- vkarri/dip 496230 2024-01-12 19:49 target/debs/bookworm/libnl-3-200_3.5.0-1_amd64.deb.log ```
1 parent 1d57472 commit 6324fe1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Makefile.cache

+4-2
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,12 @@ define SAVE_INTO_CACHE
295295
echo "Target $(1) dependencies are modifed - global save cache skipped" >> $($(1)_DST_PATH)/$(1).log
296296
$(eval $(1)_CACHE_DIR := $(SONIC_DPKG_LOCAL_CACHE_DIR))
297297
)
298-
$($(1)_CACHE_USER) tar -C $($(1)_BASE_PATH) -mczvf $($(1)_CACHE_DIR)/$(MOD_CACHE_FILE) $(2) $(addprefix $($(1)_DST_PATH)/,$($(1)_DERIVED_DEBS) $($(1)_EXTRA_DEBS) ) \
298+
cp $($(1)_DST_PATH)/$(1).log $($(1)_DST_PATH)/$(1).cached.log
299+
$($(1)_CACHE_USER) tar -C $($(1)_BASE_PATH) -mczvf $($(1)_CACHE_DIR)/$(MOD_CACHE_FILE) $(2) $(addprefix $($(1)_DST_PATH)/,$($(1)_DERIVED_DEBS) $($(1)_EXTRA_DEBS) $(1).cached.log) \
299300
1>>$($(1)_DST_PATH)/$(1).log
300301
sudo chmod 777 $($(1)_CACHE_DIR)/$(MOD_CACHE_FILE)
301-
302+
rm -f $($(1)_DST_PATH)/$(1).cached.log
303+
302304
echo "File $($(1)_CACHE_DIR)/$(MOD_CACHE_FILE) saved in cache " >> $($(1)_DST_PATH)/$(1).log
303305
echo "[ CACHE::SAVED ] $($(1)_CACHE_DIR)/$(MOD_CACHE_FILE)" >> $($(1)_DST_PATH)/$(1).log
304306

0 commit comments

Comments
 (0)