-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
RFC: [vcpkg-downloads] Helper script to parse download.json #38656
base: master
Are you sure you want to change the base?
Conversation
ports/vcpkg-downloads/download.json
Outdated
{ | ||
"output_variable" : "extracted_src_github", | ||
"from": "github", | ||
"repository" : "facebook/zstd", | ||
"ref": "v1.5.6", | ||
"sha512" : "ca12dffd86618ca008e1ecc79056c1129cb4e61668bf13a3cd5b2fa5c93bc9c92c80f64c1870c68b9c20009d9b3a834eac70db72242d5106125a1c53cccf8de8", | ||
"head_ref": "dev", | ||
"patches" : [], | ||
"target_dir" : "${other_src_dir}/zstd" | ||
}, |
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.
Could also be:
{ | |
"output_variable" : "extracted_src_github", | |
"from": "github", | |
"repository" : "facebook/zstd", | |
"ref": "v1.5.6", | |
"sha512" : "ca12dffd86618ca008e1ecc79056c1129cb4e61668bf13a3cd5b2fa5c93bc9c92c80f64c1870c68b9c20009d9b3a834eac70db72242d5106125a1c53cccf8de8", | |
"head_ref": "dev", | |
"patches" : [], | |
"target_dir" : "${other_src_dir}/zstd" | |
}, | |
"extracted_src_github" : { | |
"from": "github", | |
"repository" : "facebook/zstd", | |
"ref": "v1.5.6", | |
"sha512" : "ca12dffd86618ca008e1ecc79056c1129cb4e61668bf13a3cd5b2fa5c93bc9c92c80f64c1870c68b9c20009d9b3a834eac70db72242d5106125a1c53cccf8de8", | |
"head_ref": "dev", | |
"patches" : [], | |
"target_dir" : "${other_src_dir}/zstd" | |
}, |
Basically dropping the output_variable
field
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.
I'd prefer "github": "output-variable": "...", ...}
because otherwise the set of allowed fields would depend on the value of from
which is way harder to parse compared to this.
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.
Don't quite understand this comment: I still need from
here and the fields always depend on where it comes from. (doesn't matter if that is depending on from
or some other mechanism )
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.
You suggested here to make the output variable the key of the object instead of having an array of keyless objects. I propose to make the value of from
the key:
"github" : {
"output-variable": "extracted_src_github",
"repository" : "facebook/zstd",
"ref": "v1.5.6",
"sha512" : "ca12dffd86618ca008e1ecc79056c1129cb4e61668bf13a3cd5b2fa5c93bc9c92c80f64c1870c68b9c20009d9b3a834eac70db72242d5106125a1c53cccf8de8",
"head_ref": "dev",
"patches" : [],
"target_dir" : "${other_src_dir}/zstd"
}
This way you can decide more easily the download method.
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.
I think the main benefit for that is schema validation, however you might end up with something like:
[
"github" : { .... },
"github" : { .... },
"github" : { .... },
"github" : { .... },
"gitlab" : { .... },
"git" : { .... },
]
Leading to something.0.github.--- something.1.github.--- something.2.github.---
. The is no meaning in that selection if there is duplicates.
While:
[
"src1" : { .... },
"src2" : { .... },
"src3" : { .... },
"src4" : { .... },
]
Actually has meaning since srcX
has to be an unique identifier since otherwise outputs get overwritten. I also see the json keys as a right to left assignment in this case (data on the right creates the key on the left).
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.
Leading to
something.0.github.--- something.1.github.--- something.2.github.---
. The is no meaning in that selection if there is duplicates.
Why is this a problem? To my understanding, JSON arrays are allowed to have multiple elements (objects) with the same key, e.g. "{"key": "value", "key": "value"}
is not allowed whereas ["key": {"subkey": "value"}, "key": {"subkey": "value"}]
is allowed.
data on the right creates the key on the left
The output variable itself is data. According to this, it should be on the right whereas github
or gitlab
are less data-ish. I think JSON should go from general to specific. The output variable is a lot more specific than github
or gitlab
.
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.
["key": {"subkey": "value"}, "key": {"subkey": "value"}]
This is no valid JSON...
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.
would need to be [ { "key": {"subkey": "value"} }, { "key": {"subkey": "value"} } ]
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.
I prefer the output_variable
as key variant, because you prevent collisions by design with that.
Sometimes there are per-platform and per-feature downloads, so |
I think the goal of this PR is to fix SBOM generation as suggested by @ras0219-msft here. Because that would require parsing That being said, I'd rather want to see |
I can add an |
No the goal is to make updating ports easier. Updating a JSON is simply than trying to find the correct lines in a cmake file.
It is already implemented in cmake that is the point ;). Feel free to port the implementation to the tool. I rather start getting implementation experience in CMake than to bake it directly into the tool on the first try.
That is incorrect. Why? Because
That only works in a sequentiell manner doesn't it? |
This PR would break the current SBOM file generation logic in the tool. Therefore, you have to parse
What exactly do you mean by sequential? Everything in cmake is sequential. |
If this PR breaks that generation logic than that generation logic is more than incomplete. What exactly is broken here?
Yes in cmake everything is sequential, however having a Currently visible in portfile [stuff in
This PR:
So this PR ideally batches all downloads to a single function call (although portfiles are still able to break that batching up). Having everything batched up allows a later tool implementation to gather all needed information beforehand and perform the download and extraction step in parallel instead of having to wait for CMake to reach the next download part. So that the workflow is then: Again the main aim here is to improve automatic updates of ports. |
Rename target-dir to copy-to
It parses cmake for |
Ok so broken by design. I think autoantwort already had a better approach in a different PR. You run cmake in trace mode and analyze the trace afterwards.... not trying to apply a heuristic before. Anything else is broken by design. |
Or you make the functions write a machine-readable log. |
If this gets integrated in the tool at some point, is there a preference in integrating that in the vcpkg.json file? |
I would be against it since it would make the manifest even more overloaded.
The alternative would be to add So the last remaining CMake entries would be |
No description provided.