Skip to content

Commit eca64aa

Browse files
[AUTO-CHERRYPICK] Added directory check before cleaning-up the RPM caches. - branch 3.0-dev (#10801)
Co-authored-by: Pawel Winogrodzki <pawelwi@microsoft.com>
1 parent fff2857 commit eca64aa

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

toolkit/scripts/imggen.mk

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,10 @@ clean-imagegen:
7979
# the same, but the actual .rpm files may be fundamentally different.
8080
$(STATUS_FLAGS_DIR)/imagegen_cleanup.flag: $(depend_REPO_SNAPSHOT_TIME)
8181
@echo "REPO_SNAPSHOT_TIME has changed, sanitizing rpm cache"
82-
find "$(local_and_external_rpm_cache)" -type f -name '*.rpm' -delete
83-
touch $@
82+
@if [ -d "$(local_and_external_rpm_cache)" ]; then \
83+
find "$(local_and_external_rpm_cache)" -type f -name '*.rpm' -delete; \
84+
fi
85+
@touch $@
8486

8587
##help:target:fetch-image-packages=Locate and download all packages required for an image build.
8688
fetch-image-packages: $(image_package_cache_summary)

toolkit/scripts/pkggen.mk

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,10 @@ clean-compress-srpms:
269269
# the same, but the actual .rpm files may be fundamentally different.
270270
$(STATUS_FLAGS_DIR)/build_packages_cache_cleanup.flag: $(depend_REPO_SNAPSHOT_TIME)
271271
@echo "REPO_SNAPSHOT_TIME has changed, sanitizing rpm cache"
272-
find "$(remote_rpms_cache_dir)" -type f -name '*.rpm' -delete
273-
touch $@
272+
@if [ -d "$(remote_rpms_cache_dir)" ]; then \
273+
find "$(remote_rpms_cache_dir)" -type f -name '*.rpm' -delete; \
274+
fi
275+
@touch $@
274276

275277
ifeq ($(REBUILD_PACKAGES),y)
276278
$(RPMS_DIR): $(STATUS_FLAGS_DIR)/build-rpms.flag

0 commit comments

Comments
 (0)