diff options
author | Yaakov M. Nemoy <loupgaroublond@gmail.com> | 2009-01-05 15:20:09 -0500 |
---|---|---|
committer | Yaakov M. Nemoy <loupgaroublond@gmail.com> | 2009-01-05 15:20:09 -0500 |
commit | 6e14fd63cf74c50898e68dee8398fa3222fb2ec5 (patch) | |
tree | 20f27fb863b8a5cf48bc63870391b4a10d677822 /modules/darcs.py | |
parent | de3320e82e5a14fe54ebb27a0ef0c0cb381128f4 (diff) | |
download | fedora-devshell-6e14fd63cf74c50898e68dee8398fa3222fb2ec5.tar.gz fedora-devshell-6e14fd63cf74c50898e68dee8398fa3222fb2ec5.tar.xz fedora-devshell-6e14fd63cf74c50898e68dee8398fa3222fb2ec5.zip |
Add sourceball to Darcs
Diffstat (limited to 'modules/darcs.py')
-rw-r--r-- | modules/darcs.py | 27 |
1 files changed, 24 insertions, 3 deletions
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'] |