Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/test-items/ambulant.py
diff options
context:
space:
mode:
Diffstat (limited to 'test-items/ambulant.py')
-rwxr-xr-xtest-items/ambulant.py192
1 files changed, 192 insertions, 0 deletions
diff --git a/test-items/ambulant.py b/test-items/ambulant.py
new file mode 100755
index 0000000..1c761e4
--- /dev/null
+++ b/test-items/ambulant.py
@@ -0,0 +1,192 @@
+#!/usr/bin/env python
+import subprocess
+import optparse
+import sys
+from path import path
+
+fromscratch = False
+
+#download source tarball (live555-latest.tar.gz) from http://www.live555.com/liveMedia/public into $srcdir
+LIVE555 = ['wget http://www.live555.com/liveMedia/public/live555-latest.tar.gz']
+
+#download source tarball (ftp://xmlsoft.org/libxml2/libxml2-sources-2.7.1.tar.gz) from ftp://xmlsoft.org/libxml2 into $srcdir
+LIBXML2 = ['wget ftp://xmlsoft.org/libxml2/libxml2-sources-2.7.1.tar.gz']
+
+#download source tarball gettext-0.17.tar.gz into $srcdir
+GETTEXT = ['wget ftp://ftp.gnu.org/gnu/gettext/gettext-0.17.tar.gz']
+
+#download ffmpeg (svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg)
+FFMPEG = ['svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg', 'cp -r $srcdir/ffmpeg .']
+
+#Create a function, that takes a list parameter
+#Function uses default keyword parameter of cmds
+def runCommands(cmds):
+ #Iterates over list, running statements for each item in the list
+ count=0
+ for cmd in cmds:
+ count += 1
+ print "Running Command %s, %s" % (count, cmd)
+ subprocess.call(cmd, shell=True)
+
+#If ROOTDIR does not exist, downloads ambulant, extracts to ROOTDIR
+def fetchAmbulant():
+ if ROOTDIR.exists():
+ fromscratch = False
+ return
+ else:
+ fromscratch = True
+ #download ambulant 2 and extract to ROOTDIR
+ wgetcmd = 'wget --directory-prefix ' + ROOTDIR + ' http://downloads.sourceforge.net/ambulant/ambulant-2.0.1-src.tgz'
+ print 'wget', wgetcmd
+ subprocess.call(wgetcmd, shell=True)
+ print 'tar', tarcmd
+ tarcmd = 'tar -xf ambulant-2.0.1-src.tgz'
+ subprocess.call(tarcmd, shell=True, cwd=ROOTDIR)
+
+def fetchTPP():
+ print 'fromscratch', fromscratch, options.fetch
+ if fromscratch or "expat" in options.fetch:
+ wgetcmd = 'wget http://downloads.sourceforge.net/expat/expat-2.0.1.tar.gz'
+ print 'expat wget', wgetcmd
+ subprocess.call(wgetcmd, shell=True, cwd=ROOTDIR)
+ tarcmd = 'tar -xf ' + ROOTDIR + '/expat-2.0.1.tar.gz'
+ print 'expat tarcmd', tarcmd
+ subprocess.call(tarcmd, shell=True, cwd=TPPDIR)
+ if fromscratch or "ffmpeg" in options.fetch:
+ svncmd = 'svn checkout -r "{2008-06-15}" svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg'
+ print 'ffmpeg', svncmd
+ subprocess.call(svncmd, shell=True, cwd=TPPDIR)
+ if fromscratch or "libsdl" in options.fetch:
+ wgetcmd = 'wget http://www.libsdl.org/release/SDL-1.2.13.tar.gz'
+ print 'libsdl', wgetcmd
+ subprocess.call(wgetcmd, shell=True, cwd=ROOTDIR)
+ tarcmd = 'tar -xf ' + ROOTDIR + '/SDL-1.2.13.tar.gz'
+ print 'libsdl', tarcmd
+ subprocess.call(tarcmd, shell=True, cwd=TPPDIR)
+ if fromscratch or "live555" in options.fetch:
+ wgetcmd = 'wget http://www.live555.com/liveMedia/public/live555-latest.tar.gz'
+ print 'live555', wgetcmd
+ subprocess.call(wgetcmd, shell=True, cwd=ROOTDIR)
+ tarcmd = 'tar -xf ' + ROOTDIR + '/live555-latest.tar.gz'
+ print 'live555', tarcmd
+ subprocess.call(tarcmd, shell=True, cwd=TPPDIR)
+ if fromscratch or "libxml2" in options.fetch:
+ wgetcmd = 'wget ftp://xmlsoft.org/libxml2/libxml2-2.7.3.tar.gz'
+ print 'libxml2', wgetcmd
+ subprocess.call(wgetcmd, shell=True, cwd=ROOTDIR)
+ tarcmd = 'tar -xf ' + ROOTDIR + '/libxml2-2.7.3.tar.gz'
+ print 'libxml2', tarcmd
+ subprocess.call(tarcmd, shell=True, cwd=TPPDIR)
+
+def buildTPP():
+ if fromscratch or "expat" in options.build:
+ configcmd = './configure --prefix=' + TPPDIR + '/expat-unix'
+ cwdpath = TPPDIR + '/expat-2.0.1'
+ subprocess.call(configcmd, shell=True, cwd=cwdpath)
+ subprocess.call('make', shell = True, cwd=cwdpath)
+ subprocess.call('make install', shell=True, cwd=cwdpath)
+ if fromscratch or "ffmpeg" in options.build:
+ configcmd = './configure --enable-gpl'
+ cwdpath = TPPDIR + '/ffmpeg'
+ subprocess.call(configcmd, shell=True, cwd=cwdpath)
+ subprocess.call('make', shell = True, cwd=cwdpath)
+ if fromscratch or "libsdl" in options.build:
+ print 'build libsdl'
+ configcmd = './configure'
+ cwdpath = TPPDIR + '/SDL-1.2.13'
+ subprocess.call(configcmd, shell=True, cwd=cwdpath)
+ subprocess.call('make', shell = True, cwd=cwdpath)
+ subprocess.call('make install', shell=True, cwd=cwdpath)
+ if fromscratch or "live555" in options.build:
+ print 'build live555'
+ configcmd = './genMakefiles linux'
+ cwdpath = TPPDIR + '/live'
+ subprocess.call(configcmd, shell=True, cwd=cwdpath)
+ subprocess.call('make', shell = True, cwd=cwdpath)
+ if fromscratch or "libxml2" in options.build:
+ print 'build libxml2'
+ configcmd = './configure'
+ cwdpath = TPPDIR + '/libxml2-2.7.3'
+ subprocess.call(configcmd, shell=True, cwd=cwdpath)
+ subprocess.call('make', shell = True, cwd=cwdpath)
+ subprocess.call('make install', shell=True, cwd=cwdpath)
+
+def buildAmbulant():
+ if not test == 'yes':
+ #configcmd = './configure --with-live --with-python --with-ffmpeg'
+ configcmd = './configure --with-ffmpeg --with-live -with-python'
+ cwdpath = ROOTDIR + '/ambulant-2.0.1'
+ retcode = subprocess.call(configcmd, shell=True, cwd=cwdpath)
+ if retcode > 0:
+ print 'ambulant configure failed'
+ return
+ logfile = open('make.log', 'w')
+ retcode = subprocess.call('make', shell = True, cwd=cwdpath, stdout=logfile, stderr = subprocess.STDOUT)
+ logfile.close()
+ if retcode > 0:
+ print 'ambulant make failed'
+ return
+ logfile = open('install.log', 'w')
+ retcode = subprocess.call('make install', shell=True, cwd=cwdpath, stdout=logfile, stderr=subprocess.STDOUT)
+ logfile.close()
+ if retcode > 0:
+ print 'ambulant install failed'
+ return
+
+#builds ambulant
+def main():
+ temp = 'ROOTDIR= ' + str(ROOTDIR) + ' ' + str(ROOTDIR.exists()) + '\n'
+ print temp
+ print 'fetch= ' + fetch + '\n'
+ print 'build= ' + build + '\n'
+ #fetch ambulant if ROOTDIR does not exist
+ fetchAmbulant()
+ #download latest version of selected packages
+ fetchTPP()
+ #build selected packages
+ buildTPP()
+ #build ambulant
+ buildAmbulant()
+ print 'done'
+
+#This idiom means the below code only runs when executed from command line
+if __name__ == '__main__':
+ sys.stdout = open("ambulant.log", "w")
+ parser = optparse.OptionParser("usage: %ambulant [options] ")
+ #option --prefix = path to ambulant folder; if ambulant folder does not exist, fetch ambulant and all third-party packages
+ #option --fetch=[expat, ffmpeg, ...] list of packages to download
+ #option --build=[expat, ffmpeg, ...] list of packages to build
+
+ parser.add_option("-p", "--prefix", dest="prefix",
+ default="/home/tony/Documents/testambulant", type="string",
+ help="path to ambulant2 folder")
+
+ parser.add_option("-f", "--fetch", dest="fetch",
+ default="[]", type="string",
+ help="list of packages to be downloaded, e.g. [expat, ffmpeg]")
+ parser.add_option("-b", "--build", dest="build", default="[]",
+ type="string", help="list of packages to be built, e.g. [expat, ffmpeg")
+ parser.add_option("-t", "--test", dest="test", default="no", type="string", help="--test to log commands but not execute")
+
+ (options, args) = parser.parse_args()
+
+ prefix = options.prefix
+ fetch = options.fetch
+ build = options.build
+ test = options.test
+
+ print 'options prefix', prefix
+ print 'options fetch', fetch
+ print 'options build', build
+ print 'options test', test
+
+ if len(prefix) > 0:
+ ROOTDIR = path(prefix)
+ else:
+ ROOTDIR = path('/home/tony/Documents/testambulant')
+ print 'ROOTDIR', ROOTDIR
+ TPPDIR= path(ROOTDIR / 'ambulant-2.0.1' / 'third_party_packages')
+ print 'ROOTDIR', ROOTDIR
+ print 'TPPDIR', TPPDIR
+ main()
+sys.exit()