Commit 3355a856 authored by Marco Mariani's avatar Marco Mariani

Merge remote-tracking branch 'origin/master' into lapp

parents 413b1820 c98cc19a
......@@ -28,7 +28,8 @@ filename = imagemagick-6.6.6-1-no-gsx-gsc-probe.patch
[imagemagick]
recipe = hexagonit.recipe.cmmi
url = ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.7.8-8.tar.bz2
#url = ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.7.8-8.tar.bz2
url = http://ftp.vim.org/ImageMagick/ImageMagick-6.7.8-8.tar.bz2
md5sum = 4e5c8f102f3e7401587c924f5b4bca15
depends =
${libtiff:version}
......
......@@ -10,9 +10,9 @@ parts =
[libtiff]
recipe = hexagonit.recipe.cmmi
version = 4.0.2
#url = http://download.osgeo.org/libtiff/tiff-${:version}.tar.gz
url = http://download.osgeo.org/libtiff/tiff-${:version}.tar.gz
# server is down - circumvent
url = http://www.imagemagick.org/download/delegates/tiff-${:version}.tar.gz
#url = http://www.imagemagick.org/download/delegates/tiff-${:version}.tar.gz
md5sum = 04a08fa1e07e696e820a0c3f32465a13
configure-options =
--disable-static
......
......@@ -78,7 +78,7 @@ class Recipe(GenericBaseRecipe):
if not os.path.exists(secret_key_filename):
secret_key = uuencode(os.urandom(45)).strip()
# Remove unsafe characters
secret_key = secret_key.translate(None, '"\'')
secret_key = secret_key.translate(None, '"\'\\')
with open(secret_key_filename, 'w') as secret_key_file:
secret_key_file.write(secret_key)
else:
......
......@@ -35,6 +35,8 @@ import urlparse
import pkg_resources
import zc.buildout
from slapos.recipe.librecipe import shlex
class GenericBaseRecipe(object):
"""Boilerplate class for all Buildout recipes providing helpful methods like
creating configuration file, creating wrappers, generating passwords, etc.
......@@ -107,6 +109,28 @@ class GenericBaseRecipe(object):
path, arguments=arguments)[0]
return script
def createWrapper(self, name, command, parameters):
"""
Creates a very simple (one command) shell script for process replacement.
Takes care of quoting.
"""
q = shlex.quote
lines = [
'#!/bin/sh',
'exec %s' % shlex.quote(command)
]
for param in parameters:
if len(lines[-1]) < 30:
lines[-1] += ' ' + shlex.quote(param)
else:
lines[-1] += ' \\'
lines.append('\t' + shlex.quote(param))
content = '\n'.join(lines) + '\n'
return self.createFile(name, content, 0700)
def createDirectory(self, parent, name, mode=0700):
path = os.path.join(parent, name)
if not os.path.exists(path):
......
# -*- coding: utf-8 -*-
"""
backported part of shlex.py from Python 3.3
"""
import re
_find_unsafe = re.compile(r'[^\w@%+=:,./-]', 256).search
def quote(s):
"""Return a shell-escaped version of the string *s*."""
if not s:
return "''"
if _find_unsafe(s) is None:
return s
# use single quotes, and put single quotes into double quotes
# the string $'b is then quoted as '$'"'"'b'
return "'" + s.replace("'", "'\"'\"'") + "'"
......@@ -7,6 +7,7 @@
"type": "integer",
"default": 1024,
"minimum": 128,
"divisibleBy": 128,
"maximum": 16384
},
"disk-size": {
......
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