User:KaiRo/ParallelsMacOSX

From MozillaWiki
Jump to: navigation, search

What I did put into the Parallels Mac OS X installs:

Base System

Set up by Mozilla IT (mrz) - Basic Leopard Server with admin-equiv user "enduser"

Updates

Installed all Apple Updates offered as of 2009-05-07, most importantly OS X 10.5.6 v1.1

Disabled regular checking for updates

Reference Platform

Tried to stick to ReferencePlatforms/Mac-10.5 with the exception of not creating a cltbld or seabld user yet (should be done after tkaing a reference copy of the image) and not adding tinderbox-related stuff, sticking to what modern buildbot setups need.

Ref platform packages

No access to CVS, so got them from build & release team (bhearsum) directly, did put them into /tools/dist/ - I removed older XCode versions, we only need 3.1 nowadays - same with DarwinPorts/dports (10.4), we're using MacPorts for 10.5 here.

# md5 /tools/dist/*
MD5 (/tools/dist/MacPorts-1.6.0-10.5-Leopard.dmg) = 5cbae915b67f7d06576d544b83303714
MD5 (/tools/dist/SharedMenusCocoa.dmg) = 65c3aeb974f5f8c75b8daa92c9185122
MD5 (/tools/dist/chud_4.5.0.dmg) = 3f02477e0df2a3bc53d02fe0824c0015
MD5 (/tools/dist/macports-10.5.tar.bz2) = 38f9a0f0b133371b9e8b7170a7158ef5
MD5 (/tools/dist/xcode_3.1.dmg) = 3e8503230fa16675a3068b33c72044f2

