Index: jhbuild/config.py
===================================================================
RCS file: /cvs/gnome/jhbuild/jhbuild/config.py,v
retrieving revision 1.24
diff -u -r1.24 config.py
--- jhbuild/config.py	12 May 2006 08:04:53 -0000	1.24
+++ jhbuild/config.py	14 Jun 2006 16:16:23 -0000
@@ -34,7 +34,7 @@
                 'interact', 'buildscript', 'nonetwork',
                 'alwaysautogen', 'nobuild', 'makeclean', 'makecheck',
                 'use_lib64', 'tinderbox_outputdir', 'sticky_date',
-                'tarballdir', 'pretty_print' ]
+                'tarballdir', 'pretty_print', 'stage' ]
 
 env_prepends = {}
 def prependpath(envvar, path):
Index: jhbuild/defaults.jhbuildrc
===================================================================
RCS file: /cvs/gnome/jhbuild/jhbuild/defaults.jhbuildrc,v
retrieving revision 1.19
diff -u -r1.19 defaults.jhbuildrc
--- jhbuild/defaults.jhbuildrc	17 May 2006 12:03:26 -0000	1.19
+++ jhbuild/defaults.jhbuildrc	14 Jun 2006 16:16:23 -0000
@@ -67,3 +67,9 @@
 
 # whether to try and pretty print the output
 pretty_print = True
+
+# states dictionary
+allowedstates = {}
+
+# Defined stage
+stage = None
Index: jhbuild/commands/base.py
===================================================================
RCS file: /cvs/gnome/jhbuild/jhbuild/commands/base.py,v
retrieving revision 1.12
diff -u -r1.12 base.py
--- jhbuild/commands/base.py	24 May 2006 05:37:27 -0000	1.12
+++ jhbuild/commands/base.py	14 Jun 2006 16:16:23 -0000
@@ -183,6 +183,9 @@
             make_option('-D', metavar='DATE-SPEC',
                         action='store', dest='sticky_date', default=None,
                         help='set a sticky date when checking out modules'),
+            make_option('-S', '--stage', metavar='{update|configure|build|install}',
+                        action='store', dest='stage', default=None,
+                        help='run a specific stage'),
             ])
 
     def run(self, config, options, args):
@@ -194,6 +197,8 @@
             config.nonetwork = True
         if options.sticky_date is not None:
             config.sticky_date = options.sticky_date
+        if options.stage is not None:
+            config.stage = options.stage
 
         module_set = jhbuild.moduleset.load(config)
         try:
Index: jhbuild/frontends/buildscript.py
===================================================================
RCS file: /cvs/gnome/jhbuild/jhbuild/frontends/buildscript.py,v
retrieving revision 1.10
diff -u -r1.10 buildscript.py
--- jhbuild/frontends/buildscript.py	18 May 2006 10:34:13 -0000	1.10
+++ jhbuild/frontends/buildscript.py	14 Jun 2006 16:16:23 -0000
@@ -62,10 +62,11 @@
     def build(self):
         '''start the build of the current configuration'''
         self.start_build()
-        
+
         failures = [] # list of modules that couldn't be built
         self.module_num = 0
         for module in self.modulelist:
+
             self.module_num = self.module_num + 1
             self.start_module(module.name)
             failed = False
@@ -74,12 +75,32 @@
                     self.message('module %s not built due to non buildable %s'
                                  % (module.name, dep))
                     failed = True
+
             if failed:
                 failures.append(module.name)
                 self.end_module(module.name, failed)
                 continue
 
-            state = module.STATE_START
+            if (self.config.stage is not None):
+                state_name = self.config.stage
+                try:
+                    if state_name == 'update':
+                        try:
+                            state = module.STATE_CHECKOUT
+                        except AttributeError:
+                            # for metapackages
+                            state = module.STATE_DOWNLOAD
+                    elif state_name == 'configure':
+                        state = module.STATE_CONFIGURE
+                    elif state_name == 'build':
+                        state = module.STATE_BUILD 
+                    elif state_name == 'install':
+                        state = module.STATE_INSTALL
+                except AttributeError:
+                    state = module.STATE_DONE
+            else:
+                state = module.STATE_START
+                
             while state != module.STATE_DONE:
                 self.start_phase(module.name, state)
                 nextstate, error, altstates = module.run_state(self, state)
@@ -97,6 +118,17 @@
                         state = newstate
                 else:
                     state = nextstate
+
+                if (self.config.stage is not None):
+                    try:
+                        if nextstate:
+                            if nextstate in ['update','checkout','build','install']:
+                                state = module.STATE_DONE
+                        else:
+                            state = module.STATE_DONE
+                    except AttributeError:
+                        state = module.STATE_DONE
+                    
             self.end_module(module.name, failed)
         self.end_build(failures)
 
