From 3af14624509ca9445fc81af90b354626e3fc7f69 Mon Sep 17 00:00:00 2001 From: rmuthiah Date: Tue, 12 May 2026 11:50:03 -0400 Subject: [PATCH] =?UTF-8?q?Revert=20"Substitute=20all=20artifacts=20when?= =?UTF-8?q?=20the=20build=20has=20the=20debian=5Fsubstitution=5Fm=E2=80=A6?= =?UTF-8?q?"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 2be2689e38b8d134be4009687f8ba408bae71a2b. --- .../host/commands/cvd/fetch/substitute.cc | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/base/cvd/cuttlefish/host/commands/cvd/fetch/substitute.cc b/base/cvd/cuttlefish/host/commands/cvd/fetch/substitute.cc index d11f53f9769..57d44c24f9f 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/fetch/substitute.cc +++ b/base/cvd/cuttlefish/host/commands/cvd/fetch/substitute.cc @@ -161,32 +161,28 @@ Result SubstituteWithMarker(const std::string& target_dir, Result HostPackageSubstitution( const std::string& target_dir, const std::vector& host_substitutions) { - - // TODO: remove when we can safely add this to the marker file. - std::string cvdalloc_src = - fmt::format("{}/bin/{}", CF_EXPECT(GetCuttlefishCommonDir()), "cvdalloc"); - std::string cvdalloc_name = fmt::format("{}/bin/{}", target_dir, "cvdalloc"); - CF_EXPECT(Substitute(cvdalloc_src, cvdalloc_name)); - - // [DEVELOPMENT ONLY] Substitute when `--host_substitutions` flag is used. - if (!host_substitutions.empty()) { - return SubstituteWithFlag(target_dir, host_substitutions); - } - - // [DEVELOPMENT ONLY] Substitute when LOCAL_DEBIAN_SUBSTITUTION_MARKER_FILE is set. + std::string marker_file = target_dir + "/etc/debian_substitution_marker"; + // Use a local debian_substitution_marker file for development purposes. std::optional local_marker_file = StringFromEnv("LOCAL_DEBIAN_SUBSTITUTION_MARKER_FILE"); if (local_marker_file.has_value()) { - std::string marker_file = local_marker_file.value(); + marker_file = local_marker_file.value(); CF_EXPECTF(FileExists(marker_file), "local debian substitution marker file does not exist: {}", marker_file); LOG(INFO) << "using local debian substitution marker file: " << marker_file; - return SubstituteWithMarker(target_dir, marker_file); } - if (FileExists(target_dir + "/etc/debian_substitution_marker")) { - return SubstituteWithFlag(target_dir, {"all"}); + // TODO: remove when we can safely add this to the marker file. + std::string cvdalloc_src = + fmt::format("{}/bin/{}", CF_EXPECT(GetCuttlefishCommonDir()), "cvdalloc"); + std::string cvdalloc_name = fmt::format("{}/bin/{}", target_dir, "cvdalloc"); + CF_EXPECT(Substitute(cvdalloc_src, cvdalloc_name)); + + if (host_substitutions.empty() && FileExists(marker_file)) { + CF_EXPECT(SubstituteWithMarker(target_dir, marker_file)); + } else { + CF_EXPECT(SubstituteWithFlag(target_dir, host_substitutions)); } return {};