From 3d02771f3e2376cd459e9a4d0edf2ff0c0f22b2c Mon Sep 17 00:00:00 2001 From: "Yaakov M. Nemoy" Date: Mon, 29 Dec 2008 23:11:03 -0500 Subject: Some profile stuff --- base/vars.py | 5 ++++- modules/build.py | 30 ++++++++++++++++++++---------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/base/vars.py b/base/vars.py index 1e8ec20..5eddfeb 100644 --- a/base/vars.py +++ b/base/vars.py @@ -7,4 +7,7 @@ FEDORA_DIR = join(expanduser('~'), 'code') DEVSHELL_DIR = join(expanduser('~'), '.devshell') header = lambda x: "%s %s %s" % ('=' * 2, x, '=' * (76 - len(x))) -prompt = ['\033[34;1mfedora\033[0m'] \ No newline at end of file +prompt = ['\033[34;1mfedora\033[0m'] + +orig_src_dir = '_orig' +haskell_compiler = 'ghc' diff --git a/modules/build.py b/modules/build.py index 99c05ea..2b5d6e0 100644 --- a/modules/build.py +++ b/modules/build.py @@ -1,7 +1,7 @@ from __future__ import with_statement from shutil import copyfileobj -from os.path import join, abspath +from os.path import join, abspath, isfile from os import listdir, getcwd, walk from subprocess import Popen @@ -10,6 +10,7 @@ from base.module import Module from base.util import pwd, copy, symlink, move from base.exceptions import ExecutionException from base.vars import FEDORA_DIR +from base.profiles import dir_defines, join_defines, dist_defines, Profile from modules.package import Package @@ -42,20 +43,27 @@ class Build(Module): def build_source_rpm(self, target_dir=None): self.rpmbuild('-bs', target_dir) - def rpmbuild(self, param, target_dir=None): + def rpmbuild(self, param, target_dir=None, profile=None): if not target_dir: if self.target_dir: target_dir = self.target_dir else: raise ExecutionException(None, 'no Target Dir specified') + if profile: + defines = join_defines(profile.dist_defines, + dir_defines(target_dir)) + else: + defines = dir_defines(target_dir) with pwd(self.pkg.code_dir): - rpm_out = file('rpmbuild.log', 'w') - with pwd(join(target_dir, 'SPECS')): - p = Popen(['rpmbuild', param, self.name + '.spec'], - stdout=rpm_out, stderr=rpm_out) - log.info('quick compiling %s... please wait' % self.name) - p.wait() - rpm_out.close() + with file('rpmbuild.log', 'w') as rpm_out: + with pwd(join(target_dir, 'SPECS')): + p = Popen(['rpmbuild', + defines, param, + self.name + '.spec'], + stdout=rpm_out, stderr=rpm_out) + log.info('building %s... please wait' % \ + self.pkg.spec_file()) + p.wait() def fetch_rpms(self, target_dir=None): if not target_dir: @@ -78,6 +86,8 @@ class Build(Module): with pwd(target_dir): source = self.pkg.pkg_cfg['source'] move(join('BUILD', source), join(self.pkg.code_dir, 'results')) - + def close(self): self.pkg.close() + +__all__ = ['Build'] \ No newline at end of file -- cgit