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

build-remote: Implement in C++ #981

Merged
merged 4 commits into from
Jan 19, 2017
Merged

Conversation

shlevy
Copy link
Member

@shlevy shlevy commented Jul 18, 2016

No description provided.

@shlevy
Copy link
Member Author

shlevy commented Jul 18, 2016

Ref #341

@shlevy shlevy mentioned this pull request Jul 18, 2016
12 tasks
@domenkozar
Copy link
Member

Shouldn't this also remove ./scripts/build-remote.pl.in?

@shlevy
Copy link
Member Author

shlevy commented Jul 19, 2016

That needs to be coordinated with a change in NixOS.

@domenkozar
Copy link
Member

domenkozar commented Jul 19, 2016

@shlevy cool, let's then keep a list of TODOs somewhere for NixOS so this is not forgotten.

@domenkozar
Copy link
Member

cc @edolstra

@@ -112,4 +112,14 @@ running, they should use the same <envar>NIX_CURRENT_LOAD</envar>
file. Maybe in the future <filename>build-remote.pl</filename> will
look at the actual remote load.</para>

<para>Additionally, you may define the environment variable
<envar>NIX_REMOTE_USE_SUBSTITUTES</envar>, which will instruct
Copy link
Member

Choose a reason for hiding this comment

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

Why an environment variable instead of a nix.conf option?

Copy link
Member Author

Choose a reason for hiding this comment

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

@k0001 ?

Copy link
Contributor

@k0001 k0001 Jul 21, 2016

Choose a reason for hiding this comment

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

I expected the options in nix.conf to be directly related to Nix, not to the build-remote hook. But I agree that a nix.conf option would be better, if that is acceptable.

@shlevy shlevy force-pushed the build-remote-c++ branch from b58da8b to d06ac7d Compare July 21, 2016 22:23
@shlevy
Copy link
Member Author

shlevy commented Jul 21, 2016

@edolstra switched to the nix conf option for hook substitutes

@shlevy shlevy force-pushed the build-remote-c++ branch from d06ac7d to bd5d153 Compare July 25, 2016 17:15
@shlevy
Copy link
Member Author

shlevy commented Jul 25, 2016

Rebased on top of #997 (sorry @k0001, had to lose #937 for now). Note that tests don't pass because the VM test framework doesn't add proper hashes to store paths inherited from the parent store.


auto localSystem = argv[1];
settings.maxSilentTime = strtoull(argv[2], NULL, 10);
settings.buildTimeout = strtoull(argv[3], NULL, 10);
Copy link
Member

Choose a reason for hiding this comment

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

Calls to strtoull are not checked for parse error.

Copy link
Member Author

Choose a reason for hiding this comment

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

It will return ULLONG_MAX, which is a fine default. Note that this is an internal (libexec) tool.

Copy link
Member

@rasendubi rasendubi Jul 29, 2016

Choose a reason for hiding this comment

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

This prints 0:

unsigned long long res = strtoull("blah", NULL, 10);
printf("%llu\n", res);

The function returns ULLONG_MAX in case of overflow.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in 5dd21d1

@shlevy
Copy link
Member Author

shlevy commented Nov 10, 2016

@edolstra rebased on master.

@shlevy
Copy link
Member Author

shlevy commented Nov 18, 2016

ping

@domenkozar
Copy link
Member

@shlevy can we fix the tests here?

@shlevy
Copy link
Member Author

shlevy commented Nov 21, 2016

@edolstra said he was working on a fix

@shlevy
Copy link
Member Author

shlevy commented Nov 29, 2016

ping

1 similar comment
@shlevy
Copy link
Member Author

shlevy commented Dec 10, 2016

ping

@shlevy shlevy requested a review from edolstra December 18, 2016 22:39
@shlevy
Copy link
Member Author

shlevy commented Dec 18, 2016

Ping

@shlevy
Copy link
Member Author

shlevy commented Dec 26, 2016

Merry Christmas! Ping.

@shlevy
Copy link
Member Author

shlevy commented Jan 6, 2017

@edolstra Can you give me a time by which I can expect a review, even if that's not in the near future?


class machine {
const std::vector<string> supportedFeatures;
const std::vector<string> mandatoryFeatures;
Copy link
Member

Choose a reason for hiding this comment

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

=> std::set ?

[&](const string & feature) {
return std::find(supportedFeatures.begin(),
supportedFeatures.end(),
feature) != supportedFeatures.end() ||
Copy link
Member

Choose a reason for hiding this comment

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

This can be changed to supportedFeatures.count(feature) is supportedFeatures is a set.

auto machines = std::vector<machine>{};
auto confFile = std::ifstream{conf};
if (confFile.good()) {
confFile.exceptions(std::ifstream::badbit);
Copy link
Member

Choose a reason for hiding this comment

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

C++ streams considered harmful, among other things due to the wacky error/exception handling. I would just do tokenizeString(readFile(conf), "\n").

@shlevy shlevy requested a review from edolstra January 10, 2017 15:37
@domenkozar
Copy link
Member

@edolstra what's the plan for this PR?

@edolstra edolstra merged commit 8af062f into NixOS:master Jan 19, 2017
@copumpkin
Copy link
Member

🍾

@copumpkin
Copy link
Member

Was this the last remnant of perl or is there other stuff left? I can't wait to see perl disappear from release.nix 😄

@domenkozar
Copy link
Member

#1023
#1027

And we're done :)

@edolstra
Copy link
Member

Thanks @shlevy !

@edolstra
Copy link
Member

It appears that futimens() does not exist on OS X, so the build is failing there: http://hydra.nixos.org/build/46804311/nixlog/2/tail-reload

@domenkozar
Copy link
Member

domenkozar commented Jan 24, 2017

@shlevy
Copy link
Member Author

shlevy commented Jan 24, 2017

Commit using futimes pushed.

@domenkozar
Copy link
Member

@edolstra now we need NixOS/nixpkgs#17697 to fix tests, does that mean we finally get #1134 ? 🙈

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.

6 participants