Change purpose of this PR to just overriding the abi
MODIFY
include/vcpkg/binaryparagraph.h
include/vcpkg/binaryparagraph.h
namespace vcpkg
{
- enum class ConsistencyState : unsigned
- {
- UNKNOWN = 0,
- CONSISTENT,
- INCONSISTENT,
- };
-
/// <summary>
/// Built package metadata
/// </summary>
@@ -31,8 +24,6 @@ namespace vcpkg
std::string dir() const;
- bool is_consistent() const;
-
PackageSpec spec;
std::string version;
std::string description;
@@ -41,9 +32,6 @@ namespace vcpkg
std::vector<std::string> default_features;
std::vector<std::string> depends;
std::string abi;
- std::map<fs::path, std::string> external_files;
-
- mutable ConsistencyState consistency = ConsistencyState::UNKNOWN;
};
struct BinaryControlFile

MODIFY
include/vcpkg/build.h
include/vcpkg/build.h
@@ -137,8 +137,9 @@ namespace vcpkg::Build
Optional<fs::path> visual_studio_path;
Optional<std::string> external_toolchain_file;
Optional<ConfigurationType> build_type;
+ Optional<std::string> public_abi_override;
+ Optional<const SourceControlFileLocation&> port;
std::vector<std::string> passthrough_env_vars;
- std::vector<std::pair<fs::path, std::string>> external_files;
};
std::string make_build_env_cmd(const PreBuildInfo& pre_build_info, const Toolset& toolset);
@@ -153,7 +154,7 @@ namespace vcpkg::Build
CHAINLOAD_TOOLCHAIN_FILE,
BUILD_TYPE,
ENV_PASSTHROUGH,
- EXTERNAL_FILES,
+ PUBLIC_ABI_OVERRIDE,
};
const std::unordered_map<std::string, VcpkgTripletVar> VCPKG_OPTIONS = {
@@ -165,7 +166,7 @@ namespace vcpkg::Build
{"VCPKG_CHAINLOAD_TOOLCHAIN_FILE", VcpkgTripletVar::CHAINLOAD_TOOLCHAIN_FILE},
{"VCPKG_BUILD_TYPE", VcpkgTripletVar::BUILD_TYPE},
{"VCPKG_ENV_PASSTHROUGH", VcpkgTripletVar::ENV_PASSTHROUGH},
- {"VCPKG_EXTERNAL_FILES", VcpkgTripletVar::EXTERNAL_FILES},
+ {"VCPKG_PUBLIC_ABI_OVERRIDE", VcpkgTripletVar::PUBLIC_ABI_OVERRIDE},
};
struct ExtendedBuildResult

MODIFY
src/vcpkg/binaryparagraph.cpp
src/vcpkg/binaryparagraph.cpp
@@ -25,33 +25,6 @@ namespace vcpkg
static const std::string MAINTAINER = "Maintainer";
static const std::string DEPENDS = "Depends";
static const std::string DEFAULTFEATURES = "Default-Features";
- static const std::string EXTERNALFILES = "External-Files";
- }
-
- bool BinaryParagraph::is_consistent() const
- {
- switch (consistency)
- {
- case ConsistencyState::UNKNOWN :
- for (const auto& file_hash : external_files)
- {
- const auto& realfs = Files::get_real_filesystem();
-
- if (!realfs.is_regular_file(file_hash.first) ||
- Hash::get_file_hash(realfs, file_hash.first, "SHA1") != file_hash.second)
- {
- consistency = ConsistencyState::INCONSISTENT;
- return false;
- }
- }
-
- consistency = ConsistencyState::CONSISTENT;
- return true;
- case ConsistencyState::CONSISTENT : return true;
- case ConsistencyState::INCONSISTENT : return false;
- }
-
- Checks::unreachable(VCPKG_LINE_INFO);
}
BinaryParagraph::BinaryParagraph() = default;
@@ -89,26 +62,6 @@ namespace vcpkg
this->default_features = parse_comma_list(parser.optional_field(Fields::DEFAULTFEATURES));
}
- std::vector<std::string> external_files_or_hashes =
- parse_comma_list(parser.optional_field(Fields::EXTERNALFILES));
-
- if (external_files_or_hashes.size() % 2 != 0)
- {
- Checks::exit_with_message(
- VCPKG_LINE_INFO,
- "The External-Files field is not composed of key-value pairs for ",
- this->spec);
- }
-
- for (decltype(external_files_or_hashes)::size_type i = 0;
- i < external_files_or_hashes.size();
- i += 2)
- {
- external_files.emplace(
- std::move(external_files_or_hashes[i]),
- std::move(external_files_or_hashes[i+1]));
- }
-
if (const auto err = parser.error_info(this->spec.to_string()))
{
System::print2(System::Color::error, "Error: while parsing the Binary Paragraph for ", this->spec, '\n');
@@ -168,17 +121,5 @@ namespace vcpkg
if (!pgh.maintainer.empty()) out_str.append("Maintainer: ").append(pgh.maintainer).push_back('\n');
if (!pgh.abi.empty()) out_str.append("Abi: ").append(pgh.abi).push_back('\n');
if (!pgh.description.empty()) out_str.append("Description: ").append(pgh.description).push_back('\n');
-
- if (!pgh.external_files.empty())
- {
- out_str.append("External-Files: ");
- out_str.append(Strings::join(",",
- Util::fmap(
- pgh.external_files,
- [](const std::pair<fs::path, std::string>& kv)
- {
- return kv.first.u8string() + "," + kv.second;
- }))).push_back('\n');
- }
}
}

