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

Upgrade downstreamPlaceholder to a type with methods #8353

Merged
merged 2 commits into from
May 18, 2023

Conversation

Ericson2314
Copy link
Member

Motivation

This gets us ready for dynamic derivation dependencies (part of RFC 92).

Context

Tracking issue for RFC 92 #6316

Checklist for maintainers

Maintainers: tick if completed or explain if not relevant

  • agreed on idea
  • agreed on implementation strategy
  • tests, as appropriate
    • functional tests - tests/**.sh
    • unit tests - src/*/tests
    • integration tests - tests/nixos/*
  • documentation in the manual
  • documentation in the internal API docs
  • code and comments are self-explanatory
  • commit message explains why the change was made
  • new feature or incompatible change: updated release notes

Priorities

Add 👍 to pull requests you find important.

@Ericson2314 Ericson2314 added the RFC Related to an accepted RFC label May 16, 2023
@github-actions github-actions bot added the new-cli Relating to the "nix" command label May 16, 2023
src/libstore/downstream-placeholder.cc Outdated Show resolved Hide resolved
src/libstore/downstream-placeholder.cc Outdated Show resolved Hide resolved
src/libstore/downstream-placeholder.hh Outdated Show resolved Hide resolved
src/libstore/downstream-placeholder.hh Outdated Show resolved Hide resolved
@Ericson2314 Ericson2314 force-pushed the downstream-installable-type branch from b279a0f to d0d7b49 Compare May 17, 2023 14:55
@Ericson2314
Copy link
Member Author

OK think I addressed everything.

Copy link
Member

@roberth roberth left a comment

Choose a reason for hiding this comment

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

C++ lgtm. My suggestions to use both file static and class static were incoherent, but you resolved that well.

I assume we will later have a use for this type, and not just the construct + render combination?

Also just to be sure, what's the stability status of these hashes? I would hope they are meant to be stable but a change (if we were to accidentally make one) would rarely be observed by users? Or am I way off? Wouldn't nix eval print them? Is this documented somewhere? Do we have a test that checks the placeholder against a hardcoded example to make sure it doesn't change by accident?

@Ericson2314
Copy link
Member Author

I assume we will later have a use for this type, and not just the construct + render combination?

Yes, once inputDrvs becomes fancier to include inductive stuff.

Also just to be sure, what's the stability status of these hashes?

Yes they will end up in derivations (in memory and drv files, so they shouldn't change). If they do change, trying to build old ca or dynamic-derivation-depending derivations could fail because they no longer get substituted.

We could write some tests, certainly. Don't think there are interesting properties to test, but we could just put in a fixed case of each.

(Similarly we should pin down the hash-modulo stuff at some point too.)

This is good in general, but in particular ensures when we heavily
refactor it in the next commit there is less likelihood for an
unintentional change in behavior to sneak in.
This gets us ready for dynamic derivation dependencies (part of RFC 92).
@Ericson2314 Ericson2314 force-pushed the downstream-installable-type branch from d0d7b49 to b9e5ce4 Compare May 17, 2023 21:41
@github-actions github-actions bot added the with-tests Issues related to testing. PRs with tests have some priority label May 17, 2023
@Ericson2314
Copy link
Member Author

I added some tests. The first I added test prior to the refactor so we can see that behavior is preserved.

@roberth roberth merged commit c27fb72 into NixOS:master May 18, 2023
@Ericson2314 Ericson2314 deleted the downstream-installable-type branch May 18, 2023 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-cli Relating to the "nix" command RFC Related to an accepted RFC with-tests Issues related to testing. PRs with tests have some priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants