Skip to content

Omit unchanged options from config.toml in configure.py #108632

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

Merged
merged 1 commit into from
Mar 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ changelog-seen = 2
# General build configuration options
# =============================================================================
[build]

# The default stage to use for the `check` subcommand
#check-stage = 0

Expand Down
22 changes: 18 additions & 4 deletions src/bootstrap/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,22 @@ def configure_top_level_key(lines, top_level_key, value):
else:
configure_section(sections[section_key], section_config)

def write_uncommented(target, f):
block = []
is_comment = True

for line in target:
block.append(line)
if len(line) == 0:
if not is_comment:
for l in block:
f.write(l + "\n")
block = []
is_comment = True
continue
is_comment = is_comment and line.startswith('#')
return f

# Now that we've built up our `config.toml`, write it all out in the same
# order that we read it in.
p("")
Expand All @@ -494,11 +510,9 @@ def configure_top_level_key(lines, top_level_key, value):
for section in section_order:
if section == 'target':
for target in targets:
for line in targets[target]:
f.write(line + "\n")
f = write_uncommented(targets[target], f)
else:
for line in sections[section]:
f.write(line + "\n")
f = write_uncommented(sections[section], f)

with bootstrap.output('Makefile') as f:
contents = os.path.join(rust_dir, 'src', 'bootstrap', 'mk', 'Makefile.in')
Expand Down