diff options
author | Sebastian Dröge <slomo@circular-chaos.org> | 2013-07-14 19:00:11 +0200 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2013-07-14 19:00:11 +0200 |
commit | ad807656ecf9bb66cae7ac8de0391561004cbaba (patch) | |
tree | 2fccaecde02a2906d525d1bd755c4a9023132fd9 | |
parent | 3f3bb297a0f0c04359c21b25d6bdffd591c285b0 (diff) | |
parent | 512113a8c65e18c2e11dca74fd47b8a1a811befe (diff) |
Merge branch 'master' into upstream-1.0
-rw-r--r-- | cerbero/build/oven.py | 3 | ||||
-rw-r--r-- | cerbero/commands/build.py | 12 | ||||
-rw-r--r-- | cerbero/utils/shell.py | 17 | ||||
-rw-r--r-- | recipes/gtk-doc-lite.recipe | 5 |
4 files changed, 26 insertions, 11 deletions
diff --git a/cerbero/build/oven.py b/cerbero/build/oven.py index b73c48a..a76582a 100644 --- a/cerbero/build/oven.py +++ b/cerbero/build/oven.py @@ -45,7 +45,7 @@ class Oven (object): STEP_TPL = '[(%s/%s) %s -> %s ]' def __init__(self, recipes, cookbook, force=False, no_deps=False, - missing_files=False): + missing_files=False, dry_run=False): if isinstance(recipes, Recipe): recipes = [recipes] self.recipes = recipes @@ -53,6 +53,7 @@ class Oven (object): self.force = force self.no_deps = no_deps self.missing_files = missing_files + shell.DRY_RUN = dry_run def start_cooking(self): ''' diff --git a/cerbero/commands/build.py b/cerbero/commands/build.py index 3ea9ffa..a0c62f9 100644 --- a/cerbero/commands/build.py +++ b/cerbero/commands/build.py @@ -35,7 +35,10 @@ class Build(Command): ArgparseArgument('--missing-files', action='store_true', default=False, help=_('prints a list of files installed that are ' - 'listed in the recipe'))] + 'listed in the recipe')), + ArgparseArgument('--dry-run', action='store_true', + default=False, + help=_('only print commands instead of running them '))] if force is None: args.append( ArgparseArgument('--force', action='store_true', @@ -58,15 +61,16 @@ class Build(Command): if self.no_deps is None: self.no_deps = args.no_deps self.runargs(config, args.recipe, args.missing_files, self.force, - self.no_deps) + self.no_deps, dry_run=args.dry_run) def runargs(self, config, recipes, missing_files=False, force=False, - no_deps=False, cookbook=None): + no_deps=False, cookbook=None, dry_run=False): if cookbook is None: cookbook = CookBook(config) oven = Oven(recipes, cookbook, force=self.force, - no_deps=self.no_deps, missing_files=missing_files) + no_deps=self.no_deps, missing_files=missing_files, + dry_run=dry_run) oven.start_cooking() diff --git a/cerbero/utils/shell.py b/cerbero/utils/shell.py index 8e23216..46e3240 100644 --- a/cerbero/utils/shell.py +++ b/cerbero/utils/shell.py @@ -30,6 +30,7 @@ import shutil from cerbero.enums import Platform from cerbero.utils import _, system_info, to_unixpath +from cerbero.utils import messages as m from cerbero.errors import FatalError @@ -39,6 +40,7 @@ TAR = 'tar' PLATFORM = system_info()[0] LOGFILE = None # open('/tmp/cerbero.log', 'w+') +DRY_RUN = False class StdOut: @@ -76,7 +78,7 @@ def call(cmd, cmd_dir='.', fail=True): @type fail: bool ''' try: - logging.info("Running command '%s'" % cmd) + m.message("Running command '%s'" % cmd) shell = True if PLATFORM == Platform.WINDOWS: # windows do not understand ./ @@ -89,10 +91,15 @@ def call(cmd, cmd_dir='.', fail=True): # Disable shell which uses cmd.exe shell = False stream = LOGFILE or sys.stdout - ret = subprocess.check_call(cmd, cwd=cmd_dir, - stderr=subprocess.STDOUT, - stdout=StdOut(stream), - env=os.environ.copy(), shell=shell) + if DRY_RUN: + # write to sdterr so it's filtered more easilly + m.error ("cd %s && %s && cd %s" % (cmd_dir, cmd, os.getcwd())) + ret = 0 + else: + ret = subprocess.check_call(cmd, cwd=cmd_dir, + stderr=subprocess.STDOUT, + stdout=StdOut(stream), + env=os.environ.copy(), shell=shell) except subprocess.CalledProcessError: if fail: raise FatalError(_("Error running command: %s") % cmd) diff --git a/recipes/gtk-doc-lite.recipe b/recipes/gtk-doc-lite.recipe index b2c9980..2964107 100644 --- a/recipes/gtk-doc-lite.recipe +++ b/recipes/gtk-doc-lite.recipe @@ -8,7 +8,8 @@ class Recipe(recipe.Recipe): btype = BuildType.CUSTOM files_devel = ['bin/gtkdocize', 'share/aclocal/gtk-doc.m4', - 'share/gtk-doc/data/gtk-doc.make'] + 'share/gtk-doc/data/gtk-doc.make', + 'share/gtk-doc/data/gtk-doc.notmpl.make'] def prepare(self): self.remotes['origin'] = '%s/%s.git' % \ @@ -28,6 +29,8 @@ class Recipe(recipe.Recipe): os.path.join(aclocal_dir, 'gtk-doc.m4')) shutil.copy(os.path.join(self.build_dir, 'gtk-doc.make'), os.path.join(data_dir, 'gtk-doc.make')) + shutil.copy(os.path.join(self.build_dir, 'gtk-doc.notmpl.make'), + os.path.join(data_dir, 'gtk-doc.notmpl.make')) gtkdocize = os.path.join(self.config.prefix, 'bin', 'gtkdocize') shutil.copy(os.path.join(self.build_dir, 'gtkdocize.in'), gtkdocize) replacements = {'@PACKAGE@': 'gtk-doc', '@VERSION@': self.version, |