1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
#!/bin/sh
# -*- sh-basic-offset: 2 -*-
##
# Copyright (c) 2005-2017 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##
set -e
set -u
wd="$(cd "$(dirname "$0")/.." && pwd)";
. "${wd}/bin/_build.sh";
init_build;
export PATH="/Applications/Server.app/Contents/ServerRoot/usr/bin:${PATH}";
requirements="${wd}/requirements-osx.txt";
extra_features="opendirectory,postgres";
#
# Download virtualenv and friends so that B&I has that core toolchain.
#
mkdir -p "${wd}/.develop/tools";
export PYTHONUSERBASE="${wd}/.develop/tools";
for pkg in \
setuptools==18.5 \
pip==8.1.2 \
virtualenv==15.0.2 \
; do
ruler "Installing ${pkg}";
pip download -d "${wd}/.develop/tools" "${pkg}";
done;
#
# Build cffi because xattr needs it at setup time.
#
if ! find_header ffi.h; then
c_glue_include="${dev_roots}/c_glue/include";
mkdir -p "${c_glue_include}";
echo "#include <ffi/ffi.h>" > "${c_glue_include}/ffi.h"
export C_INCLUDE_PATH="${c_glue_include}:${C_INCLUDE_PATH:-}";
fi;
#
# Download dependencies
#
ve_tmp="$(mktemp -d -t CalendarServer_ve_tools)";
# Bootstrap virtualenv and friends so we can use them in this script (not sent to B&I).
py_ve_tools="${ve_tmp}/ve_tools";
export PYTHONPATH="${py_ve_tools}/lib/python/site-packages:${wd}:${PYTHONPATH:-}";
bootstrap_virtualenv;
reqs_to_use="${ve_tmp}/requirements-osx.txt";
# Copy over each requirements file we need and edit a few to remove stuff we don't need
sed -e '/requirements-dev.txt/d' < "${wd}/requirements-osx.txt" > "${ve_tmp}/requirements-osx.txt";
sed -e '/python-ldap/d' < "${wd}/requirements-cs.txt" > "${ve_tmp}/requirements-cs.txt";
echo "xattr==0.7.5" >> "${ve_tmp}/requirements-cs.txt";
cp "${wd}/requirements-twisted-osx.txt" "${ve_tmp}/";
ruler "Downloading Python requirements for .[${extra_features}]";
echo "";
pip_download \
--no-deps \
--requirement="${reqs_to_use}" \
;
rm -rf "${ve_tmp}";
#
# Check out CalDAVTester
#
url="$(grep egg=CalDAVTester "${wd}/requirements-dev.txt" | sed 's|^.*git+\([^@#]*\).*$|\1|')";
rev="$(grep egg=CalDAVTester "${wd}/requirements-dev.txt" | sed 's|^.*git+[^@#]*@\([0-9a-z]*\).*$|\1|')";
git clone "${url}" "${wd}/CalDAVTester";
rm -rf "${wd}/CalDAVTester/.git";
# FIXME: checkout rev
tar -C "${wd}" -cvzf "${wd}/CalDAVTester.tgz" CalDAVTester;
rm -r CalDAVTester;
#
# Remove .exe files from archives
#
for archive in $(find "${wd}/.develop" -type f -name '*.tgz' -or -name '*.tar.gz'); do
if tar -tvzf "${archive}" "*.exe" > /dev/null 2>&1; then
ruler "Removing binaries from ${archive}";
tmp="$(mktemp -t ccsXXXXX)";
gzcat "${archive}" | gnutar --delete --wildcards -vf - "*.exe" > "${tmp}";
gzip -c "${tmp}" > "${archive}";
rm "${tmp}";
fi;
done;
#
# Remove .eggs files from archives
#
for archive in $(find "${wd}/.develop" -type f -name '*.zip'); do
if unzip -qql "${archive}" "*/.eggs/" > /dev/null 2>&1; then
ruler "Removing eggs from ${archive}";
zip -qd "${archive}" "*/.eggs/*";
fi;
done;
#
# Remove src
#
ruler "Removing source";
rm -rf "${wd}/src"
ruler "";
|