From 6e14fd63cf74c50898e68dee8398fa3222fb2ec5 Mon Sep 17 00:00:00 2001 From: "Yaakov M. Nemoy" Date: Mon, 5 Jan 2009 15:20:09 -0500 Subject: Add sourceball to Darcs --- modules/darcs.py | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'modules/darcs.py') diff --git a/modules/darcs.py b/modules/darcs.py index f15ef6b..add869f 100644 --- a/modules/darcs.py +++ b/modules/darcs.py @@ -22,9 +22,10 @@ import re from contextlib import contextmanager from os import getcwd +from os.path import join from subprocess import Popen, PIPE -from base.util import pwd, log, rm, log_file +from base.util import pwd, log, rm, log_file, copy, move from modules.revisioncontrol import RevisionControl hash_re = re.compile(r'hash=\'(\w|-|.*?)\'', re.MULTILINE) @@ -34,7 +35,10 @@ class Darcs(RevisionControl): _type = 'darcs' def load_dir(self, dir): super(RevisionControl, self).load_dir(dir) - self.vc_url = self.cfg['vc_url'] + + @property + def vc_url(self): + return self.cfg['vc_url'] def source_dir(self, *args): return self.cfg['source'] @@ -65,7 +69,7 @@ class Darcs(RevisionControl): stdout = darcs_out, stderr = darcs_out) log.info('darcs get %s %s, please wait....' % (src, tgt)) p.wait() - self.set_current_head() + self.set_current_head() def checkout(self, tgt, url, *args): self.cfg['vc_url'] = url @@ -116,4 +120,21 @@ class Darcs(RevisionControl): with self.src('--tag', tag): yield + @property + def sourceball(self): + with pwd(self.source_dir()): + name = self.pkg_name + ver = self.ver() + date = self.date + full_name = '%s-%s.%sdarcs' % (name, ver, date) + with log_file('darcs.log') as darcs_out: + p = Popen(['darcs', 'dist', '-d', full_name, + '--repodir', self.source_dir()], + stdout=darcs_out, stderr=darcs_out) + log.info('generating tarball %s.tar.gz, please wait...' % full_name) + p.wait() + sourceball = full_name + 'tar.gz' + mv(join(self.source_dir(), sourceball), sourceball) + return sourceball + __all__ = ['Darcs'] -- cgit