Installing Xcode

  1. Mount the Xcode disk image, and begin installing the XcodeTools.mpkg.
  2. A standard install is fine (we don't need 10.3.9 support or WebObjects).

Installing CHUD

  1. Mount the CHUD disk image, install the CHUD.mpkg

Installing MacPorts

  • Install the MacPorts package from ref platform version 1.6-10.5
  • Unpack the macports-10.5 tarball of source packages and move them into place:
cd /opt/local/var/macports
sudo rm -rf *
sudo tar jxf /tools/dist/macports-10.5.tar.bz2
  • Due what is said to be to a bug in MacPorts 1.6, .profile isn't initialized correctly, so do this manually (as enduser):
nano ~/.profile
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
export MANPATH=/opt/local/share/man:$MANPATH

Write to disk (^O) and Exit (^X), then re-login as enduser to set those variables.

  • Somehow MacPorts has upgraded itself to the newest version, we now have 1.710 installed even though the installer was 1.6. Our macports source tarball isn't really consistent with that version, so need to do a selfupdate:
sudo port selfupdate

Note that it doesn't actually update itself, but it fixes some internal config (no visible output about that though).

  • Next, need to install a series of ports, all of which should already have been contained (and the right version) in the macports tarball unpacked before, if it wasn't for the magical self-updating of MacPorts. Seeing the port command hitting the network (-->Fetching...) while installing the needed ports, but need to live with it, hoping that installed versions are OK for us.
sudo port install sqlite3
sudo port install autoconf213 cvs libidl subversion wget

There's a bug with sqlite3 where it fails to compile, depending on what was built before it, so we build it and it's deps first. The second command builds everything else. Afterwards, running port installed shows only the ports listed below:

 apr @1.3.3_1 (active)
 apr-util @1.3.4_1 (active)
 autoconf213 @2.13_1 (active)
 cvs @1.11.23_0 (active)
 cyrus-sasl2 @2.1.22_0+kerberos (active)
 db46 @4.6.21_5 (active)
 expat @2.0.1_0 (active)
 gawk @3.1.6_0 (active)
 gettext @0.17_4 (active)
 glib2 @2.20.1_0 (active)
 gperf @3.0.4_0 (active)
 libiconv @1.12_2 (active)
 libidl @0.8.13_0 (active)
 m4 @1.4.13_0 (active)
 ncurses @5.7_0 (active)
 ncursesw @5.7_0 (active)
 neon @0.28.4_0 (active)
 openssl @0.9.8k_0 (active)
 perl5 @5.8.9_0 (active)
 perl5.8 @5.8.9_3 (active)
 pkgconfig @0.23_1 (active)
 readline @6.0.000_1 (active)
 serf @0.3.0_0 (active)
 sqlite3 @3.6.13_0 (active)
 subversion @1.6.1_0 (active)
 wget @1.11.4_3 (active)
 zlib @1.2.3_2 (active)

Buildbot and Mercurial

Make directories

 mkdir -p /tools/dist/logs
 mkdir -p /builds/logs

Install Python 2.5.2

Python 2.5 doesn't compile on 10.5, and we'll take the latest version rather than the 2.5.1 that ships with the OS.

mkdir -p /tools/dist
cd /tools/dist
wget http://www.python.org/ftp/python/2.5.2/Python-2.5.2.tar.bz2
tar jxvf Python-2.5.2.tar.bz2
cd Python-2.5.2
./configure --prefix=/tools/python
make
make test
make install

export PYTHONHOME="/tools/python"
export PATH="/tools/python/bin:$PATH"

Installing Zope Interface

cd /tools/dist/
wget http://www.zope.org/Products/ZopeInterface/3.3.0/zope.interface-3.3.0.tar.gz
tar xfvz zope.interface-3.3.0.tar.gz 
cd zope.interface-3.3.0/
python setup.py install --prefix=/tools/zope-interface-3.3.0
cd /tools; ln -s zope-interface-3.3.0/ zope-interface
export PYTHONPATH="/tools/zope-interface/lib/python2.5/site-packages/:$PYTHONPATH"

Installing Twisted

cd /tools/dist/
wget http://tmrc.mit.edu/mirror/twisted/Twisted/2.4/TwistedCore-2.4.0.tar.bz2
wget http://tmrc.mit.edu/mirror/twisted/Twisted/2.4/Twisted-2.4.0.tar.bz2
tar xfvj TwistedCore-2.4.0.tar.bz2 
tar xfvj Twisted-2.4.0.tar.bz2 
cd TwistedCore-2.4.0
python setup.py install --prefix=/tools/twisted-core-2.4.0
pushd /tools/; ln -s twisted-core-2.4.0/ twisted-core; popd
export PYTHONPATH="/tools/twisted-core/lib/python2.5/site-packages:$PYTHONPATH"
cd /tools/dist/Twisted-2.4.0/
python setup.py install --prefix=/tools/twisted-2.4.0
cd /tools; ln -s twisted-2.4.0 twisted
export PYTHONPATH="/tools/twisted/lib/python2.5/site-packages/:$PYTHONPATH"

Installing Mercurial 1.2.1

cd /tools/dist
wget http://www.selenic.com/mercurial/release/mercurial-1.2.1.tar.gz 
# SHA512(mercurial-1.2.1.tar.gz)= dcadfc731e5e1afae2cfc3eb1ac46875c26d5f029228ea5f397061c05e0524bdf651e3443d8936ec78f51c8d92a904d89c1a45ca941ee8908a99ad5c075096c2
tar xfvz mercurial-1.2.1.tar.gz
cd mercurial-1.2.1
python setup.py install

Installing BuildBot

cd /tools
hg clone http://hg.mozilla.org/build/buildbot
cd /tools/buildbot
export PYTHONPATH=.:$PYTHONPATH
python setup.py install --prefix=/tools/buildbot

Small Pre-Image Fixups

Set dock size

defaults write com.apple.dock tilesize -int 49; killall Dock

(until a fix is in for bug 470420)

Symlink for autoconf

Due to calling in RepackFactory to command=['bash', '-c', 'autoconf-2.13'] to fix this we have to add a symlink to autoconf213

sudo ln -s /opt/local/bin/autoconf213 /opt/local/bin/autoconf-2.13

Copy fonts from another Mac

cd /Library/Fonts
sudo rsync -av cltbld@bm-xserve16:/Library/Fonts/ ./

At least, that's the theory. I actually got build and release (bhearsum) scp the dir to a temp place I could access and did scp it from there to the machine. The outcome should be the same, though.

Post-Imaging Steps

Note: I didn't want to "pollute" the reference image with this, so left to do for any consumer of the image.

Config I'm Not Sure About

This is either "probably MoCo-specific" or stuff I'm not sure we need on Parallels, see ReferencePlatforms/Mac-10.5 for the details on those.

  • Nagios (probably MoCo-specific)
  • ntp config (not sure if needed with Parallels)
  • chown scripts (still needed with hg/buildbot setups?)

Build User setup

  • Log in as root
  • Change the password for the administrator user to the standard build system root password.
  • Create a new admin-equiv account for the cltbld or seabld user using the standard build password.
  • In System Prefs -> Accounts -> Login Options, set 'Automatic Login' to the new user, enter the password when prompted.
  • Under System Preferences->Sharing->Screen Sharing->Computer Settings change the VNC screen control password to the standard build password. NOTE: your VNC session will drop when you do this. You'll need to reconnect with the new password.

Login in as the new build user and complete its setup:

Environment Variables

Add the appropriate paths to the Buildbot user's .profile

echo 'export PYTHONHOME="/tools/python"' >> ~/.profile
echo 'export PYTHONPATH="/tools/buildbot/lib/python2.5/site-packages:/tools/twisted/lib/python2.5/site-packages:/tools/twisted-corelib/python2.5/site-packages/:/tools/zope-interface/lib/python2.5/site-packages/"' >> ~/.profile
echo 'export PATH="/opt/local/bin:/tools/buildbot/bin:/tools/twisted/bin:/tools/twisted-core/bin:$PYTHONHOME/bin:$PATH"' >> ~/.profile

SSH Keys

Copy ssh keys for the user from another box where it's set up into ~/.ssh/

Establish initial ssh connections and accept keys

Execute the following simple ssh calls to connect to the ftp server (stage), symbol server (if different from ftp), and update server so that the various pieces of the build can be uploaded automatically by the build scripts when needed:

ssh seabld@stage.mozilla.org pwd
ssh seabld@aus2-community.mozilla.org pwd
ssh seabld@hg.mozilla.org
ssh seabld@dm-symbolpush01.mozilla.org pwd

(or equivalent for whatever servers you need to access)

Setup buildbot start on boot

cd /Library/LaunchAgents
sudo wget --no-check-certificate -Obuildbot.start.slave.plist https://bug428124.bugzilla.mozilla.org/attachment.cgi?id=371801
sudo chown root:wheel buildbot.start.slave.plist 
  • Ensure the the correct user and slave directory are set in the script (cltbld and /builds/slave by default)

From VNC:

  • Make sure the resolution is set to 1280x1024.

Reboot (after setting up the slave, see following step in this doc).

(See https://bugzilla.mozilla.org/show_bug.cgi?id=428124 for details.)

Setup buildbot slave

Note: The Buildbot installation in the image is 0.7.10p1 (build/buildbot repo as of 2009-05-08), if you want any other version, got to /tools/buildbot, hg up to the needed revision and re-install buildbot.

Remove any /builds/*slave* left over on the image then

mkdir -p /builds/slave
cd /builds/slave

and either

  • run "buildbot create-slave" with appropriate arguments to point at the staging-master. Note that we need to set "umask = 002" in buildbot.tac.
  • or else copy over buildbot.tac and info files from another staging slave and update the slavename and basedir

Using a VNC session rather than ssh, start the slave with

buildbot start /builds/slave