Skip to content
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

[spdx] Replace CMake variables in vcpkg_download_distfile() #1607

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Thomas1664
Copy link
Contributor

@Thomas1664 Thomas1664 commented Mar 8, 2025

@Thomas1664
Copy link
Contributor Author

Thomas1664 commented Mar 8, 2025

@BillyONeal I'm not sure how to handle the path issue:

From microsoft/vcpkg#44188 (comment):

Also, Paths are also invalid:

"fileName": ".//home/igor/development/vcpkg/vcpkg_original/ports/bzip2/bzip2.pc.in",

The code expects relative paths:

const auto& path = relative_paths[i];
const auto& hash = hashes[i];
auto& obj = files.push_back(Json::Object());
obj.insert(SpdxFileName, "./" + path.generic_u8string());
const auto ref = fmt::format("SPDXRef-file-{}", i);

but we feed in absolute paths by including the port directory:

const auto& abs_port_file = files.emplace_back(port_dir / port_file);

abi_info.relative_port_files = std::move(files);

fs.write_contents_and_dirs(
json_path,
create_spdx_sbom(
action, abi.relative_port_files, abi.relative_port_hashes, now, doc_ns, std::move(heuristic_resources)),
VCPKG_LINE_INFO);

However, I think we should be using absolute paths because we might lose the information of where a file comes from in case of overlay ports.

On the other hand, absolute paths are invalid after downloading from a binary cache on different machines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant