X-Git-Url: https://scripts.mit.edu/gitweb/wizard.git/blobdiff_plain/ae04af9f80d56e499339ef2aae6ce0e1e9da6824..cb6160df90dfcfa857e5f093fee6ab24f56755ce:/wizard/deploy.py diff --git a/wizard/deploy.py b/wizard/deploy.py index e591d36..89f8232 100644 --- a/wizard/deploy.py +++ b/wizard/deploy.py @@ -174,6 +174,17 @@ class Deployment(object): if not self.configured: raise NotConfiguredError(self.location) + def verifyVersion(self): + """ + Checks if our version and the version number recorded in a file + are consistent. + """ + real = self.application.detectVersion(self) + if not real: + raise VersionDetectionError + elif not str(real) == self.app_version.pristine_tag.partition('-')[2]: + raise VersionMismatchError(real, self.version) + @property def configured(self): """Whether or not an autoinstall has been configured/installed for use.""" @@ -340,6 +351,11 @@ class Application(object): non-versioned data in an application. """ raise NotImplemented + def detectVersion(self, deployment): + """ + Checks source files to determine the version manually. + """ + return None @property def extractors(self): """ @@ -582,6 +598,22 @@ ERROR: HEAD is not a descendant of %s. This probably means that an upstream rebase occurred, and new tags were pulled, but local user commits were never rebased.""" % self.tag +class VersionDetectionError(Error): + def __str__(self): + return """ + +ERROR: Could not detect the real version of the application.""" + +class VersionMismatchError(Error): + def __init__(self, real_version, git_version): + self.real_version = real_version + self.git_version = git_version + def __str__(self): + return """ + +ERROR: The detected version %s did not match the Git +version %s.""" % (self.real_version, self.git_version) + _application_list = [ "mediawiki", "wordpress", "joomla", "e107", "gallery2", "phpBB", "advancedbook", "phpical", "trac", "turbogears", "django",