Skip to content

Commit 33400fb

Browse files
committed
Modify the script to allow for running docker images on Windows 7.
1 parent 1b5aaf2 commit 33400fb

File tree

3 files changed

+60
-9
lines changed

3 files changed

+60
-9
lines changed

src/ci/docker/README.md

+46-4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,48 @@ Images will output artifacts in an `obj` dir at the root of a repository.
2222
- `scripts` contains files shared by docker images
2323
- `disabled` contains images that are not built on travis
2424

25+
## Docker Toolbox on Windows
26+
27+
For Windows before Windows 10, the docker images can be run on Windows via
28+
[Docker Toolbox]. There are several preparation needs to be made before running
29+
a Docker image.
30+
31+
1. Stop the virtual machine from the terminal with `docker-machine stop`
32+
33+
2. If your Rust source is placed outside of `C:\Users\**`, e.g. if you place the
34+
repository in the `E:\rust` folder, please add a shared folder from
35+
VirtualBox by:
36+
37+
1. Select the "default" virtual machine inside VirtualBox, then click
38+
"Settings"
39+
2. Go to "Shared Folders", click "Add shared foldrer" (the folder icon with
40+
a plus sign), fill in the following information, then click "OK":
41+
42+
* Folder path: `E:\rust`
43+
* Folder name: `e/rust`
44+
* Read-only: ☐ *unchecked*
45+
* Auto-mount: ☑ *checked*
46+
* Make Permanant: ☑ *checked*
47+
48+
3. VirtualBox might not support creating symbolic links inside a shared folder
49+
by default. You can enable it manually by running these from `cmd.exe`:
50+
51+
```bat
52+
cd "C:\Program Files\Oracle\VirtualBox"
53+
VBoxManage setextradata default VBoxInternal2/SharedFoldersEnableSymlinksCreate/e/rust 1
54+
:: ^~~~~~
55+
:: folder name
56+
```
57+
58+
4. Restart the virtual machine from terminal with `docker-machine start`.
59+
60+
To run the image,
61+
62+
1. Launch the "Docker Quickstart Terminal".
63+
2. Execute `./src/ci/docker/run.sh $image_name` as explained at the beginning.
64+
65+
[Docker Toolbox]: https://www.docker.com/products/docker-toolbox
66+
2567
## Cross toolchains
2668
2769
A number of these images take quite a long time to compile as they're building
@@ -137,7 +179,7 @@ For targets: `armv7-unknown-linux-gnueabihf`
137179
libraries like jemalloc. See the mk/cfg/arm(v7)-uknown-linux-gnueabi{,hf}.mk
138180
file in Rust's source code.
139181
140-
## `aarch64-linux-gnu.config`
182+
### `aarch64-linux-gnu.config`
141183
142184
For targets: `aarch64-unknown-linux-gnu`
143185
@@ -150,7 +192,7 @@ For targets: `aarch64-unknown-linux-gnu`
150192
- C compiler > gcc version = 5.2.0
151193
- C compiler > C++ = ENABLE -- to cross compile LLVM
152194
153-
## `powerpc-linux-gnu.config`
195+
### `powerpc-linux-gnu.config`
154196
155197
For targets: `powerpc-unknown-linux-gnu`
156198
@@ -165,7 +207,7 @@ For targets: `powerpc-unknown-linux-gnu`
165207
- C compiler > gcc version = 4.9.3
166208
- C compiler > C++ = ENABLE -- to cross compile LLVM
167209
168-
## `powerpc64-linux-gnu.config`
210+
### `powerpc64-linux-gnu.config`
169211
170212
For targets: `powerpc64-unknown-linux-gnu`
171213
@@ -184,7 +226,7 @@ For targets: `powerpc64-unknown-linux-gnu`
184226
185227
(+) These CPU options match the configuration of the toolchains in RHEL6.
186228
187-
## `s390x-linux-gnu.config`
229+
### `s390x-linux-gnu.config`
188230
189231
For targets: `s390x-unknown-linux-gnu`
190232

src/ci/docker/run.sh

+11-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
set -e
1313

14+
export MSYS_NO_PATHCONV=1
15+
1416
script=`cd $(dirname $0) && pwd`/`basename $0`
1517
image=$1
1618

@@ -25,12 +27,19 @@ travis_fold start build_docker
2527
travis_time_start
2628

2729
if [ -f "$docker_dir/$image/Dockerfile" ]; then
30+
dockerfile="$docker_dir/$image/Dockerfile"
31+
if [ -x /usr/bin/cygpath ]; then
32+
context="`cygpath -w $docker_dir`"
33+
dockerfile="`cygpath -w $dockerfile`"
34+
else
35+
context="$docker_dir"
36+
fi
2837
retry docker \
2938
build \
3039
--rm \
3140
-t rust-ci \
32-
-f "$docker_dir/$image/Dockerfile" \
33-
"$docker_dir"
41+
-f "$dockerfile" \
42+
"$context"
3443
elif [ -f "$docker_dir/disabled/$image/Dockerfile" ]; then
3544
if [ -n "$TRAVIS_OS_NAME" ]; then
3645
echo Cannot run disabled images on travis!

src/tools/tidy/src/bins.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ pub fn check(path: &Path, bad: &mut bool) {
3131
if let Ok(mut file) = fs::File::open("/proc/version") {
3232
let mut contents = String::new();
3333
file.read_to_string(&mut contents).unwrap();
34-
// Probably on Windows Linux Subsystem, all files will be marked as
35-
// executable, so skip checking.
36-
if contents.contains("Microsoft") {
34+
// Probably on Windows Linux Subsystem or Docker via VirtualBox,
35+
// all files will be marked as executable, so skip checking.
36+
if contents.contains("Microsoft") || contents.contains("boot2docker") {
3737
return;
3838
}
3939
}

0 commit comments

Comments
 (0)