Commits
Zero King authored 258fe21c2bb
1 1 | |
2 2 | set -e |
3 3 | # Uninstall Homebrew |
4 4 | curl -fsSLO "https://raw.githubusercontent.com/Homebrew/install/master/uninstall" |
5 5 | chmod 0755 uninstall && ./uninstall -fq && rm -f uninstall |
6 6 | # Clean /usr/local |
7 7 | /usr/bin/sudo /usr/bin/find /usr/local -mindepth 2 -delete && hash -r |
8 8 | # Download and install MacPorts built by https://github.com/macports/macports-base/blob/travis-ci/.travis.yml |
9 - | export OS_MAJOR=$(uname -r | cut -f 1 -d .) |
9 + | OS_MAJOR=$(uname -r | cut -f 1 -d .) |
10 10 | curl -fsSLO "https://dl.bintray.com/macports-ci-bot/macports-base/MacPorts-${OS_MAJOR}.tar.bz2" |
11 11 | sudo tar -xpf "MacPorts-${OS_MAJOR}.tar.bz2" -C / |
12 12 | rm -f "MacPorts-${OS_MAJOR}.tar.bz2" |
13 13 | # Prepare environment variables: clear CC and set PATH for port |
14 14 | unset CC && source /opt/local/share/macports/setupenv.bash |
15 15 | # Set ports tree to $PWD |
16 16 | sudo sed -i "" "s|rsync://rsync.macports.org/macports/release/tarballs/ports.tar|file://${PWD}|; /^file:/s/default/nosync,default/" /opt/local/etc/macports/sources.conf |
17 17 | # CI is not interactive |
18 18 | echo "ui_interactive no" | sudo tee -a /opt/local/etc/macports/macports.conf >/dev/null |
19 19 | # Only download from the CDN, not the mirrors |
34 34 | rsync --no-motd -zvl "rsync://rsync.macports.org/macports/release/ports/PortIndex_darwin_${OS_MAJOR}_i386/PortIndex*" . |
35 35 | git remote add macports https://github.com/macports/macports-ports.git |
36 36 | git fetch macports master |
37 37 | git checkout -qf macports/master |
38 38 | git checkout -qf - |
39 39 | portindex -e |
40 40 | # Create macports user |
41 41 | sudo /opt/local/postflight && sudo rm -f /opt/local/postflight |
42 42 | # Install mpbb and its dependency getopt |
43 43 | git clone --depth 1 https://github.com/macports/mpbb.git ../mpbb |
44 - | export PATH="${PWD}/../mpbb:$PATH" |
45 44 | curl -fsSLO "https://dl.bintray.com/macports-ci-bot/getopt/getopt-v1.1.6.tar.bz2" |
46 45 | sudo tar -xpf "getopt-v1.1.6.tar.bz2" -C / |
47 - | export PATH="/opt/mports/bin:$PATH" && hash -r |
48 46 | # Download and run CI runner |
49 47 | curl -fsSLO "https://github.com/macports/mpbot-github/releases/download/v0.0.1/runner" |
50 48 | chmod 0755 runner |
51 49 | |
52 50 | # Work around broken gen_bridge_metadata / bridgesupportparser.bundle on High Sierra and Mojave |
53 51 | # See https://trac.macports.org/ticket/54939 |
54 52 | if ! /usr/bin/gen_bridge_metadata --version >/dev/null 2>&1; then |
55 53 | sudo ln -s XcodeDefault.xctoolchain "$(xcode-select -p)"/Toolchains/OSX"$(sw_vers -productVersion | cut -d. -f1-2)".xctoolchain |
56 54 | fi |