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

ValidPathInfo: make ca field a proper datatype #3649

Merged

Conversation

meditans
Copy link
Member

@meditans meditans commented Jun 2, 2020

No description provided.

Ericson2314 and others added 7 commits March 24, 2020 20:39
I think it makes more sense to define the data model (derivations),
before the operations (store api).
…son2314/nix into validPathInfo-ca-proper-datatype
…314/nix into validPathInfo-ca-proper-datatype
@Ericson2314
Copy link
Member

Ericson2314 commented Jun 2, 2020

Oh, I thought I could edit this because it is from a repo I have access too, but I guess that is not the case. This contains a number of other PRs:

And the culmination of our work to tighten up the API replacing strings with proper data type. We're doing this to help root out bugs with the git objects work, but we hope it can be merged separately as #3455 as it cleans up the code regardless of whether git objects ever makes it in.

@Ericson2314
Copy link
Member

This is still WIP because we need to actually write the ca field parser, but the more important thing is the C++ datatypes so I figured it was worth getting the WIP PR up.

src/nix/verify.cc Outdated Show resolved Hide resolved
std::string hashAlgo; /* hash used for expected hash computation */
std::string hash; /* expected hash, may be null */
DerivationOutput(StorePath && path, std::string && hashAlgo, std::string && hash)
std::optional<FileSystemHash> hash; /* hash used for expected hash computation */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this make sense here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is, a derivation might not have any file ingestion at all. If it's not fixed output, I think it will only have file ingestion through its inputs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend just using the Hash type here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very confusingly, the hashAlgo string also contained the r:. See #3439, where this comes from.


/// Pair of a hash, and how the file system was ingested
struct FileSystemHash {
FileIngestionMethod method;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this might need to be optional

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainly because of the above comment. Not all uses of FileSystemHash will have a real "FileIngestionMethod" defined. Consider derivations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, we should rename the data type then. This is strictly for content-addressed things.

src/libstore/build.cc Outdated Show resolved Hide resolved
@meditans meditans force-pushed the validPathInfo-ca-proper-datatype branch from 3ff7f7d to 343c20a Compare June 2, 2020 19:23
@meditans meditans changed the title WIP: ValidPathInfo: make ca field a proper datatype ValidPathInfo: make ca field a proper datatype Jun 4, 2020
@Ericson2314
Copy link
Member

Ericson2314 commented Jun 18, 2020

OK this now just contains #3439 and #3650. The PRs it doesn't contain were precisely the ones @edolstra found dodgy or unnecessary, so 🤞 this is now good.

It still makes sense to review #3439 and #3650, first however.

@Ericson2314 Ericson2314 force-pushed the validPathInfo-ca-proper-datatype branch from babb27c to 2f0e395 Compare June 19, 2020 15:27
};

/// Pair of a hash, and how the file system was ingested
struct FixedOutputHash {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with FixedOutputHash for this PR, now that it is not just used in derivations.

@meditans meditans changed the base branch from master to 0.5-release June 19, 2020 18:40
@meditans meditans changed the base branch from 0.5-release to master June 19, 2020 18:40
@edolstra edolstra merged commit 965b803 into NixOS:master Jun 22, 2020
@Ericson2314 Ericson2314 deleted the validPathInfo-ca-proper-datatype branch June 22, 2020 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants