Skip to content

Commit c39c48f

Browse files
authored
Merge pull request dotnet#23 from sdmaclea/PR-CLEANUP-AND-BINFMT
Cleanup ubuntu/16
2 parents d809634 + a3ae44b commit c39c48f

File tree

6 files changed

+60
-23
lines changed

6 files changed

+60
-23
lines changed

src/ubuntu/14.04/cross/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
FROM microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-crossdeps
22

3-
ADD rootfs crossrootfs
3+
ADD rootfs.tar crossrootfs

src/ubuntu/16.04/Dockerfile

+2-4
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@ RUN apt-get update && \
1111
apt-get update && \
1212
apt-get install -y \
1313
cmake \
14-
clang-3.5 \
1514
clang-3.9 \
16-
liblldb-3.9-dev && \
15+
liblldb-3.9-dev \
1716
lldb-3.9 \
18-
llvm-3.5 \
1917
llvm-3.9 \
20-
make \
18+
make && \
2119
apt-get clean
2220

2321
# Install tools used by the VSO build automation. nodejs-legacy is a Debian specific

src/ubuntu/16.04/cross/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
FROM microsoft/dotnet-buildtools-prereqs:ubuntu-16.04-crossdeps
22

3-
ADD rootfs crossrootfs
3+
ADD rootfs.tar crossrootfs

src/ubuntu/16.04/cross/arm64/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ RUN apt-get update \
66
binutils-aarch64-linux-gnu \
77
&& rm -rf /var/lib/apt/lists/*
88

9-
ADD rootfs crossrootfs
9+
ADD rootfs.tar crossrootfs

src/ubuntu/16.04/crossdeps/Dockerfile

+1-6
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,15 @@ FROM microsoft/dotnet-buildtools-prereqs:ubuntu-16.04-coredeps
22

33
# Install the base toolchain we need to build anything (clang, cmake, make and the like).
44
RUN apt-get update \
5-
&& apt-get install -y wget \
6-
&& echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.6 main" | tee /etc/apt/sources.list.d/llvm.list \
7-
&& wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add - \
8-
&& apt-get update \
95
&& apt-get install -y \
106
binfmt-support \
117
binutils-arm-linux-gnueabihf \
12-
clang-3.6 \
138
cmake \
149
debootstrap \
15-
llvm-3.6 \
1610
make \
1711
qemu \
1812
qemu-user-static \
13+
wget \
1914
&& rm -rf /var/lib/apt/lists/*
2015

2116
RUN apt-get update \

src/ubuntu/build-scripts/build-rootfs.sh

+54-10
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,66 @@ crossToolset=$2
1010
archArg=${3:-}
1111
lldb=${4:-}
1212

13-
scriptsVolume="scripts$(date +%s)"
1413
dockerCrossDepsTag="microsoft/dotnet-buildtools-prereqs:${os}-crossdeps"
1514

16-
echo "Using $dockerCrossDepsTag to clone core-setup to fetch scripts used to build cross-toolset"
17-
docker run --rm -v $scriptsVolume:/scripts $dockerCrossDepsTag git clone https://github.com/dotnet/core-setup /scripts
18-
19-
rm -rf $PWD/rootfs
20-
mkdir rootfs
15+
rm -rf $PWD/rootfs.tar
2116

2217
# If argument three was set, use that as the only arch, otherwise use default list of arches : 'arm x86'
2318
crossArchArray=(${archArg:-'arm x86'})
2419
for arch in $crossArchArray
2520
do
2621
echo "Using $dockerCrossDepsTag to set up cross-toolset for $arch for $crossToolset"
27-
buildRootFSContainer="rootfs-$arch-$crossToolset"
28-
docker run --privileged --rm --name $buildRootFSContainer -e ROOTFS_DIR=/rootfs/$arch \
29-
-v $PWD/rootfs:/rootfs -v $scriptsVolume:/scripts \
30-
$dockerCrossDepsTag /scripts/cross/build-rootfs.sh $arch $crossToolset $lldb --skipunmount
22+
buildRootFSContainer="rootfs-$arch-$crossToolset-$(date +%s)"
23+
24+
# Start a detached container running bash
25+
docker run --privileged -itd --name $buildRootFSContainer $dockerCrossDepsTag \
26+
bash
27+
28+
if [ $? -ne 0 ]; then
29+
echo "Rootfs build failed: detached container failed to start"
30+
exit 1
31+
fi
32+
33+
echo "Using $dockerCrossDepsTag to clone core-setup to fetch scripts used to build cross-toolset"
34+
docker exec $buildRootFSContainer \
35+
git clone https://github.com/dotnet/core-setup /scripts
36+
37+
if [ $? -ne 0 ]; then
38+
echo "Rootfs build failed: `git clone https://github.com/dotnet/core-setup /scripts` returned error"
39+
docker rm -f $buildRootFSContainer
40+
exit 1
41+
fi
42+
43+
echo "Running build-rootfs.sh"
44+
docker exec -e ROOTFS_DIR=/rootfs/$arch $buildRootFSContainer \
45+
/scripts/cross/build-rootfs.sh $arch $crossToolset $lldb --skipunmount
46+
47+
if [ $? -ne 0 ]; then
48+
echo "Rootfs build failed: build-rootfs.sh returned error"
49+
docker rm -f $buildRootFSContainer
50+
exit 1
51+
fi
52+
53+
echo "Checking existence of /rootfs/$arch/bin"
54+
docker exec $buildRootFSContainer \
55+
[ -d /rootfs/$arch/bin ]
56+
57+
if [ $? -ne 0 ]; then
58+
echo "Rootfs build failed: rootfs/$arch/bin empty"
59+
docker rm -f $buildRootFSContainer
60+
exit 1
61+
fi
62+
63+
echo "Tarring rootfs"
64+
docker exec $buildRootFSContainer \
65+
tar Ccf /rootfs - . >> $PWD/rootfs.tar
66+
67+
if [ $? -ne 0 ]; then
68+
echo "Rootfs build failed: 'tar Ccf /rootfs - .' returned error"
69+
docker rm -f $buildRootFSContainer
70+
exit 1
71+
fi
72+
73+
echo "Shutting down container"
74+
docker rm -f $buildRootFSContainer
3175
done

0 commit comments

Comments
 (0)