+ # if asked to do so, wait
+ if waitAfterConfig:
+ raw_input('Configuration done. Hit "Enter" to build the project. ')
+ # run compilation
+ subprocess.check_call(self.config.get('buildCmdPrefix', []) + ['make', '-j'+str(self.config['jobs'])])
+ # run installation
+ subprocess.check_call(self.config.get('installCmdPrefix', []) + ['make', 'install'])
+
+# if auto-debuild is available, provide a wrapper for it
+try:
+ import auto_debuild
+ class AutoDebuild:
+ def __init__(self, sourceFolder, buildFolder, config, vcs):
+ self.sourceFolder = os.path.abspath(sourceFolder)
+ self.buildFolder = os.path.abspath(buildFolder)
+ self.debFolder = os.path.abspath(config['debDir'])
+ self.config = config
+ self.vcs = vcs
+
+ def build(self, reconfigure, waitAfterConfig): # 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'],
+ 'debDir': self.debFolder,
+ 'buildDir': self.buildFolder,
+ 'name': self.config['debName'],
+ 'email': self.config['debEMail'],
+ 'parallelJobs': self.config['jobs'],
+ 'version': versionName,
+ 'waitAfterConfig': waitAfterConfig,
+ }
+ if autoDebuildConfig['version'] is None:
+ raise Exception("VCS did not provide us with a proper version number, please fix this")
+ # copy some more optional configuration
+ for option in ('dbgPackage', 'section', 'withPython2', 'binarySkipFiles', 'binaryInstallFiles',
+ 'buildDepends', 'binaryDepends', 'binaryRecommends', 'binaryProvides', 'binaryConflicts', 'binaryBreaks',
+ 'binaryReplaces', 'binaryBreaksReplaces',
+ 'alternatives', 'cmakeParameters', 'automakeParameters'):
+ if option in self.config:
+ autoDebuildConfig[option] = self.config[option]
+ # create Debian files
+ os.chdir(self.sourceFolder)
+ if os.path.isdir('debian'): # clean previous build attempts
+ shutil.rmtree('debian')
+ files = auto_debuild.createDebianFiles(autoDebuildConfig)
+ # build package(s)
+ auto_debuild.buildDebianPackage(autoDebuildConfig)
+ # install package(s)
+ if self.config.get('debInstall', True):
+ subprocess.check_call(['sudo', 'dpkg', '--install'] + files)
+
+except ImportError:
+ #print "auto_debuild not found, disabling auto-debuild system"
+ pass