From: Ralf Jung Date: Fri, 27 Jul 2012 12:08:44 +0000 (+0200) Subject: First working prototype of auto-debuild integration X-Git-Url: https://git.ralfj.de/mass-build.git/commitdiff_plain/b28ea6ce8fa02244729a4c3a8822a07d901d99a8 First working prototype of auto-debuild integration --- diff --git a/build_system.py b/build_system.py index 073d432..5634f9d 100644 --- a/build_system.py +++ b/build_system.py @@ -37,16 +37,32 @@ class CMake: try: import auto_debuild class AutoDebuild: - def __init__(self, sourceFolder, module): - self.autoDebuildConfig = {} + def __init__(self, sourceFolder, module, vcs, config): + self.sourceFolder = os.path.abspath(sourceFolder) + self.autoDebuildConfig = { + 'sourceName': module['name'], + 'debDir': os.path.abspath(config['debDir']), + 'buildSystem': module.get('build-system', 'cmake'), + } + self.vcs = vcs + self.configured = False # make sure configure is called before build/install def configure(self, force=False): # force is ignored + self.autoDebuildConfig['version'] = self.vcs.version() # by now, data has been fetched, so this is possible + os.chdir(self.sourceFolder) + print self.sourceFolder,self.autoDebuildConfig self.files = auto_debuild.createDebianFiles(self.autoDebuildConfig) + self.configured = True def build(self): + if not self.configured: self.configure() + os.chdir(self.sourceFolder) auto_debuild.buildDebianPackage(self.autoDebuildConfig) def install(self): + if not self.configured: self.configure() + os.chdir(self.sourceFolder) subprocess.check_call(['sudo', 'dpkg', '--install'] + self.files) except ImportError: + print "auto_debuild not found, disabling auto-debuild system" pass diff --git a/kdebuildpy.py b/kdebuildpy.py index bf2f2a3..4363bd4 100755 --- a/kdebuildpy.py +++ b/kdebuildpy.py @@ -42,7 +42,7 @@ class Project: raise Exception("Unknown VCS type "+vcsName) # build system if config.get('buildDeb', False): - self.buildSystem = build_system.AutoDebuild(self.sourceFolder(), module) + self.buildSystem = build_system.AutoDebuild(self.sourceFolder(), module, self.vcs, config) else: buildSystemName = module.get('build-system', 'cmake') if buildSystemName == 'cmake': diff --git a/vcs.py b/vcs.py index a810d35..893a75f 100644 --- a/vcs.py +++ b/vcs.py @@ -8,11 +8,11 @@ class Git: self.folder = os.path.abspath(folder) self.url = url self.commit = commit - + class _ProgressPrinter(git.remote.RemoteProgress): def update(self, op_code, cur_count, max_count=None, message=''): print self._cur_line+(" "*30)+"\r", - + def update(self): isBranch = (self.commit.startswith('origin/')) if isBranch: @@ -46,6 +46,12 @@ class Git: print "(keeping local patches around)", print + def version(self): + repo = git.Repo(self.folder) + v = repo.git.describe() + if v.startswith('v'): v = v[1:] + return v + class KDEGit(Git): def __init__(self, folder, name, commit): Git.__init__(self, folder, 'kde:'+name, commit)