[jhbuild/jhdebuild: 522/536] [jhdebuild] States are gone. Phases and deps ftw.



commit 5e6bee403708a498afe5c752ecee3fa554ffbf3b
Author: John Carr <john carr unrouted co uk>
Date:   Sun May 17 14:29:11 2009 +0100

    [jhdebuild] States are gone. Phases and deps ftw.
---
 jhbuild/modtypes/__init__.py  |   12 ++++--------
 jhbuild/modtypes/autotools.py |   28 +++++++++-------------------
 jhbuild/modtypes/debian.py    |   18 +++++++-----------
 jhbuild/modtypes/perl.py      |    6 ++----
 4 files changed, 22 insertions(+), 42 deletions(-)

diff --git a/jhbuild/modtypes/__init__.py b/jhbuild/modtypes/__init__.py
index 5a65fca..cdcb72c 100644
--- a/jhbuild/modtypes/__init__.py
+++ b/jhbuild/modtypes/__init__.py
@@ -339,8 +339,7 @@ class Package:
                 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 = []
+    do_deb_start.error_phases = []
 
     def skip_deb_apt_get_update(self, buildscript, last_state):
         return False
@@ -352,8 +351,7 @@ class Package:
                 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 = []
+    do_deb_apt_get_update.error_phases = []
 
     def skip_deb_build_deps(self, buildscript, last_state):
         return False
@@ -371,8 +369,7 @@ class Package:
                 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 = []
