From: Ralf Jung Date: Fri, 17 Aug 2012 10:31:02 +0000 (+0200) Subject: Make overriding the version name independant of VCS; submodule support for git X-Git-Url: https://git.ralfj.de/mass-build.git/commitdiff_plain/02d6ae3b48b56e1b830239099fa485669fae52e5 Make overriding the version name independant of VCS; submodule support for git --- diff --git a/build_system.py b/build_system.py index 8325aed..aa59299 100644 --- a/build_system.py +++ b/build_system.py @@ -42,6 +42,7 @@ try: def build(self, reconfigure=False): # reconfigure is ignored (we always do a reconfiguration) # create auto-debuild configuration + versionName = self.config['versionName'] if 'versionName' in self.config else self.vcs.version() autoDebuildConfig = { 'sourceName': self.config['name'], 'buildSystem': self.config['buildSystem'], @@ -50,7 +51,7 @@ try: 'name': self.config['debName'], 'email': self.config['debEMail'], 'parallelJobs': self.config['jobs'], - 'version': self.vcs.version(), + 'version': versionName, } if autoDebuildConfig['version'] is None: raise Exception("VCS did not provide us with a proper version number, please fix this") diff --git a/mass_build.py b/mass_build.py index 6bbba4c..385749f 100755 --- a/mass_build.py +++ b/mass_build.py @@ -13,7 +13,7 @@ class Project: if vcsName == 'git': self.vcs = vcs.Git(self.sourceFolder(), config['url'], config['version']) elif vcsName == 'svn': - self.vcs = vcs.SVN(self.sourceFolder(), config['url'], config.get('versionName')) + self.vcs = vcs.SVN(self.sourceFolder(), config['url']) else: raise Exception("Unknown VCS type "+vcsName) # build system @@ -107,7 +107,7 @@ if args.projects: elif name in allFolders: workProjects += allFolders[name] else: - raise Exception("Project or folder%s does not exist" % name) + raise Exception("Project or folder %s does not exist" % name) elif args.resume_from is None: workProjects = projects.values() # all the projects else: diff --git a/vcs.py b/vcs.py index d20ebeb..785a9ba 100644 --- a/vcs.py +++ b/vcs.py @@ -1,6 +1,6 @@ import os, git, subprocess -'''A VCS must have an "update" method with an optional "forceVersion" parameter, and a "version" method.''' +'''A VCS must have an "update" method with an optional "forceVersion" parameter, and optionally a "version" method.''' # Fetch updates from git class Git: @@ -45,6 +45,9 @@ class Git: repo.head.reset(self.commit, working_tree=True) else: repo.git.rebase(self.commit) + # update submodules + repo.git.submodule("update", "--init", "--recursive", "--rebase") + # done print "...done", if repo.head.reference.commit != repo.commit(self.commit): print "(keeping local patches around)", @@ -58,10 +61,9 @@ class Git: # Fetch updates via SVN class SVN: - def __init__(self, folder, url, versionName): + def __init__(self, folder, url): self.folder = os.path.abspath(folder) self.url = url - self.versionName = versionName def update(self, forceVersion=False): if os.path.exists(self.folder): @@ -70,6 +72,3 @@ class SVN: subprocess.check_call(['svn', 'switch', self.url]) # and update to the URL we got else: subprocess.check_call(['svn', 'co', self.url, self.folder]) # just download it - - def version(self): - return self.versionName