[jhbuild/jhdebuild: 525/536] [jhdebuild] Use SkipToEnd instead of SkipToState



commit 7fdb3d8503eec08347f027006ac02519afab8c27
Author: John Carr <john carr unrouted co uk>
Date:   Sun May 17 16:54:12 2009 +0100

    [jhdebuild] Use SkipToEnd instead of SkipToState
---
 jhbuild/modtypes/__init__.py  |    6 +++---
 jhbuild/modtypes/autotools.py |    4 ++--
 jhbuild/modtypes/debian.py    |   16 ++++++----------
 jhbuild/modtypes/perl.py      |    6 +++---
 4 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/jhbuild/modtypes/__init__.py b/jhbuild/modtypes/__init__.py
index cdcb72c..1d3164a 100644
--- a/jhbuild/modtypes/__init__.py
+++ b/jhbuild/modtypes/__init__.py
@@ -328,17 +328,17 @@ class Package:
             if deb_available >= ext_recommended:
                 buildscript.message('external dependency, available')
                 if not buildscript.config.build_external_deps == 'always':
-                    raise SkipToState(self.STATE_DONE)
+                    raise SkipToEnd()
 
             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)
+                    raise SkipToEnd()
             else:
                 buildscript.message('external dependency, no version high enough')
                 if buildscript.config.build_external_deps == 'never':
-                    raise SkipToState(self.STATE_DONE)
+                    raise SkipToEnd()
     do_deb_start.error_phases = []
 
     def skip_deb_apt_get_update(self, buildscript, last_state):
diff --git a/jhbuild/modtypes/autotools.py b/jhbuild/modtypes/autotools.py
index 2e9532c..b4a5cdc 100644
--- a/jhbuild/modtypes/autotools.py
+++ b/jhbuild/modtypes/autotools.py
@@ -26,7 +26,7 @@ import stat
 
 from jhbuild.errors import FatalError, BuildStateError, CommandError
 from jhbuild.modtypes import \
-     Package, get_dependencies, get_branch, register_module_type, SkipToState
+     Package, get_dependencies, get_branch, register_module_type, SkipToEnd
 from jhbuild.modtypes.debian import DebianBasePackage
 
 from jhbuild.utils.cache import get_cached_value, write_cached_value
@@ -371,7 +371,7 @@ class AutogenModule(Package, DebianBasePackage):
             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)
+                raise SkipToEnd()
         except:
             pass
     do_deb_dist.error_phases = []
diff --git a/jhbuild/modtypes/debian.py b/jhbuild/modtypes/debian.py
index b3f3b86..15e320e 100644
--- a/jhbuild/modtypes/debian.py
+++ b/jhbuild/modtypes/debian.py
@@ -5,7 +5,7 @@ import apt_pkg
 
 from jhbuild.errors import FatalError, CommandError, BuildStateError
 
-from jhbuild.modtypes import Package, SkipToState
+from jhbuild.modtypes import Package
 from jhbuild.utils import debian
 
 class DebianBasePackage:
@@ -16,15 +16,11 @@ class DebianBasePackage:
     STATE_DINSTALL       = 'dinstall'
     STATE_UPGRADE        = 'upgrade'
 
-    def do_deb_build_deps(self, buildscript):
+    def skip_deb_tar_x(self, buildscript, last_state):
         if os.path.exists(self.get_tarball_dir(buildscript)):
             buildscript.message('%s already has a tarball' % self.name)
-            next_phase = self.STATE_TAR_X
-        else:
-            next_phase = self.STATE_CONFIGURE
-        Package.do_deb_build_deps(self, buildscript)
-        raise SkipToState(next_phase)
-
+            return True
+        return False
 
     def skip_deb_debian_dir(self, buildscript, last_state):
         return False
@@ -103,7 +99,7 @@ class DebianBasePackage:
     do_deb_debian_dir.error_phases = []
     do_deb_debian_dir.depends = [STATE_TAR_X]
 
-    def skip_deb_build_package(self, buildscript, next_state):
+    def skip_deb_build_package(self, buildscript, last_state):
         builddebdir = self.get_builddebdir(buildscript)
         changes_file = self.get_changes_file(buildscript)
         if changes_file and os.path.exists(os.path.join(builddebdir, changes_file)):
@@ -166,7 +162,7 @@ class DebianBasePackage:
             return None
         return changes_file[0]
 
-    def skip_deb_dinstall(self, buildscript, next_state):
+    def skip_deb_dinstall(self, buildscript, last_state):
         version = debian.get_version(buildscript, self.get_debian_name(buildscript))
         if version == self.get_debian_version(buildscript):
             return True
diff --git a/jhbuild/modtypes/perl.py b/jhbuild/modtypes/perl.py
index 80e89a6..9d29913 100644
--- a/jhbuild/modtypes/perl.py
+++ b/jhbuild/modtypes/perl.py
@@ -22,7 +22,7 @@ __metaclass__ = type
 import os
 import re
 
-from jhbuild.errors import BuildStateError
+from jhbuild.errors import BuildStateError, SkipToEnd
 from jhbuild.modtypes import \
      Package, get_dependencies, get_branch, register_module_type
 
@@ -82,11 +82,11 @@ class PerlModule(Package):
         ext_recommended = [lax_int(x) for x in ext_dep.get('recommended').split('.')]
 
         if deb_available >= ext_recommended:
-            return (self.STATE_DONE, None, None)
+            raise SkipToEnd()
 
         if deb_available >= ext_minimum:
             # XXX: warn it would be better to have a newer version
-            raise SkipToState(self.STATE_DONE)
+            raise SkipToEnd()
     do_deb_start.error_phases = []
 
     def do_checkout(self, buildscript):



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