[banshee] [build] finished migrating to v2 of bundle builder



commit 888608f137763a6179c1c95291c7c7d0f62df0fb
Author: Aaron Bockover <abockover novell com>
Date:   Thu Jan 7 16:49:57 2010 -0500

    [build] finished migrating to v2 of bundle builder
    
    The rest of the goodies from the first pass of build.py are
    now moved to profile.py.
    
    Other various cleanup and fixes such that darwin fully builds
    again. Hooray.

 bootstrap-bundle                      |    9 +-
 build/bundle/bockbuild/build.py       |  244 ---------------------------------
 build/bundle/bockbuild/environment.py |    4 +
 build/bundle/bockbuild/package.py     |   19 ++-
 build/bundle/bockbuild/profile.py     |   58 +++++++-
 build/bundle/packages/freetype.py     |    2 +-
 build/bundle/packages/gtk-sharp.py    |    7 +-
 build/bundle/packages/liboil.py       |    4 +-
 8 files changed, 82 insertions(+), 265 deletions(-)
---
diff --git a/bootstrap-bundle b/bootstrap-bundle
index d3ad00f..f73b51c 100755
--- a/bootstrap-bundle
+++ b/bootstrap-bundle
@@ -22,12 +22,15 @@ if ! test -f "build/bundle/$profile"; then
 	exit 1
 fi
 
+envfile="$(pwd)/$(dirname "$0")/$profile_name.env"
+
 pushd build/bundle &>/dev/null
 ./$profile -bv
-./$profile -e > $profile_name.env
-source $profile_name.env
+./$profile -e > "$envfile"
 popd &>/dev/null
 
+source "$envfile"
+
 CONFIGURE_ARGS="
 	--disable-mtp
 	--disable-daap
@@ -44,7 +47,7 @@ cat <<EOF
 The world has built! You can now build Banshee.
 Be sure to source in the profile environment:
 
-  $ source build/bundle/$profile_name.env
+  $ source $profile_name.env
 
 Once sourced, just run autogen/configure/make, etc
 as normal. The install prefix is available as the
diff --git a/build/bundle/bockbuild/environment.py b/build/bundle/bockbuild/environment.py
index 307deea..a7a7360 100644
--- a/build/bundle/bockbuild/environment.py
+++ b/build/bundle/bockbuild/environment.py
@@ -32,6 +32,10 @@ class Environment:
 		expand_macros (self, self._profile)
 
 	def dump (self):
+		print '#------------------------------#'
+		print '# GENERATED FILE - DO NOT EDIT #'
+		print '#------------------------------#'
+		print
 		for k in self.get_names ():
 			print 'export %s="%s"' % (k, self.__dict__[k])
 
diff --git a/build/bundle/bockbuild/package.py b/build/bundle/bockbuild/package.py
index a0a6850..7ee744b 100644
--- a/build/bundle/bockbuild/package.py
+++ b/build/bundle/bockbuild/package.py
@@ -22,7 +22,7 @@ class Package:
 			self.source_dir_name = '%{name}-%{version}'
 
 		self.prefix = os.path.join (Package.profile.build_root, '_install')
-		self.configure = './configure --prefix=%{prefix}'
+		self.configure = './configure --prefix="%{prefix}"'
 		self.make = 'make -j%s' % Package.profile.cpu_count
 		self.makeinstall = 'make install'
 
@@ -70,7 +70,7 @@ class Package:
 			print 'Skipping %s - already built' % namever
 			return
 
