Commit 7fd1fa5a authored by Drew's avatar Drew

Convert to a more of a dockerfile-based workflow

No longer build inside one giant script
parent 0c6ef153
......@@ -6,46 +6,45 @@ ENV SWIFT_TAG="__TAG__" RUNTIME_PACKAGES="clang libedit2 libpython2.7 libxml2 li
#apply patches here
# ADD SR-437.patch /
RUN \
# Create a directory to work in \
mkdir swift-dev && \
cd swift-dev && \
# Install the runtime and build-time dependencies \
apt-get update && \
apt-get install $RUNTIME_PACKAGES $BUILDTIME_PACKAGES -y --no-install-recommends && \
\
git clone https://github.com/apple/swift.git && \
cd swift && \
# submodules? Where we're going, we don't need submodules! \
./utils/update-checkout --clone && \
\
# The silly update-checkout script does not understand matching the swift checkout ref \
# In practice what you're supposed to do (I think! It's not documented!) is check out the same snapshot tag \
# Not all the folders have them (where do some of them come from??) but we'll just try them all \
find ../ -maxdepth 1 -type d -exec bash -c '(cd {} && echo checking out in `pwd` && git checkout $SWIFT_TAG)' \; && \
\
# Apply patches here \
# cd ../swift-corelibs-foundation && \
# git apply < /SR-437.patch && \
# cat Foundation/NSPathUtilities.swift && \
# \
cd ../swift && \
\
# And now we build, like a good little linuxen. \
# I believe this is what the linux build script does. In practice, this builds a system into /tmp/install and then tars it up. \
./utils/build-script --preset=buildbot_linux install_destdir="/tmp/install" installable_package="/tmp/swift.tar.gz" && \
\
# Install our tarball to /usr/local \
tar xf /tmp/swift.tar.gz -C /usr/local --strip-components 1 && \
\
# Clean up \
cd / && \
rm -rf /tmp/swift.tar.gz /swift-dev && \
apt-get remove --purge -y $BUILDTIME_PACKAGES && \
apt-get autoremove --purge -y && \
apt-get clean -y && \
apt-get autoclean -y && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Create a directory to work in
RUN mkdir swift-dev
WORKDIR /swift-dev
# Install the runtime and build-time dependencies
RUN apt-get update
RUN apt-get install $RUNTIME_PACKAGES $BUILDTIME_PACKAGES -y --no-install-recommends
RUN git clone https://github.com/apple/swift.git
WORKDIR /swift-dev/swift
# submodules? Where we're going, we don't need submodules!
RUN ./utils/update-checkout --clone
# The silly update-checkout script does not understand matching the swift checkout ref
# In practice what you're supposed to do (I think! It's not documented!) is check out the same snapshot tag
# Not all the folders have them (where do some of them come from??) but we'll just try them all
# see http://stackoverflow.com/a/8213585/116834
ADD update-tags.sh /swift-dev/update-tags.sh
RUN bash /swift-dev/update-tags.sh
# Apply patches here
# cd ../swift-corelibs-foundation
# git apply < /SR-437.patch
# cat Foundation/NSPathUtilities.swift
# And now we build, like a good little linuxen.
# I believe this is what the linux build script does. In practice, this builds a system into /tmp/install and then tars it up.
RUN ./utils/build-script --preset=buildbot_linux install_destdir="/tmp/install" installable_package="/tmp/swift.tar.gz"
# Install our tarball to /usr/local
RUN tar xf /tmp/swift.tar.gz -C /usr/local --strip-components 1
# Clean up
WORKDIR /
RUN rm -rf /tmp/swift.tar.gz /swift-dev
RUN apt-get remove --purge -y $BUILDTIME_PACKAGES
RUN apt-get autoremove --purge -y
RUN apt-get clean -y
RUN apt-get autoclean -y
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENTRYPOINT ["bash"]
......@@ -2,9 +2,17 @@ set -e
username="drewcrawford"
echo "Type tag name"
read tag
WORKDIR=/tmp
sed "s/__TAG__/$tag/" Dockerfile > Dockerfile.tagged
docker build -f Dockerfile.tagged -t $username/swift:latest .
docker tag $username/swift:latest $username/swift:$tag
docker build -f Dockerfile.tagged -t swift-tmp .
docker save swift-tmp > $WORKDIR/swift_tmp.tar
#figure out where to use from
FROM=`docker history -q swift-tmp | tail -n 3 | head -n 1`
PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH"
sudo docker-squash -from $FROM -i "$WORKDIR/swift_tmp.tar" -o "$WORKDIR/swift_squashed.tar" -t $username/swift:$tag
docker load -i $WORKDIR/swift_squashed.tar
docker tag $username/swift:$tag $username/swift:latest
id=$(docker create drewcrawford/swift:latest)
docker cp $id:usr/local/lib/swift - > swiftlibs.tar
docker build -f Runtime.dockerfile -t $username/swift-runtime:latest .
......
#!/bin/bash
set -e
#projects that have no tag
NOTAG=("swift-dev" "swift-corelibs-libdispatch")
for file in `find ../ -maxdepth 1 -type d`; do
skip=0
for n in "${NOTAG[@]}"; do
echo "test ../$n $file"
if [[ "../$n" = "$file" ]]; then
skip=1
break;
fi
if [[ "../" = "$file" ]]; then
skip=1
break;
fi
done
if [[ $skip = 0 ]]; then
cd $file
echo checking out in `pwd`
git checkout $SWIFT_TAG
fi
done
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment