Skip to content

Commit 2aae331

Browse files
committed
Auto merge of #112916 - tgross35:patch-1, r=Mark-Simulacrum
Add more context to `quit_if_file_exists` in `configure.py` & delete config.toml in CI If the `obj` directory isn't empty, the error message is subtle and not very helpful: ``` == clock drift check == local time: Sun Jul 2 00:57:06 UTC 2023 network time: Sun, 02 Jul 2023 00:57:06 GMT == end clock drift check == sccache: Starting the server... configure: error: Existing 'config.toml' detected. == clock drift check == local time: Sun Jul 2 00:57:06 UTC 2023 network time: Sun, 02 Jul 2023 00:57:06 GMT == end clock drift check == ``` This makes it stand out and suggests how to resolve the issue: ``` == clock drift check == local time: Sun Jul 2 02:11:30 UTC 2023 network time: Sun, 02 Jul 2023 02:11:31 GMT == end clock drift check == sccache: Starting the server... configure: ERROR: Existing 'config.toml' detected. Exiting Is objdir '/home/tmgross/projects/rust/obj' clean? == clock drift check == local time: Sun Jul 2 02:11:31 UTC 2023 network time: Sun, 02 Jul 2023 02:11:31 GMT == end clock drift check == ```
2 parents 72c6b8d + 8a2022b commit 2aae331

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

src/bootstrap/configure.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def p(msg):
180180

181181

182182
def err(msg):
183-
print("configure: error: " + msg)
183+
print("\nconfigure: ERROR: " + msg + "\n")
184184
sys.exit(1)
185185

186186
def is_value_list(key):
@@ -544,7 +544,14 @@ def write_config_toml(writer, section_order, targets, sections):
544544

545545
def quit_if_file_exists(file):
546546
if os.path.isfile(file):
547-
err("Existing '" + file + "' detected.")
547+
msg = "Existing '{}' detected. Exiting".format(file)
548+
549+
# If the output object directory isn't empty, we can get these errors
550+
host_objdir = os.environ.get("OBJDIR_ON_HOST")
551+
if host_objdir is not None:
552+
msg += "\nIs objdir '{}' clean?".format(host_objdir)
553+
554+
err(msg)
548555

549556
if __name__ == "__main__":
550557
# If 'config.toml' already exists, exit the script at this point

src/ci/docker/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ for example:
1414
./src/ci/docker/run.sh x86_64-gnu
1515
```
1616

17-
Images will output artifacts in an `obj` dir at the root of a repository.
17+
Images will output artifacts in an `obj` dir at the root of a repository. Note
18+
that the script will overwrite the contents of this directory.
1819

1920
To match conditions in rusts CI, also set the environment variable `DEPLOY=1`, e.g.:
2021
```

src/ci/docker/run.sh

+1
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ docker \
266266
--env BASE_COMMIT="$BASE_COMMIT" \
267267
--env DIST_TRY_BUILD \
268268
--env PR_CI_JOB \
269+
--env OBJDIR_ON_HOST="$objdir" \
269270
--init \
270271
--rm \
271272
rust-ci \

src/ci/run.sh

+3
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ trap datecheck EXIT
171171
# sccache server at the start of the build, but no need to worry if this fails.
172172
SCCACHE_IDLE_TIMEOUT=10800 sccache --start-server || true
173173

174+
# Our build may overwrite config.toml, so we remove it here
175+
rm -f config.toml
176+
174177
$SRC/configure $RUST_CONFIGURE_ARGS
175178

176179
retry make prepare

0 commit comments

Comments
 (0)