-		print 'Building %s on %s (%s CPU)' % (self.name, profile.host,
+		print '\n\nBuilding %s on %s (%s CPU)' % (self.name, profile.host,
 			profile.cpu_count)
 
 		if not os.path.exists (profile.build_root) or \
@@ -84,9 +84,9 @@ class Package:
 
 		os.chdir (package_build_dir)
 
-		self.prep ()
-		self.build ()
-		self.install ()
+		for phase in Package.profile.run_phases:
+			log (0, '%sing %s' % (phase.capitalize (), self.name))
+			getattr (self, phase) ()
 
 		open (build_success_file, 'w').close ()
 
@@ -94,8 +94,8 @@ class Package:
 		for command in commands:
 			command = expand_macros (command, self)
 			log (1, command)
-			#if not Package.profile.verbose:
-			#	command = '( %s ) &>/dev/null' % command
+			if not Package.profile.verbose:
+				command = '( %s ) &>/dev/null' % command
 			run_shell (command)
 
 	def cd (self, dir):
@@ -105,22 +105,25 @@ class Package:
 
 	def prep (self):
 		if self.sources == None:
+			log (1, '<skipping - no sources defined>')
 			return
 		root, ext = os.path.splitext (self.sources[0])
 		if ext == '.zip':
-			self.sh ('unzip "%{sources[0]}"')
+			self.sh ('unzip -qq "%{sources[0]}"')
 		else:
 			self.sh ('tar xf "%{sources[0]}"')
 		self.cd ('%{source_dir_name}')
 	
 	def build (self):
 		if self.sources == None:
+			log (1, '<skipping - no sources defined>')
 			return
 		self.sh ('%{configure} %{configure_flags}')
 		self.sh ('%{make}')
 
 	def install (self):
 		if self.sources == None:
+			log (1, '<skipping - no sources defined>')
 			return
 		self.sh ('%{makeinstall}')
 
diff --git a/build/bundle/bockbuild/profile.py b/build/bundle/bockbuild/profile.py
index a95dbe2..e9181bc 100644
--- a/build/bundle/bockbuild/profile.py
+++ b/build/bundle/bockbuild/profile.py
@@ -1,5 +1,5 @@
 import os
-import build
+from optparse import OptionParser
 from util import *
 from environment import Environment
 from package import *
@@ -15,10 +15,60 @@ class Profile:
 		self.cpu_count = get_cpu_count ()
 		self.host = get_host ()
 
-	def run (self):
-		build.main (self)
-	
 	def build (self):
+		default_run_phases = ['prep', 'build', 'install']
+
+		parser = OptionParser (usage = 'usage: %prog [options] [package_names...]')
+		parser.add_option ('-b', '--build',
+			action = 'store_true', dest = 'do_build', default = False,
+			help = 'build the profile')
+		parser.add_option ('-v', '--verbose',
+			action = 'store_true', dest = 'verbose', default = False,
+			help = 'show all build output (e.g. configure, make)')
+		parser.add_option ('-i', '--include-phase',
+			action = 'append', dest = 'include_run_phases', default = [],
+			help = 'explicitly include a build phase to run %s' % default_run_phases)
+		parser.add_option ('-x', '--exclude-phase',
+			action = 'append', dest = 'exclude_run_phases', default = [],
+			help = 'explicitly exclude a build phase from running %s' % default_run_phases)
+		parser.add_option ('-s', '--only-sources',
+			action = 'store_true', dest = 'only_sources', default = False,
+			help = 'only fetch sources, do not run any build phases')
+		parser.add_option ('-e', '--environment', default = False,
+			action = 'store_true', dest = 'dump_environment',
+			help = 'Dump the profile environment as a shell-sourceable list of exports ')
+		options, args = parser.parse_args ()
+
+		packages_to_build = args
+		self.verbose = options.verbose
+		self.run_phases = default_run_phases
+
+		if options.dump_environment:
+			self.env.compile ()
+			self.env.dump ()
+			sys.exit (0)
+
+		if not options.do_build:
+			parser.print_help ()
+			sys.exit (1)
+
+		if not options.include_run_phases == []:
+			self.run_phases = options.include_run_phases
+		for exclude_phase in options.exclude_run_phases:
+			self.run_phases.remove (exclude_phase)
+		if options.only_sources:
+			self.run_phases = []
+
+		for phase_set in [self.run_phases,
+			options.include_run_phases, options.exclude_run_phases]:
+			for phase in phase_set:
+				if phase not in default_run_phases:
+					sys.exit ('Invalid run phase \'%s\'' % phase)
+
+		log (0, 'Loaded profile \'%s\' (%s)' % (self.name, self.host))
+		for phase in self.run_phases:
+			log (1, 'Phase \'%s\' will run' % phase)
+
 		log (0, 'Setting environment variables')
 		self.env.compile ()
 		self.env.export ()
diff --git a/build/bundle/packages/freetype.py b/build/bundle/packages/freetype.py
index daffca9..182187b 100644
--- a/build/bundle/packages/freetype.py
+++ b/build/bundle/packages/freetype.py
@@ -1,3 +1,3 @@
 SourceForgePackage ('%{name}', 'freetype', '2.3.11', override_properties = {
-	'configure': './configure --prefix %{prefix}'
+	'configure': './configure --prefix "%{prefix}"'
 })
diff --git a/build/bundle/packages/gtk-sharp.py b/build/bundle/packages/gtk-sharp.py
index 60d15a9..e9655c0 100644
--- a/build/bundle/packages/gtk-sharp.py
+++ b/build/bundle/packages/gtk-sharp.py
@@ -10,7 +10,7 @@ class GtkSharpPackage (Package):
 		self.cd ('..')
 		if os.path.isdir ('svn'):
 			self.cd ('svn')
-			self.sh ('svn up')
+			#self.sh ('svn up')
 		else:
 			self.sh ('svn co http://anonsvn.mono-project.com/source/branches/%{name}-%{version} svn')
 			self.cd ('svn')
@@ -23,8 +23,11 @@ class GtkSharpPackage (Package):
 
 	def build (self):
 		self.sh (
-			'./bootstrap-2.12 --prefix=%{prefix}',
+			'./bootstrap-2.12 --prefix="%{prefix}"',
 			'%{make}'
 		)
 
+	def install (self):
+		self.sh ('%{makeinstall}')
+
 GtkSharpPackage ()
diff --git a/build/bundle/packages/liboil.py b/build/bundle/packages/liboil.py
index 1a73aad..474defd 100644
--- a/build/bundle/packages/liboil.py
+++ b/build/bundle/packages/liboil.py
@@ -1,8 +1,6 @@
 Package ('liboil', '0.3.16',
 	sources = [
-		'http://download.banshee-project.org/misc/%{name}-%{version}.tar.gz'
-		# a bunch of liboil releases appear to be missing from the site...
-		# 'http://%{name}.freedesktop.org/download/%{name}-%{version}.tar.gz'
+		'http://%{name}.freedesktop.org/download/%{name}-%{version}.tar.gz'
 	],
 	configure_flags = [
 		'--disable-gtk-doc'



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]