User:Armenzg:scripts: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
 
Line 2: Line 2:


== Install python, zope and buildbot ==
== Install python, zope and buildbot ==
<pre>
https://wiki.mozilla.org/ReferencePlatforms/Mac-10.5#Buildbot
#!/bin/sh
 
#NOTE: This is a one time run script, there should be another one for bringing
#the tool chain to the latest
PROFILE=/home/armenzg/.bashrc
 
#. grab_files.sh
##################
# create directories
mkdir -p /tools/dist/logs
mkdir -p /builds/logs
 
#initial setup steps
export PYTHONPATH="/tools/python"
export PATH="/tools/python/bin:$PATH"
ln -s /tools/gcc-4.1.1 /tools/gcc
 
# using dist to hold downloaded packages
cd /tools/dist
wget http://python.org/ftp/python/2.5.2/Python-2.5.2.tar.bz2
wget http://pypi.python.org/packages/source/z/zope.interface/zope.interface-3.4.1.tar.gz#md5=b085f4a774adab688e037ad32fbbf08e
wget http://tmrc.mit.edu/mirror/twisted/Twisted/8.0/Twisted-8.0.1.tar.bz2#md5=1ba5bb530356a867cfee35e65e58a43c
cvs -d ":pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot" co -d buildbot-0.7.9 mozilla/tools/buildbot
 
 
#. unpack_files.sh
####################
cd /tools/dist
tar xjfv Python-2.5.2.tar.bz2
tar xzfv zope.interface-3.4.1.tar.gz
tar xjfv Twisted-8.0.1.tar.bz2
 
 
#. install_python.sh
######################
cd /tools/dist/Python-2.5.2
./configure --prefix=/tools/python-2.5.2 2>&1 | tee /tools/dist/logs/python2.5.2-configure.log
make 2>&1 | tee /tools/dist/logs/python2.5.2-make.log
make install 2>&1 | tee /tools/dist/logs/python2.5.2-make_install.log
cd /tools
if [[ -h python ]]; then
rm -f python
fi
ln -s python-2.5.2 python
 
export PYTHONHOME="/tools/python"
export PATH="/tools/python/bin:$PATH"
 
 
#. install_zope.sh
####################
cd /tools/dist/zope.interface-3.4.1
python setup.py install --prefix=/tools/zope-interface-3.4.1
cd /tools
if [[ -h zope-interface ]]; then
    rm -f zope-interface
fi
ln -s zope-interface-3.4.1 zope-interface
 
export PYTHONPATH="/tools/zope-interface/lib/python2.5/site-packages/:$PYTHONPATH"
 
 
#. install_twisted.sh
#######################
cd /tools/dist/Twisted-8.0.1
python setup.py install --prefix=/tools/twisted-8.0.1
cd /tools
if [[ -h twisted ]]; then
    rm -f twisted
fi
ln -s twisted-8.0.1 twisted
export PYTHONPATH="/tools/twisted/lib/python2.5/site-packages:$PYTHONPATH"
 
 
#. install_buildbot.sh
########################
pushd /tools/dist/buildbot-0.7.9
python setup.py install --prefix=/tools/buildbot-trunk
cd /tools
if [[ -h buildbot ]]; then
    rm -f buildbot
fi
ln -s buildbot-trunk buildbot
mkdir buildbotcustom
cd buildbotcustom
cvs -d:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co -d buildbotcustom mozilla/tools/buildbotcustom
 
 
#. post_install.sh
####################
echo 'export PYTHONHOME="/tools/python"' >> $PROFILE
echo 'export PYTHONPATH="/tools/buildbotcustom:/tools/buildbot/lib/python2.5/site-packages:/tools/twisted/lib/python2.5/site-packages:/tools/twisted-core/lib/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
cat $PROFILE
 
#. cleanup.sh
###############
cd /tools/dist
rm -rf tools/python-2.5.1 Python-2.5.2 Python-2.5.2.tar.bz2
rm -rf zope.interface-3.4.1.tar.gz zope.interface-3.4.1
rm -rf twisted-2.4.0 twisted-core-2.4.0 twisted-core Twisted-8.0.1 Twisted-8.0.1.tar.bz2
#rm -rf tools/buildbot-076 buildbot-0.7.7
 
echo "All done."
</pre>


== Generate multiple repositories without an apache or lighthttp server ==
== Generate multiple repositories without an apache or lighthttp server ==

Latest revision as of 15:40, 22 January 2010

I am going to list in here different type of scripts

Install python, zope and buildbot

https://wiki.mozilla.org/ReferencePlatforms/Mac-10.5#Buildbot

Generate multiple repositories without an apache or lighthttp server

#!/bin/bash
set -ex
sudo mkdir -p /var/hg/l10n-central
sudo chown -R armenzg /var/hg
sudo cat << MARKER > /var/hg/hgweb.config
[collections]
l10n-central/ = l10n-central/
MARKER
cd /var/hg/
hg init l10n-central/af
hg init l10n-central/de
hg serve --webdir-conf /var/hg/hgweb.config

Generates a buildbot master and a slave

buildbot create-master master
buildbot create-slave slave localhost:9989 bot1name bot1passwd

Print all-locales from cvs

#!/tools/python/bin/python

import subprocess

def getLocales():
    """ 
    It returns a list with all locales from all-locales in the repository
    """
    # communicate() returns a tuple - stdio, stderr
    # the output of cvs has a '\n' element at the end
    # a last '' string is generated that we get rid of
    return subprocess.Popen(
        ['cvs', '-q', '-d', ':pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot',
         'co', '-p', 'mozilla/browser/locales/all-locales'],
        stdout=subprocess.PIPE).communicate()[0].split('\n')[0:-1]

for locale in getLocales():
    print locale

Restart connection

I have not used it personally myself but bhearsum suggested it to me when we were having trouble connecting with my mac or for tunnelblick, I can't remember

#!/bin/sh
for i in 0 1 2; do
 scutil <<EOF
 open
 d.init
 remove State:/Network/Service/openvpn-tun${i}/IPv4
 remove State:/Network/Service/openvpn-tun${i}/DNS
EOF
done