All pastes #100362 Raw Edit

Anonymous

public text v1 · immutable
#100362 ·published 2006-07-26 01:57 UTC
rendered paste body
##################################################################################################################### 
# Name: Asylum 
# Version: 0.1 Alpha
# By: Ian "Inc" Caldwell
# Purpose: Make svn builds of Songbird on linux easier
# Contact me: Inc@inc-corporate.org
# License: BSD
#-------------------------------------------------------------------------------------------------------------------
# Copyright (c) 2006, Ian Caldwell (Inc-corporate.org)
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the # following conditions are met:
# * Redistributions of source code must retain the above copyright notice, this list of conditions and the 
# following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 
# following disclaimer in the    
# documentation and/or other materials provided with the distribution.
# Neither the name of the Ian Caldwell nor the names of its contributors may be used to endorse or promote 
# products derived from this software 
# without specific prior written permission.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED 
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#-------------------------------------------------------------------------------------------------------------------
# todo: 1. ADD 'Songbird -update' functionality
# Special thanks to: The people at #python and #osuosl at irc.freenode.net for their advice, Michael Vandenberghe for his 
# help. Also thanks to Aali for hosting the svn! oh and also Rob Zinkov for his help.
# comments / suggestions / help welcome at Inc@inc-corporate.org THANKS!
####################################################################################################################
# So yeah This part will speed up the code to the point of being the same as compiled C or such. If you plan to use this script alot
# I recommend you downloading and installing it. You can grab it here http://psyco.sf.net. So install that shit and be done with :-p
try:
	import psyco
except:
	pass
import sys
sys.path.append("/usr/share/asylum")
import math, time, os, urllib2, datetime, asylum_base, subprocess
print """
		Asylum Build System V0.1 Alpha
		\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\
			by:
				Ian (Inc)
		\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\
"""
#-------------------------------------------------------------------Source section-----------------------------------------------------------------------------------------------------------------
# Url to grab the snapshot source from
sUrltemplate = "http://developer.songbirdnest.com/nightly/snapshots/"
# The tarball file source depending on your systems local Year, Month and Date
sFiletemplate = "songbird_snapshot_%Y%m%d.tar.gz"
# Misc Date stuff
sFile = datetime.date.today().strftime(sFiletemplate)
# finished source url
sUrl = sUrltemplate + sFile
# what goes before the url
source = "The songbird source that is being grabbed is: "
# this prints files and what the source file URL is.
print source + sUrl
ui = asylum_base.ui()
asylum_base.download([sUrl],sFile,ui)
done = " has finished downloading now moving onto: "
dstep = "\nDependency download"
print sFile + done + dstep
# --------------------------------------------------------------------Dependency section--------------------------------------------------------------------------------------------------------------
# The Base Url of the Dependency snapshots
dUrltemplate = "http://developer.songbirdnest.com/nightly/dependency_snapshots/"
# filename for the dependencies depending on your systems local Year, Month and Date
dFiletemplate ="dependencies_snapshot-linux-%Y%m%d.tar.gz"
# misc Date stuff
dFile = datetime.date.today().strftime(dFiletemplate)
# finished Dependency Url
dUrl = dUrltemplate + dFile
# what goes before the url being printed
depend = "The Songbird dependencies file that is being grabbed is: "
# Prints the dependency file that is being downloaded
print depend + dUrl
asylum_base.download([dUrl],dFile,ui)
#-------------------------------------------------------------Misc section-----------------------------------------------------------------------------------------------------------------------------------
tarstep = "Asylum is now uncompressing: " 
#print "Now createing all the directories..."
# decompressing all the files
print "\nhere comes uncompressing of the source this takes about 1 minute and 10 seconds. Please be patient"
subprocess.call(['tar', '-xvzf', sFile,'-C', os.path.expanduser('~')], stdout=source.logfile)
#os.system('tar -xzf %s -C ~/' % sFile)
#subprocess.call(['tar', '-xvzf', sFile,'-C', '~/']) << for a later time maybe?
print "ok, so here comes the big gun (extracting the dependencies).This process takes about 2 minutes and 30 seconds to complete.....so chill"
subprocess.call(['make', '-f','songbird.mk)],stdout=make.logfile)
#subprocess.call(['tar', '-xvzf', dFile,'-C', os.path.expanduser('~')])
#os.system('tar -xzqf  %d -C ~/' % dFile) 
#a = os.popen('tar -xvzf %s -C /home/free/xsst4/' % dFile).read()
# another method eventually? tar -zxvf %s -C %s" % (dFile, os.path.expanduser('~'))

# now comes the building part.......

#os.path.expanduser('/sbird/trunk')
# closing the script
raw_input("\n\nhit enter key to exit.")