MODIFY
src/vcpkg/build.cpp
src/vcpkg/build.cpp
@@ -277,13 +277,6 @@ namespace vcpkg::Build
bpgh.version = *p_ver;
}
- for (auto& file_hash : pre_build_info.external_files)
- {
- bpgh.external_files.emplace(
- file_hash.first.u8string(),
- std::move(file_hash.second));
- }
-
bcf->core_paragraph = std::move(bpgh);
return bcf;
}
@@ -451,45 +444,6 @@ namespace vcpkg::Build
return command;
}
- static std::vector<std::pair<fs::path, std::string>> get_external_file_hashes(
- const VcpkgPaths& paths,
- const std::vector<fs::path>& files)
- {
- static std::map<fs::path, std::string> s_hash_cache;
-
- const auto& fs = paths.get_filesystem();
-
- std::vector<std::pair<fs::path, std::string>> hashes;
- for (const fs::path& external_file : files)
- {
- auto it_hash = s_hash_cache.find(external_file);
-
- if (it_hash != s_hash_cache.end())
- {
- hashes.emplace_back(external_file, it_hash->second);
- }
- else if (Files::get_real_filesystem().is_regular_file(external_file))
- {
- auto emp = s_hash_cache.emplace(
- external_file.u8string(),
- Hash::get_file_hash(
- Files::get_real_filesystem(),
- external_file, "SHA1"));
-
- hashes.emplace_back(external_file.u8string(), emp.first->second);
- }
- else
- {
- Checks::exit_with_message(
- VCPKG_LINE_INFO,
- external_file.u8string() +
- " was listed as an additional file for calculating the abi, but was not found.");
- }
- }
-
- return hashes;
- }
-
static std::string get_triplet_abi(const VcpkgPaths& paths,
const PreBuildInfo& pre_build_info,
const Triplet& triplet)
@@ -645,6 +599,15 @@ namespace vcpkg::Build
const PreBuildInfo& pre_build_info,
Span<const AbiEntry> dependency_abis)
{
+ if (pre_build_info.public_abi_override)
+ {
+ return AbiTagAndFile
+ {
+ "override",
+ pre_build_info.public_abi_override.value_or_exit(VCPKG_LINE_INFO)
+ };
+ }
+
auto& fs = paths.get_filesystem();
const Triplet& triplet = config.triplet;
const std::string& name = config.scf.core_paragraph->name;
@@ -694,29 +657,6 @@ namespace vcpkg::Build
}
}
- //Make a copy of the external file names and their hashes, and sort by
- //hash.
- std::vector<std::pair<std::string, std::string>> additional_file_hashes
- = Util::fmap(pre_build_info.external_files,
- [](const std::pair<fs::path, std::string>& file_hash)
- {
- return std::pair<std::string, std::string>{
- file_hash.second,
- file_hash.first.filename().u8string()
- };
- });
-
- std::sort(additional_file_hashes.begin(), additional_file_hashes.end());
-
- for (auto& hash_file : additional_file_hashes)
- {
- abi_tag_entries.emplace_back(
- AbiEntry{
- std::move(hash_file.second),
- std::move(hash_file.first)
- });
- }
-
abi_tag_entries.emplace_back(AbiEntry{"cmake", paths.get_tool_version(Tools::CMAKE)});
abi_tag_entries.emplace_back(AbiEntry{
@@ -835,11 +775,16 @@ namespace vcpkg::Build
if (!required_fspecs.empty())
{
- return {BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES, std::move(required_fspecs)};
+ return {
+ BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES,
+ std::move(required_fspecs)
+ };
}
const PackageSpec spec =
- PackageSpec::from_name_and_triplet(config.scf.core_paragraph->name, triplet).value_or_exit(VCPKG_LINE_INFO);
+ PackageSpec::from_name_and_triplet(
+ config.scf.core_paragraph->name,
+ triplet).value_or_exit(VCPKG_LINE_INFO);
std::vector<AbiEntry> dependency_abis;
@@ -856,15 +801,27 @@ namespace vcpkg::Build
const auto pre_build_info = PreBuildInfo::from_triplet_file(paths, triplet, config.scfl);
auto maybe_abi_tag_and_file = compute_abi_tag(paths, config, pre_build_info, dependency_abis);
+ if (!maybe_abi_tag_and_file)
+ {
+ return do_build_package_and_clean_buildtrees(
+ paths,
+ pre_build_info,
+ spec,
+ AbiTagAndFile{}.tag,
+ config);
+ }
+ std::error_code ec;
const auto abi_tag_and_file = maybe_abi_tag_and_file.get();
const fs::path archives_root_dir = paths.root / "archives";
const std::string archive_name = abi_tag_and_file->tag + ".zip";
const fs::path archive_subpath = fs::u8path(abi_tag_and_file->tag.substr(0, 2)) / archive_name;
const fs::path archive_path = archives_root_dir / archive_subpath;
const fs::path archive_tombstone_path = archives_root_dir / "fail" / archive_subpath;
+ const fs::path abi_package_dir = paths.package_dir(spec) / "share" / spec.name();
+ const fs::path abi_file_in_package = paths.package_dir(spec) / "share" / spec.name() / "vcpkg_abi_info.txt";
- if (config.build_package_options.binary_caching == BinaryCaching::YES && abi_tag_and_file)
+ if (config.build_package_options.binary_caching == BinaryCaching::YES)
{
if (fs.exists(archive_path))
{
@@ -900,20 +857,19 @@ namespace vcpkg::Build
System::printf("Could not locate cached archive: %s\n", archive_path.u8string());
}
+ fs.create_directories(abi_package_dir, ec);
+ Checks::check_exit(VCPKG_LINE_INFO, !ec, "Coud not create directory %s", abi_package_dir.u8string());
+ fs.copy_file(abi_tag_and_file->tag_file, abi_file_in_package, fs::stdfs::copy_options::none, ec);
+ Checks::check_exit(VCPKG_LINE_INFO, !ec, "Could not copy into file: %s", abi_file_in_package.u8string());
+
ExtendedBuildResult result =
do_build_package_and_clean_buildtrees(
paths,
pre_build_info,
spec,
- maybe_abi_tag_and_file.value_or(AbiTagAndFile{}).tag,
+ maybe_abi_tag_and_file.value_or_exit(VCPKG_LINE_INFO).tag,
config);
- std::error_code ec;
- fs.create_directories(paths.package_dir(spec) / "share" / spec.name(), ec);
- auto abi_file_in_package = paths.package_dir(spec) / "share" / spec.name() / "vcpkg_abi_info.txt";
- fs.copy_file(abi_tag_and_file->tag_file, abi_file_in_package, fs::stdfs::copy_options::none, ec);
- Checks::check_exit(VCPKG_LINE_INFO, !ec, "Could not copy into file: %s", abi_file_in_package.u8string());
-
if (config.build_package_options.binary_caching == BinaryCaching::YES &&
result.code == BuildResult::SUCCEEDED)
{
@@ -1098,6 +1054,8 @@ namespace vcpkg::Build
PreBuildInfo pre_build_info;
+ pre_build_info.port = port;
+
const auto e = lines.cend();
auto cur = std::find(lines.cbegin(), e, FLAG_GUID);
if (cur != e) ++cur;
@@ -1154,15 +1112,9 @@ namespace vcpkg::Build
case VcpkgTripletVar::ENV_PASSTHROUGH :
pre_build_info.passthrough_env_vars = Strings::split(variable_value, ";");
break;
- case VcpkgTripletVar::EXTERNAL_FILES :
- pre_build_info.external_files =
- get_external_file_hashes(
- paths,
- Util::fmap(Strings::split(variable_value, ";"),
- [](const std::string& path)
- {
- return fs::path{path};
- }));
+ case VcpkgTripletVar::PUBLIC_ABI_OVERRIDE :
+ pre_build_info.public_abi_override =
+ variable_value.empty() ? nullopt : Optional<std::string>{variable_value};
break;
}
}

MODIFY
src/vcpkg/dependencies.cpp
src/vcpkg/dependencies.cpp
@@ -663,16 +663,13 @@ namespace vcpkg::Dependencies
if (auto p_installed = cluster.installed.get())
{
- if (p_installed->original_features.find(feature) != p_installed->original_features.end() &&
- p_installed->ipv.core->package.is_consistent())
+ if (p_installed->original_features.find(feature) != p_installed->original_features.end())
{
return MarkPlusResult::SUCCESS;
}
}
- //The feature was not previously installed or the external files of the
- //port are no longer consistent with the last installation of this port
- //(they've either been modified or removed). Mark the cluster
+ //The feature was not previously installed. Mark the cluster
//(aka the entire port) to be removed before re-adding it.
mark_minus(cluster, graph, graph_plan, prevent_default_features);

Change purpose of this PR to just overriding the abi