+    do_deb_build_deps.error_phases = []
 
     def xml_tag_and_attrs(self):
         """Return a (tag, attrs) pair, describing how to serialize this
@@ -430,8 +427,7 @@ class MetaModule(Package):
 
     def do_deb_start(self, buildscript):
         pass
-    do_deb_start.next_state = Package.STATE_DONE
-    do_deb_start.error_states = []
+    do_deb_start.error_phases = []
 
 
 def parse_metamodule(node, config, url, repos, default_repo):
diff --git a/jhbuild/modtypes/autotools.py b/jhbuild/modtypes/autotools.py
index cd4c646..2e9532c 100644
--- a/jhbuild/modtypes/autotools.py
+++ b/jhbuild/modtypes/autotools.py
@@ -86,8 +86,7 @@ class AutogenModule(Package, DebianBasePackage):
 
     def do_checkout(self, buildscript):
         self.checkout(buildscript)
-    do_checkout.next_state = STATE_CONFIGURE
-    do_checkout.error_states = [STATE_FORCE_CHECKOUT]
+    do_checkout.error_phases = [STATE_FORCE_CHECKOUT]
     do_deb_checkout = do_checkout
 
     def skip_force_checkout(self, buildscript, last_state):
@@ -258,13 +257,11 @@ class AutogenModule(Package, DebianBasePackage):
 
     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 = []
+    do_deb_build_deps.error_phases = []
 
     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]
+    do_deb_build_package.error_phases = [DebianBasePackage.STATE_TAR_X, STATE_DIST]
 
     def skip_install(self, buildscript, last_state):
         return buildscript.config.nobuild
@@ -287,9 +284,7 @@ class AutogenModule(Package, DebianBasePackage):
         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 = []
+    do_install.error_phases = []
     
     def get_version(self, buildscript):
         version = get_cached_value('version-%s-%s' % (self.name, self.branch.revision_id))
@@ -308,13 +303,11 @@ class AutogenModule(Package, DebianBasePackage):
     
     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 = []
+    do_deb_apt_get_update.error_phases = []
 
     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 = []
+    do_deb_checkout.error_phases = []
 
     skip_deb_force_checkout = skip_force_checkout
     do_deb_force_checkout = do_force_checkout
@@ -381,8 +374,7 @@ class AutogenModule(Package, DebianBasePackage):
                 raise SkipToState(self.STATE_DONE)
         except:
             pass
-    do_deb_dist.next_state = DebianBasePackage.STATE_TAR_X
-    do_deb_dist.error_states = []
+    do_deb_dist.error_phases = []
 
     def get_distdir(self, buildscript):
         tarball_dir = self.get_tarball_dir(buildscript)
@@ -417,16 +409,14 @@ class AutogenModule(Package, DebianBasePackage):
             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 = []
+    do_deb_tar_x.error_phases = []
 
     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 = []
+    do_force_clean.error_phases = []
 
     def skip_force_distclean(self, buildscript, last_state):
         return False
diff --git a/jhbuild/modtypes/debian.py b/jhbuild/modtypes/debian.py
index 0115182..05bd147 100644
--- a/jhbuild/modtypes/debian.py
+++ b/jhbuild/modtypes/debian.py
@@ -19,11 +19,11 @@ class DebianBasePackage:
     def do_deb_build_deps(self, buildscript):
         if os.path.exists(self.get_tarball_dir(buildscript)):
             buildscript.message('%s already has a tarball' % self.name)
-            next_state = self.STATE_TAR_X
+            next_phase = self.STATE_TAR_X
         else:
-            next_state = self.STATE_CONFIGURE
+            next_phase = self.STATE_CONFIGURE
         Package.do_deb_build_deps(self, buildscript)
-        raise SkipToState(next_state)
+        raise SkipToState(next_phase)
 
 
     def skip_deb_debian_dir(self, buildscript, last_state):
@@ -100,8 +100,7 @@ class DebianBasePackage:
                             [x for x in series if not filename in x]))
 
         os.chmod(os.path.join(builddebdir, distdir, 'debian', 'rules'), 0755)
-    do_deb_debian_dir.next_state = STATE_BUILD_PACKAGE
-    do_deb_debian_dir.error_states = []
+    do_deb_debian_dir.error_phases = []
 
     def skip_deb_build_package(self, buildscript, next_state):
         builddebdir = self.get_builddebdir(buildscript)
@@ -151,8 +150,7 @@ class DebianBasePackage:
 
         buildscript.execute(['dpkg-buildpackage','-rfakeroot', '-us', '-uc', '-D'],
                 cwd = builddebdir)
-    do_deb_build_package.next_state = STATE_DINSTALL
-    do_deb_build_package.error_states = [STATE_DEBIAN_DIR]
+    do_deb_build_package.error_phases = [STATE_DEBIAN_DIR]
 
     def get_changes_file(self, buildscript):
         debian_name = self.get_debian_name(buildscript)
@@ -195,8 +193,7 @@ class DebianBasePackage:
                 files.append(os.path.join(builddebdir, line.split()[-1]))
         for f in files:
             os.unlink(f)
-    do_deb_dinstall.next_state = STATE_UPGRADE
-    do_deb_dinstall.error_states = []
+    do_deb_dinstall.error_phases = []
 
     def skip_deb_upgrade(self, buildscript, last_state):
         return False
@@ -206,8 +203,7 @@ class DebianBasePackage:
         if not buildscript.config.nonetwork:
             buildscript.execute(['sudo', 'apt-get', 'update'])
             buildscript.execute(['sudo', 'apt-get', '--yes', 'upgrade'])
-    do_deb_upgrade.next_state = Package.STATE_DONE
-    do_deb_upgrade.error_states = []
+    do_deb_upgrade.error_phases = []
 
     def get_version(self, buildscript):
         raise NotImplementedError
diff --git a/jhbuild/modtypes/perl.py b/jhbuild/modtypes/perl.py
index 276419a..80e89a6 100644
--- a/jhbuild/modtypes/perl.py
+++ b/jhbuild/modtypes/perl.py
@@ -56,8 +56,7 @@ class PerlModule(Package):
 
     def do_start(self, buildscript):
         pass
-    do_start.next_state = STATE_CHECKOUT
-    do_start.error_states = []
+    do_start.error_phases = []
 
     def do_deb_start(self, buildscript):
         buildscript.set_action('Starting building', self)
@@ -88,8 +87,7 @@ class PerlModule(Package):
         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 = []
+    do_deb_start.error_phases = []
 
     def do_checkout(self, buildscript):
         self.checkout(buildscript)



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