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

submodule detection for proper fix on #96188 #109848

Merged
merged 1 commit into from Apr 5, 2023

Conversation

onur-ozkan
Copy link
Member

This commit resolves an internal FIXME note within the bootstrap by implementing submodule detection. This is accomplished through an iterative process over the .gitmodules file.

r? @albertlarsan68

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Apr 2, 2023
@albertlarsan68
Copy link
Member

I feel like the approach to get submodules is good, but I don't think the code does the wanted thing. I haven't tested my theory, but I feel like you should cache the submodules list. This avoids a problem (I think) where the first path goes until the end of the file, and the second path does nothing, because the cursor is already at the end, and is not rewound. The other option would be to rewind the file, but it would be less efficient.

@onur-ozkan
Copy link
Member Author

I feel like the approach to get submodules is good, but I don't think the code does the wanted thing. I haven't tested my theory, but I feel like you should cache the submodules list. This avoids a problem (I think) where the first path goes until the end of the file, and the second path does nothing, because the cursor is already at the end, and is not rewound. The other option would be to rewind the file, but it would be less efficient.

File is 34 lines long :D And I don't think it will ever reach more than ~70. Doing proper caching will require keeping those values in the parent configuration within HashMap for O(1) access. Wouldn't that be overkill for this particular purpose? I would prefer forgetting the values once we finish the process here rather than keeping it in memory permamently.

@onur-ozkan
Copy link
Member Author

Doing proper caching will require keeping those values in the parent configuration within HashMap for O(1) access.

Just remember now, and even with HashMap O(1) will not be possible because we don't have the complete values https://github.com/rust-lang/rust/blob/0c95fc504e881c796bd1a042b72b1d4c445c47a5/src/bootstrap/builder.rs#L501

so we will need to iterate the values no mather what

@albertlarsan68
Copy link
Member

albertlarsan68 commented Apr 4, 2023

A HashMap is definitely overkill, I was thinking about keeping the Vec that you build.

@onur-ozkan
Copy link
Member Author

A HashMap is definitely overkill, I was thinking about keeping the Vec that you build.

We can do that by adding it to Config, or require extra arg for paths function as Vec for submodules(which will require every caller calculating submodules first).

@onur-ozkan onur-ozkan force-pushed the fix-96188 branch 2 times, most recently from 31fab18 to 0f4ca79 Compare April 4, 2023 19:11
@onur-ozkan
Copy link
Member Author

Now it should be much better @albertlarsan68

@albertlarsan68
Copy link
Member

There is already once_cell in bootstrap, can you use it and add a FIXME to use std when stabilized?
Otherwise good.

@albertlarsan68 albertlarsan68 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 5, 2023
@onur-ozkan
Copy link
Member Author

onur-ozkan commented Apr 5, 2023

add a FIXME to use std when stabilized?

This isn't needed, I updated the existing FIXME which aims the same purpose.

@onur-ozkan onur-ozkan force-pushed the fix-96188 branch 3 times, most recently from 1b73ce3 to 77dcd01 Compare April 5, 2023 10:09
Copy link
Member

@albertlarsan68 albertlarsan68 left a comment

Choose a reason for hiding this comment

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

r=me with the unwrapchanged to expect

This commit resolves an internal FIXME note within the bootstrap by implementing submodule detection.
This is accomplished through an iterative process over the `.gitmodules` file.

Signed-off-by: ozkanonur <work@onurozkan.dev>
@onur-ozkan
Copy link
Member Author

@bors r=albertlarsan68 rollup

@bors
Copy link
Contributor

bors commented Apr 5, 2023

📌 Commit 5a4066e has been approved by albertlarsan68

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 5, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 5, 2023
Rollup of 6 pull requests

Successful merges:

 - rust-lang#107236 (Add T-bootstrap label to tools)
 - rust-lang#109847 (Only create graphviz nodes for reachable MIR bb's)
 - rust-lang#109848 (submodule detection for proper fix on rust-lang#96188)
 - rust-lang#109932 (Source code scrollbar)
 - rust-lang#109952 (Move comment about python2 closer to the place it's used)
 - rust-lang#109956 (Tweak debug outputs to make debugging new solver easier)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 30ffbc4 into rust-lang:master Apr 5, 2023
11 checks passed
@rustbot rustbot added this to the 1.70.0 milestone Apr 5, 2023
@onur-ozkan onur-ozkan deleted the fix-96188 branch April 7, 2023 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants