From 79577f7d35ba8cff9ba7a1f97d8bae8bab1b001f Mon Sep 17 00:00:00 2001 From: "Yaakov M. Nemoy" Date: Mon, 5 Jan 2009 17:21:12 -0500 Subject: refactoring for bugfixes turns out that we can't have a property also be an important method in our current method of parsing. also, sourceball is really a package idiom, and belongs there finally, i misnamed something earlier --- base/base.py | 1 - modules/darcs.py | 38 +++++++++++++++++++++----------------- modules/package.py | 10 +++++++--- modules/sourceball.py | 3 --- 4 files changed, 28 insertions(+), 24 deletions(-) diff --git a/base/base.py b/base/base.py index 4ce3d25..ca3cb8d 100644 --- a/base/base.py +++ b/base/base.py @@ -139,7 +139,6 @@ def do_command(data, top=None): # stack and check if it has the 'bar' attribute. If so, we call # it with any remaining arguments data = deque(data) - log.debug(data) params = [] module = None diff --git a/modules/darcs.py b/modules/darcs.py index add869f..552e9b5 100644 --- a/modules/darcs.py +++ b/modules/darcs.py @@ -120,21 +120,25 @@ 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 - + + def setup_sourceball(self): + log.debug('someone set us up the bomb') + with pwd(self.dir): + with pwd(self.source_dir()): + name = self.pkg_name + ver = self.ver() + date = self.date + full_name = '%s-%s.%sdarcs' % (name, ver, date) + log.debug('full name is ' + full_name) + with log_file('darcs.log') as darcs_out: + log.debug('we get signal') + p = Popen(['darcs', 'dist', '-d', full_name], + stdout=darcs_out, stderr=darcs_out) + log.info('generating tarball %s.tar.gz, please wait...' + % full_name) + p.wait() + sourceball = full_name + '.tar.gz' + move(join(self.source_dir(), sourceball), sourceball) + self.cfg['sourceball'] = sourceball + __all__ = ['Darcs'] diff --git a/modules/package.py b/modules/package.py index 47f9803..d123446 100644 --- a/modules/package.py +++ b/modules/package.py @@ -64,15 +64,15 @@ class Package(Directory): return self.cfg['dir'] @property - def pkg_dir(self): - return self.cfg['pkg_dir'] + def pkg_name(self): + return self.cfg['pkg_name'] def get_srpm_name(self, profile): with pwd(self.code_dir): ver, rel = ver_rel(self.spec_file, profile.dist_defines()) return '%s-%s-%s.src.rpm' % (self.pkg_name, ver, rel) - def ver(self, profile): + def ver(self, profile=None): with pwd(self.dir): ver, rel = ver_rel(self.spec_file, profile.dist_defines() if profile else '') return ver @@ -80,4 +80,8 @@ class Package(Directory): def source_dir(self, *args): raise NotImplementedError + @property + def sourceball(self): + return self.cfg['sourceball'] + __all__ = ['Package'] diff --git a/modules/sourceball.py b/modules/sourceball.py index 5213433..8364eda 100644 --- a/modules/sourceball.py +++ b/modules/sourceball.py @@ -65,8 +65,5 @@ class SourceBall(Package): raise ExecutionException(e, 'something went wrong') #TODO: figure out what exceptions TarFile will throw - @property - def sourceball(self): - return self.cfg['sourceball'] __all__ = ['SourceBall'] -- cgit