@@ -75,6 +75,13 @@ clean-imagegen:
7575 $(SCRIPTS_DIR ) /safeunmount.sh " $( IMAGEGEN_DIR) " && \
7676 rm -rf $(IMAGEGEN_DIR )
7777
78+ # We need to clear the rpm package cache if we have a snapshot time. The filenames will all be
79+ # the same, but the actual .rpm files may be fundamentally different.
80+ $(STATUS_FLAGS_DIR ) /imagegen_cleanup.flag : $(depend_REPO_SNAPSHOT_TIME )
81+ @echo " REPO_SNAPSHOT_TIME has changed, sanitizing rpm cache"
82+ rm -rf $(local_and_external_rpm_cache )
83+ touch $@
84+
7885# #help:target:fetch-image-packages=Locate and download all packages required for an image build.
7986fetch-image-packages : $(image_package_cache_summary )
8087
@@ -113,7 +120,11 @@ ifeq ($(USE_PREVIEW_REPO),y)
113120imagepkgfetcher_extra_flags += --use-preview-repo
114121endif
115122
116- $(image_package_cache_summary ) : $(go-imagepkgfetcher ) $(chroot_worker ) $(toolchain_rpms ) $(imggen_local_repo ) $(depend_REPO_LIST ) $(REPO_LIST ) $(depend_CONFIG_FILE ) $(CONFIG_FILE ) $(validate-config ) $(RPMS_DIR ) $(imggen_rpms )
123+ ifneq ($(REPO_SNAPSHOT_TIME ) ,)
124+ imagepkgfetcher_extra_flags += --repo-snapshot-time=$(REPO_SNAPSHOT_TIME )
125+ endif
126+
127+ $(image_package_cache_summary ) : $(go-imagepkgfetcher ) $(chroot_worker ) $(toolchain_rpms ) $(imggen_local_repo ) $(depend_REPO_LIST ) $(REPO_LIST ) $(depend_CONFIG_FILE ) $(CONFIG_FILE ) $(validate-config ) $(RPMS_DIR ) $(imggen_rpms ) $(depend_REPO_SNAPSHOT_TIME ) $(STATUS_FLAGS_DIR ) /imagegen_cleanup.flag
117128 $(if $(CONFIG_FILE ) ,,$(error Must set CONFIG_FILE=) )
118129 $(go-imagepkgfetcher ) \
119130 --input=$(CONFIG_FILE ) \
@@ -146,7 +157,7 @@ $(imager_disk_output_dir): $(STATUS_FLAGS_DIR)/imager_disk_output.flag
146157 @touch $@
147158 @echo Finished updating $@
148159
149- $(STATUS_FLAGS_DIR ) /imager_disk_output.flag : $(go-imager ) $(image_package_cache_summary ) $(license_results_file_img ) $(imggen_local_repo ) $(depend_CONFIG_FILE ) $(CONFIG_FILE ) $(validate-config ) $(assets_files )
160+ $(STATUS_FLAGS_DIR ) /imager_disk_output.flag : $(go-imager ) $(image_package_cache_summary ) $(license_results_file_img ) $(imggen_local_repo ) $(depend_CONFIG_FILE ) $(CONFIG_FILE ) $(validate-config ) $(assets_files ) $( depend_REPO_SNAPSHOT_TIME )
150161 $(if $(CONFIG_FILE ) ,,$(error Must set CONFIG_FILE=) )
151162 mkdir -p $(imager_disk_output_dir ) && \
152163 rm -rf $(imager_disk_output_dir ) /* && \
@@ -159,6 +170,7 @@ $(STATUS_FLAGS_DIR)/imager_disk_output.flag: $(go-imager) $(image_package_cache_
159170 --log-color=$(LOG_COLOR ) \
160171 --local-repo $(local_and_external_rpm_cache ) \
161172 --tdnf-worker $(chroot_worker ) \
173+ --repo-snapshot-time=$(REPO_SNAPSHOT_TIME ) \
162174 --repo-file=$(imggen_local_repo ) \
163175 --output-image-contents=$(image_package_manifest ) \
164176 --assets $(assets_dir ) \
@@ -198,7 +210,7 @@ image: $(imager_disk_output_dir) $(imager_disk_output_files) $(go-roast) $(depen
198210 $(if $(filter y,$(ENABLE_TRACE ) ) ,--enable-trace) \
199211 --timestamp-file=$(TIMESTAMP_DIR ) /roast.jsonl
200212
201- $(image_external_package_cache_summary ) : $(cached_file ) $(go-imagepkgfetcher ) $(chroot_worker ) $(graph_file ) $(depend_REPO_LIST ) $(REPO_LIST ) $(depend_CONFIG_FILE ) $(CONFIG_FILE ) $(validate-config )
213+ $(image_external_package_cache_summary ) : $(cached_file ) $(go-imagepkgfetcher ) $(chroot_worker ) $(graph_file ) $(depend_REPO_LIST ) $(REPO_LIST ) $(depend_CONFIG_FILE ) $(CONFIG_FILE ) $(validate-config ) $( depend_REPO_SNAPSHOT_TIME ) $( STATUS_FLAGS_DIR ) /imagegen_cleanup.flag
202214 $(if $(CONFIG_FILE ) ,,$(error Must set CONFIG_FILE=) )
203215 $(go-imagepkgfetcher ) \
204216 --input=$(CONFIG_FILE ) \
@@ -229,7 +241,7 @@ $(image_external_package_cache_summary): $(cached_file) $(go-imagepkgfetcher) $(
229241
230242# We need to ensure that initrd_img recursive build will never run concurrently with another build component, so add all ISO prereqs as
231243# order-only-prerequisites to initrd_img
232- iso_deps = $(go-isomaker ) $(go-imager ) $(depend_CONFIG_FILE ) $(CONFIG_FILE ) $(validate-config ) $(image_package_cache_summary ) $(license_results_file_img )
244+ iso_deps = $(go-isomaker ) $(go-imager ) $(depend_CONFIG_FILE ) $(CONFIG_FILE ) $(validate-config ) $(image_package_cache_summary ) $(license_results_file_img ) $( depend_REPO_SNAPSHOT_TIME )
233245# The initrd bundles these files into the image, we should rebuild it if they change
234246initrd_bundled_files = $(go-liveinstaller ) $(go-imager ) $(assets_files ) $(initrd_assets_files ) $(imggen_local_repo )
235247
@@ -250,6 +262,7 @@ iso: $(initrd_img) $(iso_deps)
250262 --input $(CONFIG_FILE ) \
251263 --release-version $(RELEASE_VERSION ) \
252264 --resources $(RESOURCES_DIR ) \
265+ --repo-snapshot-time=$(REPO_SNAPSHOT_TIME ) \
253266 --iso-repo $(local_and_external_rpm_cache ) \
254267 --log-level=$(LOG_LEVEL ) \
255268 --log-file=$(LOGS_DIR ) /imggen/isomaker.log \
0 commit comments