diff --git a/base/cvd/cuttlefish/host/libs/image_aggregator/BUILD.bazel b/base/cvd/cuttlefish/host/libs/image_aggregator/BUILD.bazel index d746af5c910..c2ea6c1440f 100644 --- a/base/cvd/cuttlefish/host/libs/image_aggregator/BUILD.bazel +++ b/base/cvd/cuttlefish/host/libs/image_aggregator/BUILD.bazel @@ -99,6 +99,7 @@ cf_cc_library( "//cuttlefish/io", "//cuttlefish/io:write_exact", "//cuttlefish/result", + "@abseil-cpp//absl/log", "@protobuf", "@protobuf//:differencer", "@zlib", diff --git a/base/cvd/cuttlefish/host/libs/image_aggregator/image_aggregator.cc b/base/cvd/cuttlefish/host/libs/image_aggregator/image_aggregator.cc index f6a33a633f5..fc7a3f99aeb 100644 --- a/base/cvd/cuttlefish/host/libs/image_aggregator/image_aggregator.cc +++ b/base/cvd/cuttlefish/host/libs/image_aggregator/image_aggregator.cc @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -31,6 +32,8 @@ #include #include +#include "absl/log/log.h" + #include "google/protobuf/util/message_differencer.h" #include @@ -361,7 +364,12 @@ Result CreateOrUpdateCompositeDisk( google::protobuf::util::MessageDifferencer::Equals( composite_proto, composite_image_res->GetCompositeDisk())) { // The existing composite disk matches the given partitions, no need to - // regenerate + // regenerate, but update its modification time so it is not older than + // any recently updated component images. + if (utimensat(AT_FDCWD, output_composite_path.c_str(), nullptr, 0) != 0) { + LOG(WARNING) << "Failed to update modification time for \"" + << output_composite_path << "\": " << strerror(errno); + } return {}; }