Commit 1b15aebe authored by Łukasz Nowak's avatar Łukasz Nowak

Merge improvements done by Antoine Catton.

Squashed commit of the following:

commit 275d6e017f06a6a1a038cd1543b3b08f21448178
Merge: 4234290 319c7223
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Sep 8 15:20:10 2011 +0200

    Merge branch 'master' into suggested-improvements

    Conflicts:
    	slapos/recipe/build.py

commit 42342905ad325eefa921de1bc814dd74505ea131
Author: Antoine Catton <acatton@tiolive.com>
Date:   Thu Sep 8 15:12:11 2011 +0200

    Minor: use shlex to parse patch options

commit 7994dcc87afd528ea405c57e2c441b9424018863
Author: Antoine Catton <acatton@tiolive.com>
Date:   Thu Sep 8 15:11:21 2011 +0200

    Buxfix: the patch wasn't send in stdin

commit ee8f324921c7675c764f1c1e05eecf4c1da225f7
Author: Antoine Catton <acatton@tiolive.com>
Date:   Thu Sep 8 12:04:22 2011 +0200

    Use shlex to split command line
parent 319c7223
...@@ -28,6 +28,7 @@ import logging ...@@ -28,6 +28,7 @@ import logging
import os import os
from platform import uname from platform import uname
import setuptools import setuptools
import shlex
import shutil import shutil
import subprocess import subprocess
import tempfile import tempfile
...@@ -86,7 +87,14 @@ def call(*args, **kwargs): ...@@ -86,7 +87,14 @@ def call(*args, **kwargs):
def calls(call_string, **kwargs): def calls(call_string, **kwargs):
"""Subprocesser caller which allows to pass arguments as string""" """Subprocesser caller which allows to pass arguments as string"""
call(call_string.split(), **kwargs) call(shlex.split(call_string), **kwargs)
def calli(*args, **kwargs):
"""Subprocesser call wich allow to pass stdin argument"""
popen = subprocess.Popen(*args, **kwargs)
popen.communicate()
if popen.returncode != 0:
raise subprocess.CalledProcessError(popen.returncode, ' '.join(args[0]))
def guessworkdir(path): def guessworkdir(path):
...@@ -330,7 +338,7 @@ class Script: ...@@ -330,7 +338,7 @@ class Script:
if patch_options is None: if patch_options is None:
patch_options = [] patch_options = []
else: else:
patch_options = patch_options.split() patch_options = shlex.split(patch_options)
if patch_binary is None: if patch_binary is None:
patch_binary = 'patch' patch_binary = 'patch'
else: else:
...@@ -353,7 +361,7 @@ class Script: ...@@ -353,7 +361,7 @@ class Script:
patch_options = patch_options.split(' ') patch_options = patch_options.split(' ')
kwargs['stdin'] = open(self.download(patch, md5sum)) kwargs['stdin'] = open(self.download(patch, md5sum))
self.logger.info('Applying patch %r' % patch) self.logger.info('Applying patch %r' % patch)
call([patch_binary] + patch_options, **kwargs) calli([patch_binary] + patch_options, **kwargs)
class Cmmi(Script): class Cmmi(Script):
"""Simple configure-make-make-install compatible with hexagonit.recipe.cmmi """Simple configure-make-make-install compatible with hexagonit.recipe.cmmi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment