[jhbuild/jhdebuild: 521/536] Merge branch 'master' into jhdebuild



commit 74d0bfbae579bd65cd58eda8f3a5af0984f46fba
Merge: de9cbda... 8daba85...
Author: John Carr <john carr unrouted co uk>
Date:   Sun May 17 14:09:26 2009 +0100

    Merge branch 'master' into jhdebuild
    
    Conflicts:
    	jhbuild/frontends/terminal.py
    	jhbuild/modtypes/__init__.py
    	jhbuild/modtypes/autotools.py
    	jhbuild/modtypes/perl.py

 .gitignore                                         |   37 +
 ChangeLog => ChangeLog.pre-git                     | 1185 ++++
 Makefile.am                                        |   21 +-
 Makefile.plain                                     |   11 +-
 autogen.sh                                         |    2 +
 buildbot/public_html/lgo.css                       |   16 +-
 buildbot/public_html/top-header-gradient.png       |  Bin 0 -> 725 bytes
 buildbot/template.html                             |    4 +-
 configure.ac                                       |   17 +-
 doc/C/jhbuild.xml                                  |  455 +-
 doc/ChangeLog                                      |   88 -
 doc/es/es.po                                       | 5780 +++++++++++---------
 doc/fr/fr.po                                       | 1843 ++++---
 install-check.c                                    |    7 +-
 jhbuild.desktop                                    |    9 +-
 jhbuild.doap                                       |   37 +
 jhbuild.in                                         |    6 -
 jhbuild/Makefile.am                                |   13 +
 jhbuild/buildbot/Makefile.am                       |   11 +
 jhbuild/buildbot/changes.py                        |  128 +-
 jhbuild/buildbot/factory.py                        |   17 +-
 jhbuild/buildbot/status/Makefile.am                |    7 +
 jhbuild/buildbot/status/web/Makefile.am            |   13 +
 jhbuild/buildbot/status/web/__init__.py            |   28 +-
 jhbuild/buildbot/status/web/bot.py                 |   67 +
 jhbuild/buildbot/status/web/changes.py             |   20 +-
 jhbuild/buildbot/steps.py                          |    6 +-
 jhbuild/commands/Makefile.am                       |   17 +
 jhbuild/commands/__init__.py                       |    6 +-
 jhbuild/commands/autobuild.py                      |    4 +-
 jhbuild/commands/base.py                           |  142 +-
 jhbuild/commands/bootstrap.py                      |   51 +-
 jhbuild/commands/bot.py                            |  163 +-
 jhbuild/commands/checkbranches.py                  |   28 +-
 jhbuild/commands/checkmodulesets.py                |   10 +-
 jhbuild/commands/clean.py                          |   68 +
 jhbuild/commands/gui.py                            |    4 +-
 jhbuild/commands/info.py                           |   10 +-
 jhbuild/commands/rdepends.py                       |    4 +-
 jhbuild/commands/sanitycheck.py                    |   31 +-
 jhbuild/commands/snapshot.py                       |   61 +
 jhbuild/commands/tinderbox.py                      |    6 +-
 jhbuild/commands/uninstall.py                      |   69 +
 jhbuild/config.py                                  |  130 +-
 jhbuild/cut_n_paste/Makefile.am                    |    7 +
 jhbuild/defaults.jhbuildrc                         |   17 +-
 jhbuild/errors.py                                  |    9 +
 jhbuild/frontends/Makefile.am                      |   21 +
 jhbuild/frontends/autobuild.py                     |   14 +-
 jhbuild/frontends/buildscript.py                   |  137 +-
 jhbuild/frontends/gtkui.py                         |   20 +-
 jhbuild/frontends/terminal.py                      |   65 +-
 jhbuild/frontends/tinderbox.py                     |   31 +-
 jhbuild/main.py                                    |   21 +-
 jhbuild/modtypes/Makefile.am                       |   14 +
 jhbuild/modtypes/__init__.py                       |  153 +-
 jhbuild/modtypes/ant.py                            |   45 +-
 jhbuild/modtypes/autotools.py                      |  317 +-
 jhbuild/modtypes/cmake.py                          |   68 +-
 jhbuild/modtypes/distutils.py                      |   50 +-
 jhbuild/modtypes/linux.py                          |  183 +-
 jhbuild/modtypes/mesa.py                           |  152 -
 jhbuild/modtypes/mozillamodule.py                  |  202 -
 jhbuild/modtypes/perl.py                           |   50 +-
 jhbuild/modtypes/tarball.py                        |   22 +-
 jhbuild/modtypes/testmodule.py                     |   24 +-
 jhbuild/modtypes/waf.py                            |  101 +-
 jhbuild/moduleset.py                               |   94 +-
 jhbuild/utils/Makefile.am                          |   12 +
 jhbuild/utils/httpcache.py                         |   12 +-
 jhbuild/utils/sxml.py                              |   91 +
 jhbuild/utils/unpack.py                            |    3 +
 jhbuild/versioncontrol/Makefile.am                 |   14 +
 jhbuild/versioncontrol/__init__.py                 |   56 +-
 jhbuild/versioncontrol/arch.py                     |   10 +-
 jhbuild/versioncontrol/bzr.py                      |   78 +-
 jhbuild/versioncontrol/cvs.py                      |   37 +-
 jhbuild/versioncontrol/darcs.py                    |    6 +-
 jhbuild/versioncontrol/git.py                      |  266 +-
 jhbuild/versioncontrol/hg.py                       |   12 +-
 jhbuild/versioncontrol/mtn.py                      |    1 +
 jhbuild/versioncontrol/svn.py                      |   47 +-
 jhbuild/versioncontrol/tarball.py                  |   69 +-
 modulesets/bootstrap-devel.modules                 |   44 +
 modulesets/bootstrap.modules                       |   29 +-
 modulesets/freedesktop-2.26.modules                |   99 +-
 modulesets/freedesktop-2.28.modules                |  461 ++
 modulesets/freedesktop-devel.modules               |   61 +
 modulesets/gnome-2.10.modules                      |    7 +-
 modulesets/gnome-2.12.modules                      |    7 +-
 modulesets/gnome-2.14.modules                      |    7 +-
 modulesets/gnome-2.16.modules                      |   10 +-
 modulesets/gnome-2.18.modules                      |    3 +-
 modulesets/gnome-2.20.modules                      |   12 +-
 modulesets/gnome-2.22.modules                      |   14 +-
 modulesets/gnome-2.24.modules                      |   31 +-
 modulesets/gnome-2.26.modules                      |  369 +-
 modulesets/gnome-2.28.modules                      | 2375 ++++++++
 modulesets/gnome-devel.modules                     |  203 +
 modulesets/gnome-external-deps-2.24.modules        |    4 +-
 modulesets/gnome-external-deps-2.26.modules        |  327 +-
 modulesets/gnome-external-deps-2.28.modules        |  882 +++
 modulesets/gnome-external-deps-devel.modules       |  552 ++
 modulesets/gnome-suites-2.20.modules               |    8 +-
 modulesets/gnome-suites-2.22.modules               |   22 +-
 modulesets/gnome-suites-2.24.modules               |   44 +-
 modulesets/gnome-suites-2.26.modules               |  380 +-
 modulesets/gnome-suites-2.28.modules               | 1939 +++++++
 modulesets/gnome-suites-devel.modules              |  144 +
 modulesets/gtk.modules                             |    3 +-
 modulesets/mobile-2.28.modules                     |   35 +
 modulesets/moduleset.dtd                           |   23 +-
 modulesets/moduleset.rnc                           |   12 -
 modulesets/online-desktop.modules                  |    3 +-
 patches/gettext-0.17-open.patch                    |   14 +
 patches/nss.pkgconfig-and-configure.patch          |    3 +-
 ...-2.4.5-lib64.patch => python-2.5.2-lib64.patch} |  418 +-
 patches/samba.configure-for-libs.patch             |   96 +
 patches/sqlite-3.6.12.dlsym.patch                  |  316 ++
 patches/waf-install.patch                          |   34 +-
 po/ChangeLog                                       |   92 -
 po/POTFILES.in                                     |    6 +-
 po/es.po                                           |  593 ++-
 po/fr.po                                           |  489 +-
 po/it.po                                           |  422 +-
 po/sv.po                                           | 1155 +++--
 po/uk.po                                           |  385 +-
 sample.jhbuildrc                                   |    9 +-
 scripts/Makefile.am                                |   23 +
 scripts/jhbuild.in                                 |   28 +
 tests/libhello/configure.in                        |    1 +
 tests/mock.py                                      |   13 +-
 tests/tests.py                                     |   59 +-
 133 files changed, 18182 insertions(+), 7247 deletions(-)

diff --cc jhbuild/defaults.jhbuildrc
index 85e4f45,aaaef69..d284479
--- a/jhbuild/defaults.jhbuildrc
+++ b/jhbuild/defaults.jhbuildrc
@@@ -128,15 -136,8 +136,15 @@@ noxvfb = Fals
  # arguments to pass to xvfb
  xvfbargs = ''
  
 +debuild = False
 +nodinstall = False
 +debian_checkout_modules = []
 +
 +# build external deps
 +build_external_deps = 'mininum'
 +
  # options for jhbuildbot slaves
- jhbuildbot_master = 'localhost:9070'
+ jhbuildbot_master = 'build.gnome.org:9070'
  jhbuildbot_slavename = None
  jhbuildbot_password = None
  
diff --cc jhbuild/frontends/terminal.py
index 4f0552a,af07e71..46a4d62
--- a/jhbuild/frontends/terminal.py
+++ b/jhbuild/frontends/terminal.py
@@@ -268,14 -278,17 +281,18 @@@ class TerminalBuildScript(buildscript.B
              return 'fail'
          while True:
              print
-             uprint(_('  [1] rerun stage %s') % state)
-             uprint(_('  [2] ignore error and continue to %s') % nextstate)
+             uprint(_('  [1] rerun phase %s') % phase)
+             if nextphase:
+                 uprint(_('  [2] ignore error and continue to %s') % nextphase)
+             else:
+                 uprint(_('  [2] ignore error and continue to next module'))
              uprint(_('  [3] give up on module'))
 -            uprint(_('  [4] start shell'))
 -            uprint(_('  [5] reload configuration'))
 -            nb_options = i = 6
 +            uprint(_('  [4] give up on module but fake success'))
 +            uprint(_('  [5] start shell'))
-             i = 6
-             for altstate in altstates:
-                 uprint(_('  [%d] go to stage %s') % (i, altstate))
++            uprint(_('  [6] reload configuration'))
++            nb_options = i = 7
+             for altphase in (altphases or []):
+                 uprint(_('  [%d] go to phase %s') % (i, altphase))
                  i = i + 1
              val = raw_input(uencode(_('choice: ')))
              val = val.strip()
@@@ -296,6 -307,8 +313,8 @@@
                  uprint(_('exit shell to continue with build'))
                  os.system(user_shell)
                  os.chdir(cwd) # restor working directory
 -            elif val == '5':
++            elif val == '6':
+                 self.config.reload()
              else:
                  try:
                      val = int(val)
diff --cc jhbuild/modtypes/__init__.py
index b36ea22,5af1374..5a65fca
--- a/jhbuild/modtypes/__init__.py
+++ b/jhbuild/modtypes/__init__.py
@@@ -27,23 -27,11 +27,24 @@@ __all__ = 
      'get_branch'
      ]
  
 +try:
 +    import apt_pkg
 +except ImportError:
 +    apt_pkg = None
 +
  import os
 +import re
  
- from jhbuild.errors import FatalError, CommandError, BuildStateError
+ from jhbuild.errors import FatalError, CommandError, BuildStateError, SkipToEnd
+ from jhbuild.utils.sxml import sxml
  
 +def lax_int(s):
 +    try:
 +        return int(s)
 +    except ValueError:
 +        return -1
 +
 +
  _module_types = {}
  def register_module_type(name, parse_func):
      _module_types[name] = parse_func
@@@ -129,20 -117,11 +130,13 @@@ def get_branch(node, repositories, defa
      return repo.branch_from_xml(name, childnode, repositories, default_repo)
  
  
- class SkipToState(Exception):
-     def __init__(self, state):
-         Exception.__init__(self)
-         self.state = state
- 
- 
  class Package:
      type = 'base'
-     STATE_START = 'start'
-     STATE_APT_GET_UPDATE = 'apt_get_update'
-     STATE_BUILD_DEPS     = 'build_deps'
-     STATE_DONE  = 'done'
-     def __init__(self, name, dependencies = [], after = [], suggests = [],
-             extra_env = None):
+     PHASE_START = 'start'
++    PHASE_APT_GET_UPDATE = 'apt_get_update'
++    PHASE_BUILD_DEPS     = 'build_deps'
+     PHASE_DONE  = 'done'
+     def __init__(self, name, dependencies = [], after = [], suggests = []):
          self.name = name
          self.dependencies = dependencies
          self.after = after
@@@ -238,65 -144,29 +235,39 @@@
      def get_revision(self):
          return None
  
-     def _next_state(self, buildscript, last_state):
-         """Work out what state to go to next, possibly skipping some states.
- 
-         This function executes skip_$state() to decide whether to run that
-         state or not.  If it returns True, go to do_$state.next_state and
-         repeat.  If it returns False, return that state.
-         """
- 
+     def skip_phase(self, buildscript, phase, last_phase):
 +        if buildscript.config.debuild:
-             self.do_prefix = 'do_deb_'
-             self.skip_prefix = 'skip_deb_'
++            skip_prefix = 'skip_deb_'
 +        else:
-             self.do_prefix = 'do_'
-             self.skip_prefix = 'skip_'
- 
-         seen_states = []
-         state = getattr(self, self.do_prefix + last_state).next_state
-         while True:
-             seen_states.append(state)
-             if state == self.STATE_DONE:
-                 return state
- 
-             do_method = getattr(self, self.do_prefix + state)
-             skip_method = getattr(self, self.skip_prefix + state)
-             try:
-                 if skip_method(buildscript, last_state):
-                     state = do_method.next_state
-                     assert state not in seen_states, (
-                         'state %s should not appear in list of '
-                         'skipped states: %r' % (state, seen_states))
-                 else:
-                     return state
-             except SkipToState, e:
-                 return e.state
- 
-     def run_state(self, buildscript, state):
++            skip_prefix = 'skip_'
++
+         try:
 -            skip_phase_method = getattr(self, 'skip_' + phase)
++            skip_phase_method = getattr(self, skip_prefix + phase)
+         except AttributeError:
+             return False
+         return skip_phase_method(buildscript, last_phase)
+ 
+     def run_phase(self, buildscript, phase):
          """run a particular part of the build for this package.
  
          Returns a tuple of the following form:
-           (next-state, error-flag, [other-states])
+           (error-flag, [other-phases])
          """
- 
 -        method = getattr(self, 'do_' + phase)
 +        if buildscript.config.debuild:
-             self.do_prefix = 'do_deb_'
-             self.skip_prefix = 'skip_deb_'
++            do_prefix = 'do_deb_'
 +        else:
-             self.do_prefix = 'do_'
-             self.skip_prefix = 'skip_'
++            do_prefix = 'do_'
 +
-         method = getattr(self, self.do_prefix + state)
++        method = getattr(self, do_prefix + phase)
          try:
              method(buildscript)
-         except SkipToState, e:
-             return (e.state, None, None)
          except (CommandError, BuildStateError), e:
-             return (self._next_state(buildscript, state),
-                     e, method.error_states)
+             error_phases = None
+             if hasattr(method, 'error_phases'):
+                 error_phases = method.error_phases
+             return (e, error_phases)
          else:
-             return (self._next_state(buildscript, state), None, None)
+             return (None, None)
  
      def check_build_policy(self, buildscript):
          if not buildscript.config.build_policy in ('updated', 'updated-deps'):
@@@ -330,79 -200,55 +301,117 @@@
          if not os.path.exists(srcdir):
              raise BuildStateError(_('source directory %s was not created') % srcdir)
  
-         if self.check_build_policy(buildscript) == self.STATE_DONE:
-             raise SkipToState(self.STATE_DONE)
+         if self.check_build_policy(buildscript) == self.PHASE_DONE:
+             raise SkipToEnd()
  
-     def skip_checkout(self, buildscript, last_state):
+     def skip_checkout(self, buildscript, last_phase):
          # skip the checkout stage if the nonetwork flag is set
          if buildscript.config.nonetwork:
-             if self.check_build_policy(buildscript) == self.STATE_DONE:
-                 raise SkipToState(self.STATE_DONE)
+             if self.check_build_policy(buildscript) == self.PHASE_DONE:
+                 raise SkipToEnd()
              return True
          return False
 +    skip_deb_checkout = skip_checkout
 +
 +    def do_deb_start(self, buildscript):
 +        buildscript.set_action('Starting building', self)
 +        ext_dep = buildscript.config.external_dependencies.get(self.name)
 +        if ext_dep:
 +            available = self.get_available_debian_version(buildscript).split('-')[0]
 +            if ':' in available: # remove epoch
 +                available = available.split(':')[-1]
 +
 +            deb_available = [lax_int(x) for x in available.split('.')]
 +            ext_minimum = [lax_int(x) for x in ext_dep.get('minimum').split('.')]
 +            ext_recommended = [lax_int(x) for x in ext_dep.get('recommended').split('.')]
 +
 +            if deb_available >= ext_recommended:
 +                buildscript.message('external dependency, available')
 +                if not buildscript.config.build_external_deps == 'always':
 +                    raise SkipToState(self.STATE_DONE)
 +
 +            if deb_available >= ext_minimum:
 +                buildscript.message(
 +                        'external dependency, available (but recommended version is not)')
 +                if not buildscript.config.build_external_deps in ('always', 'recommended'):
 +                    raise SkipToState(self.STATE_DONE)
 +            else:
 +                buildscript.message('external dependency, no version high enough')
 +                if buildscript.config.build_external_deps == 'never':
 +                    raise SkipToState(self.STATE_DONE)
 +    do_deb_start.next_state = STATE_APT_GET_UPDATE
 +    do_deb_start.error_states = []
 +
 +    def skip_deb_apt_get_update(self, buildscript, last_state):
 +        return False
 +
 +    def do_deb_apt_get_update(self, buildscript):
 +        if not buildscript.config.nonetwork:
 +            buildscript.set_action('Updating packages database for', self)
 +            try:
 +                buildscript.execute(['sudo', 'apt-get', 'update'])
 +            except CommandError:
 +                pass
 +    do_deb_apt_get_update.next_state = STATE_DONE
 +    do_deb_apt_get_update.error_states = []
 +
 +    def skip_deb_build_deps(self, buildscript, last_state):
 +        return False
 +
 +    def do_deb_build_deps(self, buildscript):
 +        buildscript.set_action('Installing build deps for', self)
 +        debian_name = self.get_debian_name(buildscript)
 +        v = None
 +        try:
 +            v = self.get_available_debian_version(buildscript)
 +        except KeyError:
 +            pass
 +        if v:
 +            try:
 +                buildscript.execute(['sudo', 'apt-get', '--yes', 'build-dep', debian_name])
 +            except CommandError:
 +                raise BuildStateError('Failed to install build deps')
 +    do_deb_build_deps.next_state = STATE_DONE
 +    do_deb_build_deps.error_states = []
  
+     def xml_tag_and_attrs(self):
+         """Return a (tag, attrs) pair, describing how to serialize this
+         module.
+ 
+         "attrs" is expected to be a list of (xmlattrname, pyattrname,
+         default) tuples. The xmlattr will be serialized iff
+         getattr(self, pyattrname) != default. See AutogenModule for an
+         example."""
+         raise NotImplementedError
+ 
+     def to_sxml(self):
+         """Serialize this module as sxml.
+ 
+         By default, calls sxml_tag_and_attrs() to get the tag name and
+         attributes, serializing those attribute values that are
+         different from their defaults, and embedding the dependencies
+         and checkout branch. You may however override this method to
+         implement a different behavior."""
+         tag, attrs = self.xml_tag_and_attrs()
+         xmlattrs = {}
+         for xmlattr, pyattr, default in attrs:
+             val = getattr(self, pyattr)
+             if val != default:
+                 if type(val) == bool:
+                     val = val and 'true' or 'no'
+                 xmlattrs[xmlattr] = val
+         return [getattr(sxml, tag)(**xmlattrs), self.deps_to_sxml(),
+                 self.branch_to_sxml()]
+ 
+     def deps_to_sxml(self):
+         """Serialize this module's dependencies as sxml."""
+         return ([sxml.dependencies]
+                 + [[sxml.dep(package=d)] for d in self.dependencies])
+ 
+     def branch_to_sxml(self):
+         """Serialize this module's checkout branch as sxml."""
+         return self.branch.to_sxml()
+ 
  
  class MetaModule(Package):
      """A simple module type that consists only of dependencies."""
@@@ -413,18 -259,12 +422,18 @@@
          return buildscript.config.buildroot or \
                 self.get_srcdir(buildscript)
  
-     # nothing to actually build in a metamodule ...
-     def do_start(self, buildscript):
-         pass
-     do_start.next_state = Package.STATE_DONE
-     do_start.error_states = []
+     def to_sxml(self):
+         return [sxml.metamodule(id=self.name),
+                 [sxml.dependencies]
+                 + [[sxml.dep(package=d)] for d in self.dependencies]]
+ 
  
 +    def do_deb_start(self, buildscript):
 +        pass
 +    do_deb_start.next_state = Package.STATE_DONE
 +    do_deb_start.error_states = []
 +
 +
  def parse_metamodule(node, config, url, repos, default_repo):
      id = node.getAttribute('id')
      dependencies, after, suggests = get_dependencies(node)
diff --cc jhbuild/modtypes/autotools.py
index 7d00528,dfe3d30..cd4c646
--- a/jhbuild/modtypes/autotools.py
+++ b/jhbuild/modtypes/autotools.py
@@@ -86,19 -81,9 +84,14 @@@ class AutogenModule(Package, DebianBase
      def get_revision(self):
          return self.branch.tree_id()
  
-     def do_start(self, buildscript):
-         pass
-     do_start.next_state = STATE_CHECKOUT
-     do_start.error_states = []
- 
      def do_checkout(self, buildscript):
          self.checkout(buildscript)
 -    do_checkout.error_phases = [PHASE_FORCE_CHECKOUT]
 +    do_checkout.next_state = STATE_CONFIGURE
 +    do_checkout.error_states = [STATE_FORCE_CHECKOUT]
 +    do_deb_checkout = do_checkout
 +
 +    def skip_force_checkout(self, buildscript, last_state):
 +        return False
  
      def do_force_checkout(self, buildscript):
          buildscript.set_action(_('Checking out'), self)
@@@ -195,15 -180,25 +189,26 @@@
                         (buildscript.config.prefix, "'\${exec_prefix}/lib64'"))
                  cmd = p.sub(r'\1\4-- \2\3', cmd)
  
+         # If there is no --exec-prefix in the constructed autogen command, we
+         # can safely assume it will be the same as {prefix} and substitute it
+         # right now, so the printed command can be copy/pasted afterwards.
+         # (GNOME #580272)
+         if not '--exec-prefix' in template:
+             cmd = cmd.replace('${exec_prefix}', buildscript.config.prefix)
+ 
          buildscript.execute(cmd, cwd = builddir, extra_env = self.extra_env)
-     do_configure.next_state = STATE_CLEAN
-     do_configure.error_states = [STATE_FORCE_CHECKOUT,
-             STATE_FORCE_CLEAN, STATE_FORCE_DISTCLEAN]
+     do_configure.depends = [PHASE_CHECKOUT]
+     do_configure.error_phases = [PHASE_FORCE_CHECKOUT,
+             PHASE_CLEAN, PHASE_DISTCLEAN]
  
-     def skip_clean(self, buildscript, last_state):
-         return (not buildscript.config.makeclean or
-                 buildscript.config.nobuild)
+     def skip_clean(self, buildscript, last_phase):
+         srcdir = self.get_srcdir(buildscript)
+         if not os.path.exists(srcdir):
+             return True
+         if not os.path.exists(os.path.join(srcdir, self.makefile)):
+             return True
+         return False
 +    skip_deb_clean = skip_clean
  
      def do_clean(self, buildscript):
          buildscript.set_action(_('Cleaning'), self)
@@@ -253,28 -240,20 +250,33 @@@
  
      def do_dist(self, buildscript):
          buildscript.set_action(_('Creating tarball for'), self)
-         if buildscript.config.makedistcheck:
-             cmd = '%s %s distcheck' % (os.environ.get('MAKE', 'make'), self.makeargs)
-         else:
-             cmd = '%s %s dist' % (os.environ.get('MAKE', 'make'), self.makeargs)
+         cmd = '%s %s dist' % (os.environ.get('MAKE', 'make'), self.makeargs)
          buildscript.execute(cmd, cwd = self.get_builddir(buildscript),
                      extra_env = self.extra_env)
-     do_dist.next_state = STATE_INSTALL
-     do_dist.error_states = [STATE_FORCE_CHECKOUT, STATE_CONFIGURE]
+     do_dist.depends = [PHASE_CONFIGURE]
+     do_dist.error_phases = [PHASE_FORCE_CHECKOUT, PHASE_CONFIGURE]
  
 +    def do_deb_build_deps(self, buildscript):
 +        return DebianBasePackage.do_deb_build_deps(self, buildscript)
 +    do_deb_build_deps.next_state = STATE_CONFIGURE
 +    do_deb_build_deps.error_states = []
 +
 +    def do_deb_build_package(self, buildscript):
 +        DebianBasePackage.do_deb_build_package(self, buildscript)
 +    do_deb_build_package.next_state = DebianBasePackage.STATE_DINSTALL
 +    do_deb_build_package.error_states = [DebianBasePackage.STATE_TAR_X, STATE_DIST]
 +
 +    def skip_install(self, buildscript, last_state):
 +        return buildscript.config.nobuild
 +
+     def do_distcheck(self, buildscript):
+         buildscript.set_action(_('Creating tarball for'), self)
+         cmd = '%s %s distcheck' % (os.environ.get('MAKE', 'make'), self.makeargs)
+         buildscript.execute(cmd, cwd = self.get_builddir(buildscript),
+                     extra_env = self.extra_env)
+     do_dist.depends = [PHASE_CONFIGURE]
+     do_dist.error_phases = [PHASE_FORCE_CHECKOUT, PHASE_CONFIGURE]
+ 
      def do_install(self, buildscript):
          buildscript.set_action(_('Installing'), self)
          if self.makeinstallargs:
@@@ -285,150 -264,9 +287,153 @@@
          buildscript.execute(cmd, cwd = self.get_builddir(buildscript),
                      extra_env = self.extra_env)
          buildscript.packagedb.add(self.name, self.get_revision() or '')
++<<<<<<< HEAD:jhbuild/modtypes/autotools.py
 +    do_install.next_state = Package.STATE_DONE
 +    do_install.error_states = []
 +    
 +    def get_version(self, buildscript):
 +        version = get_cached_value('version-%s-%s' % (self.name, self.branch.revision_id))
 +        if not version:
 +            version = self.get_makefile_var(buildscript, 'VERSION')
 +            if version:
 +                write_cached_value('version-%s-%s' % (self.name, self.branch.revision_id), version)
 +        return version
 +
 +    do_deb_clean = do_clean
 +    do_deb_build = do_build
 +    skip_deb_build = skip_build
 +
 +    skip_deb_check = skip_check
 +    do_deb_check = do_check
 +    
 +    def do_deb_apt_get_update(self, buildscript):
 +        Package.do_deb_apt_get_update(self, buildscript)
 +    do_deb_apt_get_update.next_state = STATE_CHECKOUT
 +    do_deb_apt_get_update.error_states = []
 +
 +    def do_deb_checkout(self, buildscript):
 +        return self.do_checkout(buildscript)
 +    do_deb_checkout.next_state = Package.STATE_BUILD_DEPS
 +    do_deb_checkout.error_states = []
 +
 +    skip_deb_force_checkout = skip_force_checkout
 +    do_deb_force_checkout = do_force_checkout
 +
 +    def get_tarball_dir(self, buildscript):
 +        return os.path.join(buildscript.config.tarballs_dir, self.name, self.branch.revision_id)
 +
 +    do_deb_configure = do_configure
 +
 +    def skip_deb_clean(self, buildscript, last_state):
 +        return False
 +
 +    do_deb_clean = do_clean
 +    do_deb_build = do_build
 +
 +    def skip_deb_dist(self, buildscript, last_state):
 +        return False
 +
 +    def get_debian_version(self, buildscript):
 +        epoch = ''
 +        try:
 +            available_version = self.get_available_debian_version(buildscript)
 +            if available_version and ':' in available_version:
 +                epoch = available_version.split(':')[0] + ':'
 +        except KeyError:
 +            pass
 +        version = self.get_version(buildscript)
 +        return '%s%s.%s.%s-0' % (epoch, version, self.branch.repository.code, self.branch.revision_id)
 +
 +
 +
 +    def do_deb_dist(self, buildscript):
 +        buildscript.set_action('Creating tarball', self)
 +        cmd = '%s %s dist-gzip' % (os.environ.get('MAKE', 'make'), self.makeargs)
 +        try:
 +            buildscript.execute(cmd, cwd=self.get_builddir(buildscript))
 +        except CommandError:
 +            raise BuildStateError('Failed to make dist')
 +        builddir = self.get_builddir(buildscript)
 +        version = self.get_version(buildscript)
 +        if not version:
 +            raise BuildStateError('Unable to get version number for %s' % self.name)
 +
 +        for v in ('PACKAGE_TARNAME', 'PACKAGE_NAME', 'PACKAGE'):
 +            package_name = self.get_makefile_var(buildscript, v)
 +            if package_name and package_name.strip():
 +                break
 +        else:
 +            raise BuildStateError('failed to get package tarball name')
 +
 +        tarball_filename = '%s-%s.tar.gz' % (package_name, version)
 +        tarball = os.path.join(builddir, tarball_filename)
 +
 +        tarball_dir = self.get_tarball_dir(buildscript)
 +        if not os.path.exists(tarball_dir):
 +            os.makedirs(tarball_dir)
 +        buildscript.execute(['cp', tarball, tarball_dir])
 +
 +        try:
 +            debian_version = self.get_debian_version(self, buildscript)
 +            available_version = self.get_available_debian_version(buildscript)
 +            if debian_version == available_version:
 +                buildscript.message('Available Debian package is already this version')
 +                raise SkipToState(self.STATE_DONE)
 +        except:
 +            pass
 +    do_deb_dist.next_state = DebianBasePackage.STATE_TAR_X
 +    do_deb_dist.error_states = []
 +
 +    def get_distdir(self, buildscript):
 +        tarball_dir = self.get_tarball_dir(buildscript)
 +        try:
 +            filename = os.listdir(tarball_dir)[0]
 +        except IndexError:
 +            raise BuildStateError('failed to get tarball')
 +
 +        return filename[:-7] # removing .tar.gz
 +
 +    def skip_deb_tar_x(self, buildscript, last_state):
 +        return False
 +
 +    def do_deb_tar_x(self, buildscript):
 +        buildscript.set_action('Extracting tarball of', self)
 +        distdir = self.get_distdir(buildscript)
 +        v = distdir.rsplit('-')[-1]
 +        v = '%s.%s.%s' % (v, self.branch.repository.code, self.branch.revision_id)
 +        debian_name = self.get_debian_name(buildscript)
 +        orig_filename = '%s_%s.orig.tar.gz' % (debian_name, v)
 +
 +        tarball_dir = self.get_tarball_dir(buildscript)
 +        builddebdir = self.get_builddebdir(buildscript)
 +        if not os.path.exists(builddebdir):
 +            os.makedirs(builddebdir)
 +        if os.path.exists(os.path.join(builddebdir, orig_filename)):
 +            os.unlink(os.path.join(builddebdir, orig_filename))
 +        os.symlink(os.path.join(tarball_dir, distdir + '.tar.gz'),
 +                os.path.join(builddebdir, orig_filename))
 +
 +        if os.path.exists(os.path.join(builddebdir, distdir)):
 +            buildscript.execute(['rm', '-rf', distdir], cwd = builddebdir)
 +
 +        buildscript.execute(['tar', 'xzf', orig_filename], cwd = builddebdir)
 +    do_deb_tar_x.next_state = DebianBasePackage.STATE_DEBIAN_DIR
 +    do_deb_tar_x.error_states = []
 +
 +    def skip_force_clean(self, buildscript, last_state):
 +        return False
 +
 +    def do_force_clean(self, buildscript):
 +        self.do_clean(buildscript)
 +    do_force_clean.next_state = STATE_CONFIGURE
 +    do_force_clean.error_states = []
 +
 +    def skip_force_distclean(self, buildscript, last_state):
 +        return False
 +
-     def do_force_distclean(self, buildscript):
+     do_install.depends = [PHASE_BUILD]
+ 
+     def do_distclean(self, buildscript):
          buildscript.set_action(_('Distcleaning'), self)
          cmd = '%s %s distclean' % (os.environ.get('MAKE', 'make'), self.makeargs)
          buildscript.execute(cmd, cwd = self.get_builddir(buildscript),
diff --cc jhbuild/modtypes/distutils.py
index 557656c,b39f151..a756a2d
--- a/jhbuild/modtypes/distutils.py
+++ b/jhbuild/modtypes/distutils.py
@@@ -106,61 -90,13 +90,65 @@@ class DistutilsModule(Package)
          cmd.extend(['install', '--prefix', buildscript.config.prefix])
          buildscript.execute(cmd, cwd = srcdir, extra_env = self.extra_env)
          buildscript.packagedb.add(self.name, self.get_revision() or '')
-     do_install.next_state = Package.STATE_DONE
-     do_install.error_states = []
+     do_install.depends = [PHASE_BUILD]
+ 
+     def xml_tag_and_attrs(self):
+         return 'distutils', [('id', 'name', None),
+                              ('supports-non-srcdir-builds',
+                               'supports_non_srcdir_builds', True)]
  
 +    def do_deb_start(self, buildscript):
 +        buildscript.set_action('Starting building', self)
 +        buildscript.execute(['sudo', 'apt-get', 'update'])
 +        ext_dep = buildscript.config.external_dependencies.get(self.name)
 +        if not ext_dep:
 +            raise BuildStateError('No external dep for %s' % self.name)
 +
 +        #print buildscript.config.external_dependencies
 +
 +        available = self.get_available_debian_version(buildscript).split('-')[0]
 +        if ':' in available: # remove epoch
 +            available = available.split(':')[-1]
 +
 +        def lax_int(s):
 +            try:
 +                return int(s)
 +            except ValueError:
 +                return -1
 +
 +        deb_available = [lax_int(x) for x in available.split('.')]
 +        ext_minimum = [lax_int(x) for x in ext_dep.get('minimum').split('.')]
 +        ext_recommended = [lax_int(x) for x in ext_dep.get('recommended').split('.')]
 +
 +        if deb_available >= ext_recommended:
 +            return (self.STATE_DONE, None, None)
 +
 +        if deb_available >= ext_minimum:
 +            # XXX: warn it would be better to have a newer version
 +            return (self.STATE_DONE, None, None)
 +
 +        return (self.STATE_DOWNLOAD, None, None)
 +
 +    
 +    def do_deb_build(self, buildscript):
 +        # gets a debian/ directory
 +        builddir = self.get_builddir(buildscript)
 +        if buildscript.config.buildroot and not os.path.exists(builddir):
 +            os.makedirs(builddir)
 +
 +        if not os.path.exists(os.path.join(builddir, 'debian')):
 +            self.create_a_debian_dir(buildscript)
 +
 +        try:
 +            buildscript.execute('dpkg-checkbuilddeps', cwd = builddir)
 +        except:
 +            debian_name = self.get_debian_name(buildscript)
 +            buildscript.execute(['sudo', 'apt-get', '--yes', 'build-dep', debian_name])
 +
 +        self.deb_version = '%s-0' % self.get_revision()
 +
 +        return Package.do_deb_build(self, buildscript)
 +
  
  def parse_distutils(node, config, uri, repositories, default_repo):
      id = node.getAttribute('id')
diff --cc jhbuild/modtypes/perl.py
index f5b2658,6f18056..276419a
--- a/jhbuild/modtypes/perl.py
+++ b/jhbuild/modtypes/perl.py
@@@ -54,50 -54,9 +54,46 @@@ class PerlModule(Package)
      def get_revision(self):
          return self.branch.branchname
  
 +    def do_start(self, buildscript):
 +        pass
 +    do_start.next_state = STATE_CHECKOUT
 +    do_start.error_states = []
 +
 +    def do_deb_start(self, buildscript):
 +        buildscript.set_action('Starting building', self)
 +        buildscript.execute(['sudo', 'apt-get', 'update'])
 +        ext_dep = buildscript.config.external_dependencies.get(self.name)
 +        if not ext_dep:
 +            raise BuildStateError('No external dep for %s' % self.name)
 +
 +        #print buildscript.config.external_dependencies
 +
 +        available = self.get_available_debian_version(buildscript).split('-')[0]
 +        if ':' in available: # remove epoch
 +            available = available.split(':')[-1]
 +
 +        def lax_int(s):
 +            try:
 +                return int(s)
 +            except ValueError:
 +                return -1
 +
 +        deb_available = [lax_int(x) for x in available.split('.')]
 +        ext_minimum = [lax_int(x) for x in ext_dep.get('minimum').split('.')]
 +        ext_recommended = [lax_int(x) for x in ext_dep.get('recommended').split('.')]
 +
 +        if deb_available >= ext_recommended:
 +            return (self.STATE_DONE, None, None)
 +
 +        if deb_available >= ext_minimum:
 +            # XXX: warn it would be better to have a newer version
 +            raise SkipToState(self.STATE_DONE)
 +    do_deb_start.next_state = STATE_CHECKOUT
 +    do_deb_start.error_states = []
 +
      def do_checkout(self, buildscript):
          self.checkout(buildscript)
-     do_checkout.next_state = STATE_BUILD
-     do_checkout.error_states = [STATE_FORCE_CHECKOUT]
- 
-     def skip_force_checkout(self, buildscript, last_state):
-         return False
+     do_checkout.error_phases = [PHASE_FORCE_CHECKOUT]
  
      def do_force_checkout(self, buildscript):
          buildscript.set_action(_('Checking out'), self)
diff --cc jhbuild/versioncontrol/svn.py
index 62d104e,de3f22b..b31565e
--- a/jhbuild/versioncontrol/svn.py
+++ b/jhbuild/versioncontrol/svn.py
@@@ -100,9 -101,15 +101,16 @@@ def get_uri(filename)
                                % filename)
      return info['url']
  
+ def call_with_info(proc, filename, *keys):
+     info = get_info(filename)
+     try:
+         return proc(*[info[k] for k in keys])
+     except KeyError:
+         return None
+ 
  class SubversionRepository(Repository):
      """A class used to work with a Subversion repository"""
 +    code = 'svn'
  
      init_xml_attrs = ['href', 'trunk-template', 'branches-template', 'tags-template']
  
diff --cc jhbuild/versioncontrol/tarball.py
index e02b708,2b44a58..bd03537
--- a/jhbuild/versioncontrol/tarball.py
+++ b/jhbuild/versioncontrol/tarball.py
@@@ -108,12 -108,8 +109,13 @@@ class TarballBranch(Branch)
          self.patches = []
          self.quilt = None
          self.branch_id = branch_id
+         self.source_subdir = source_subdir
  
 +    def revision_id(self):
 +        return self.version
 +    revision_id = property(revision_id)
 +
 +
      def _local_tarball(self):
          basename = os.path.basename(self.module)
          if not basename:



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