Skip to content

Commit 8a2022b

Browse files
committed
Add more context to quit_if_file_exists in configure.py
Currently, having a dirty `obj/` directory is sufficient to abort CI tests. This results in errors like the following: ``` ... == end clock drift check == sccache: Starting the server... configure: error: Existing 'config.toml' detected. == clock drift check == ... ``` This is subtle and doesn't give a good idea as to what causes the issue. With this patch, the error becomes more prominent and a resolution is suggested: ``` == 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 == ```
1 parent 7a5d2d0 commit 8a2022b

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

Diff for: 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

Diff for: 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
```

Diff for: 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 \

Diff for: 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)