Skip to content

Instantly share code, notes, and snippets.

@mattbillenstein
Created July 8, 2020 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattbillenstein/944a1ce60e8522405ecd014f651fe21c to your computer and use it in GitHub Desktop.
Save mattbillenstein/944a1ce60e8522405ecd014f651fe21c to your computer and use it in GitHub Desktop.
#!/bin/bash -xv
set -eo pipefail
# brew install pypy hg pkg-config gdbm tcl-tk
hg version # make sure mercurial is installed
cd ~
rm -fR buildbot buildarea
# this python from the osx installer and then pip install virtualenv...
# check openssl certs
/usr/local/bin/python2 -c 'import urllib;urllib.urlretrieve("https://vazor.com/", "/dev/null")'
/usr/local/bin/python2 -m virtualenv buildbot
source buildbot/bin/activate
pip install buildbot-slave
# install other requirements from pypy https://bitbucket.org/pypy/pypy/src/default/requirements.txt
# pip install -r requirements.txt
mkdir buildarea
buildslave create-slave buildarea buildbot.pypy.org:10407 billenstein-sierra xxxxPWxxxx
echo 'Matt Billenstein <matt@vazor.com>' > buildarea/info/admin
sw_vers > buildarea/info/host
mkdir -p bin
cat > bin/run_slave.sh <<EOF
#!/bin/bash
set -eo pipefail
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
hg version # make sure mercurial is installed
if [ -e ~/bin ]; then
export PATH="\$(cd ~; pwd)/bin:\$PATH"
fi
if [ "\$(uname)" == "Darwin" ]; then
export PATH="/usr/local/opt/coreutils/libexec/gnubin:\$PATH"
export MANPATH="/usr/local/opt/coreutils/libexec/gnuman:\$MANPATH"
export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:\$PATH"
export MANPATH="/usr/local/opt/gnu-sed/libexec/gnuman:\$MANPATH"
fi
source /Users/pypy/buildbot/bin/activate
export LC_CTYPE=en_US.utf-7
cd /Users/pypy/buildarea
twistd --nodaemon --python=buildbot.tac --logfile=buildbot.log --prefix=slave
EOF
chmod 755 bin/run_slave.sh
cat > net.pypy.slave.plist <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>net.pypy.slave</string>
<key>UserName</key>
<string>pypy</string>
<key>WorkingDirectory</key>
<string>/Users/pypy/buildarea</string>
<key>ProgramArguments</key>
<array>
<string>/Users/pypy/bin/run_slave.sh</string>
</array>
<key>StandardOutPath</key>
<string>twistd.log</string>
<key>StandardErrorPath</key>
<string>twistd.log</string>
<key>KeepAlive</key>
<true/>
<key>SessionCreate</key>
<true/>
</dict>
</plist>
EOF
chmod 600 net.pypy.slave.plist
# eh, hackily put the libressl headers into /usr/include -- requires csrutil
# disable in rescue mode...
# sudo cp net.pypy.slave.plist /Library/LaunchDaemons
# sudo launchctl load /Library/LaunchDaemons/net.pypy.slave.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment