From 94e4032c8119b17b9de0af39eae983127d640461 Mon Sep 17 00:00:00 2001 From: "Yaakov M. Nemoy" Date: Sun, 18 Jan 2009 21:38:15 -0500 Subject: Add gen spec function to the cabal build system --- modules/buildsystem.py | 3 +++ modules/cabal.py | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/modules/buildsystem.py b/modules/buildsystem.py index 254b726..dbedbfc 100644 --- a/modules/buildsystem.py +++ b/modules/buildsystem.py @@ -52,3 +52,6 @@ class BuildSystem(Module): '''perform configure, build, and install steps in one ''' raise NotImplementedError + + def gen_spec(self): + raise NotImplementedError diff --git a/modules/cabal.py b/modules/cabal.py index 4ddea87..a993326 100644 --- a/modules/cabal.py +++ b/modules/cabal.py @@ -94,7 +94,7 @@ class Cabal(BuildSystem): + (['--user', '--prefix=' + expanduser('~')] if user else []) p = Popen(cmd, stdout=cabal_out, stderr=cabal_out) log.info('Configuring %s, please wait...' % self.name) - p.wait() + p.communicate() def build(self, *args): '''runs the build stage of cabal @@ -111,7 +111,7 @@ class Cabal(BuildSystem): cmd = [abspath('Setup'), 'build'] p = Popen(cmd, stdout=cabal_out, stderr=cabal_out) log.info('Building %s, please wait...' % self.name) - p.wait() + p.communicate() def install(self, *args): '''runs the install stage of cabal @@ -128,7 +128,7 @@ class Cabal(BuildSystem): cmd = [abspath('Setup'), 'install'] p = Popen(cmd, stdout=cabal_out, stderr=cabal_out) log.info('Building %s, please wait...' % self.name) - p.wait() + p.communicate() def install_source(self, target='home', *args): '''perform configure, build, and install steps in one @@ -138,6 +138,16 @@ class Cabal(BuildSystem): self.build(orig) self.install(orig) + def gen_spec(self): + cabal_file = self.pkg_src.hackage_name + '.spec' + with pwd(self.pkg_src.pkg_src_dir): + with log_file('cabal2spec.log') as c2s_log: + with pwd(self.pkg_src.dir): + cmd = ['cabal2spec', cabal_file] + p = Popen(cmd, stdout=c2s_log, stderr=c2s_log) + log.info('Generating spec file for %s' % cabal_file) + p.communicate() + def close(self): self.pkg_src.close() -- cgit