-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure spdx_location is not dropped when loading ports. #1237
Changes from 4 commits
903cb74
dc0110e
a18997b
6e794ec
a922e76
4434e81
a869a44
51150c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -388,7 +388,7 @@ namespace vcpkg | |
auto maybe_git_tree_map = paths.git_get_local_port_treeish_map(); | ||
auto& git_tree_map = maybe_git_tree_map.value_or_exit(VCPKG_LINE_INFO); | ||
|
||
// Find ports with uncommited changes | ||
// Find ports with uncommitted changes | ||
std::set<std::string> changed_ports; | ||
auto git_config = paths.git_builtin_config(); | ||
auto maybe_changes = git_ports_with_uncommitted_changes(git_config); | ||
|
@@ -405,15 +405,8 @@ namespace vcpkg | |
{ | ||
auto port_dir = paths.builtin_ports_directory() / port_name; | ||
|
||
if (!fs.exists(port_dir, IgnoreErrors{})) | ||
{ | ||
msg::println_error(msgPortDoesNotExist, msg::package_name = port_name); | ||
Checks::check_exit(VCPKG_LINE_INFO, !add_all); | ||
continue; | ||
} | ||
|
||
auto maybe_scf = | ||
Paragraphs::try_load_port_required(fs, port_name, paths.builtin_ports_directory() / port_name); | ||
auto maybe_scf = Paragraphs::try_load_port_required( | ||
fs, port_name, PortLocation{paths.builtin_ports_directory() / port_name}); | ||
auto scf = maybe_scf.get(); | ||
if (!scf) | ||
{ | ||
|
@@ -426,15 +419,15 @@ namespace vcpkg | |
if (!skip_formatting_check) | ||
{ | ||
// check if manifest file is property formatted | ||
const auto path_to_manifest = paths.builtin_ports_directory() / port_name / "vcpkg.json"; | ||
if (fs.exists(path_to_manifest, IgnoreErrors{})) | ||
|
||
if (scf->control_path.filename() == "vcpkg.json") | ||
{ | ||
const auto current_file_content = fs.read_contents(path_to_manifest, VCPKG_LINE_INFO); | ||
const auto json = serialize_manifest(**scf); | ||
const auto current_file_content = fs.read_contents(scf->control_path, VCPKG_LINE_INFO); | ||
const auto json = serialize_manifest(*scf->source_control_file); | ||
const auto formatted_content = Json::stringify(json); | ||
if (current_file_content != formatted_content) | ||
{ | ||
auto command_line = fmt::format("vcpkg format-manifest ports/{}/vcpkg.json", port_name); | ||
auto command_line = fmt::format("vcpkg format-manifest {}", scf->control_path); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be shell escaped? For example, if the user has a space in their path. |
||
msg::println_error( | ||
msg::format(msgAddVersionPortHasImproperFormat, msg::package_name = port_name) | ||
.append_raw('\n') | ||
|
@@ -454,8 +447,7 @@ namespace vcpkg | |
msg::println_warning(msgAddVersionUncommittedChanges, msg::package_name = port_name); | ||
} | ||
|
||
const auto& schemed_version = (*scf)->to_schemed_version(); | ||
|
||
auto schemed_version = scf->source_control_file->to_schemed_version(); | ||
auto git_tree_it = git_tree_map.find(port_name); | ||
if (git_tree_it == git_tree_map.end()) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -760,7 +760,7 @@ namespace vcpkg | |
|
||
std::vector<CMakeVariable> variables{ | ||
{"ALL_FEATURES", all_features}, | ||
{"CURRENT_PORT_DIR", scfl.source_location}, | ||
{"CURRENT_PORT_DIR", scfl.port_directory()}, | ||
{"_HOST_TRIPLET", action.host_triplet.canonical_name()}, | ||
{"FEATURES", Strings::join(";", action.feature_list)}, | ||
{"PORT", scf.core_paragraph->name}, | ||
|
@@ -951,9 +951,9 @@ namespace vcpkg | |
msg::println(msgLoadingOverlayTriplet, msg::path = triplet_file_path); | ||
} | ||
|
||
if (!Strings::starts_with(scfl.source_location, paths.builtin_ports_directory())) | ||
if (!Strings::starts_with(scfl.control_path, paths.builtin_ports_directory())) | ||
{ | ||
msg::println(msgInstallingFromLocation, msg::path = scfl.source_location); | ||
msg::println(msgInstallingFromLocation, msg::path = scfl.control_path); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did intend this change but I guess technically it's also referring to patches and stuff in there. |
||
} | ||
|
||
const ElapsedTimer timer; | ||
|
@@ -1030,7 +1030,7 @@ namespace vcpkg | |
FileSink file_sink{fs, stdoutlog, Append::YES}; | ||
CombiningSink combo_sink{stdout_sink, file_sink}; | ||
error_count = perform_post_build_lint_checks( | ||
action.spec, paths, pre_build_info, build_info, scfl.source_location, combo_sink); | ||
action.spec, paths, pre_build_info, build_info, scfl.port_directory(), combo_sink); | ||
}; | ||
if (error_count != 0 && action.build_options.backcompat_features == BackcompatFeatures::PROHIBIT) | ||
{ | ||
|
@@ -1174,7 +1174,8 @@ namespace vcpkg | |
constexpr int max_port_file_count = 100; | ||
|
||
std::string portfile_cmake_contents; | ||
auto&& port_dir = action.source_control_file_and_location.value_or_exit(VCPKG_LINE_INFO).source_location; | ||
auto&& scfl = action.source_control_file_and_location.value_or_exit(VCPKG_LINE_INFO); | ||
auto port_dir = scfl.port_directory(); | ||
auto raw_files = fs.get_regular_files_recursive_lexically_proximate(port_dir, VCPKG_LINE_INFO); | ||
if (raw_files.size() > max_port_file_count) | ||
{ | ||
|
@@ -1273,8 +1274,7 @@ namespace vcpkg | |
abi_file_path /= triplet_canonical_name + ".vcpkg_abi_info.txt"; | ||
fs.write_contents(abi_file_path, full_abi_info, VCPKG_LINE_INFO); | ||
|
||
auto& scf = action.source_control_file_and_location.value_or_exit(VCPKG_LINE_INFO).source_control_file; | ||
|
||
auto& scf = scfl.source_control_file; | ||
abi_info.package_abi = Hash::get_string_sha256(full_abi_info); | ||
abi_info.abi_tag_file.emplace(std::move(abi_file_path)); | ||
abi_info.relative_port_files = std::move(files); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -445,9 +445,9 @@ namespace vcpkg | |
if (auto scfl = action.source_control_file_and_location.get()) | ||
{ | ||
if (!builtin_ports_dir.empty() && | ||
!Strings::case_insensitive_ascii_starts_with(scfl->source_location, builtin_ports_dir)) | ||
!Strings::case_insensitive_ascii_starts_with(scfl->control_path, builtin_ports_dir)) | ||
{ | ||
out.append_raw(" -- ").append_raw(scfl->source_location); | ||
out.append_raw(" -- ").append_raw(scfl->control_path); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be |
||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scf
==SourceControlFile