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
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':
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:
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)