Commit d3d21970 authored by Antoine Catton's avatar Antoine Catton

Merge branch 'gitweb'

parents 101a7b23 9b1d0a0d
[buildout] [buildout]
extends =
../patch/buildout.cfg
# https://bugs.busybox.net/show_bug.cgi?id=4838 parts = busybox
[busybox-1.19.3.packed_hack.patch]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename}
md5sum = faa5ce46be086763202d7ca24601fbde
filename = busybox-1.19.3.packed_hack.patch
download-only = true
[busybox] [busybox]
recipe = slapos.recipe.build recipe = slapos.recipe.build
url = http://busybox.net/downloads/busybox-1.19.4.tar.bz2 url = http://git.busybox.net/busybox/snapshot/busybox-1_20_1.tar.gz
md5sum = 9c0cae5a0379228e7b55e5b29528df8e md5sum = 15758fc37ae8051d6def1b8afb691821
patch-binary = ${patch:location}/bin/patch
patch-options = -p1
patches =
${busybox-1.19.3.packed_hack.patch:location}/${busybox-1.19.3.packed_hack.patch:filename}
script = script =
extract_dir = self.extract(self.download(%(url)r, %(md5sum)r)) extract_dir = self.extract(self.download(%(url)r, %(md5sum)r))
workdir = guessworkdir(extract_dir) workdir = guessworkdir(extract_dir)
self.applyPatchList(self.options.get('patches'), self.options.get('patch-options'), self.options.get('patch-binary'), workdir)
call(['patch', 'defconfig'], cwd=workdir, env=env)
self.logger.info("Creating default configuration") self.logger.info("Creating default configuration")
call(['make', 'defconfig'], cwd=workdir, env=env) call(['make', 'defconfig'], cwd=workdir, env=env)
self.logger.info("Building") self.logger.info("Building")
......
diff --git a/miscutils/ubi_tools.c b/miscutils/ubi_tools.c
index 2a426db..35f44ac 100644
--- a/miscutils/ubi_tools.c
+++ b/miscutils/ubi_tools.c
@@ -60,6 +60,16 @@
//kbuild:lib-$(CONFIG_UBIUPDATEVOL) += ubi_tools.o
#include "libbb.h"
+#if 1
+// __packed hack for broken kernel headers ubi-user.h
+// See: https://lkml.org/lkml/2011/6/22/25
+// Once ubi-user.h is correctly installed without "__packed", or kernel
+// guys correct this another way (with a compiler header??), this can
+// go away.
+# ifndef __packed
+# define __packed __attribute__((packed))
+# endif // ndef __packed
+#endif // 1
#include <mtd/ubi-user.h>
#define OPTION_M (1 << 0)
...@@ -21,9 +21,13 @@ configure-options = ...@@ -21,9 +21,13 @@ configure-options =
--with-expat=${libexpat:location} --with-expat=${libexpat:location}
--without-python --without-python
--without-tcltk --without-tcltk
environment = environment =
NO_PERL=y NO_PERL=y
PATH=${curl:location}/bin:${gettext:location}/bin:%(PATH)s PATH=${curl:location}/bin:${gettext:location}/bin:%(PATH)s
CPPFLAGS=-I${zlib:location}/include CPPFLAGS=-I${zlib:location}/include
LDFLAGS=-L${zlib:location}/lib -L${openssl:location}/lib -Wl,-rpath=${openssl:location}/lib -Wl,-rpath=${zlib:location}/lib LDFLAGS=-L${zlib:location}/lib -L${openssl:location}/lib -Wl,-rpath=${openssl:location}/lib -Wl,-rpath=${zlib:location}/lib
[gitweb]
<= git
make-targets = install-gitweb
make-options = bindir="${git:location}/bin/"
[buildout]
parts =
libyaml
[libyaml]
recipe = hexagonit.recipe.cmmi
url = http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
md5sum = 36c852831d02cf90508c29852361d01b
[buildout]
extends =
../libyaml/buildout.cfg
parts = ruby
[ruby-1.9.3]
recipe = hexagonit.recipe.cmmi
url = http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
md5sum = bc0c715c69da4d1d8bd57069c19f6c0e
configure-options =
--enable-shared --enable-rpath
environment =
CFLAGS=-I${libyaml:location}/include
LDFLAGS=-L${libyaml:location}/lib -Wl,-rpath=${libyaml:location}/lib
[ruby-1.9]
<= ruby-1.9.3
[ruby]
<= ruby-1.9
...@@ -62,6 +62,7 @@ setup(name=name, ...@@ -62,6 +62,7 @@ setup(name=name,
'erp5testnode = slapos.recipe.erp5testnode:Recipe', 'erp5testnode = slapos.recipe.erp5testnode:Recipe',
'generate.mac = slapos.recipe.generatemac:Recipe', 'generate.mac = slapos.recipe.generatemac:Recipe',
'generate.password = slapos.recipe.generatepassword:Recipe', 'generate.password = slapos.recipe.generatepassword:Recipe',
'gitinit = slapos.recipe.gitinit:Recipe',
'nbdserver = slapos.recipe.nbdserver:Recipe', 'nbdserver = slapos.recipe.nbdserver:Recipe',
'onetimeupload = slapos.recipe.onetimeupload:Recipe', 'onetimeupload = slapos.recipe.onetimeupload:Recipe',
'helloworld = slapos.recipe.helloworld:Recipe', 'helloworld = slapos.recipe.helloworld:Recipe',
...@@ -119,10 +120,12 @@ setup(name=name, ...@@ -119,10 +120,12 @@ setup(name=name,
'sshkeys_authority.request = slapos.recipe.sshkeys_authority:Request', 'sshkeys_authority.request = slapos.recipe.sshkeys_authority:Request',
'sphinx= slapos.recipe.sphinx:Recipe', 'sphinx= slapos.recipe.sphinx:Recipe',
'stunnel = slapos.recipe.stunnel:Recipe', 'stunnel = slapos.recipe.stunnel:Recipe',
'template = slapos.recipe.template:Recipe',
'testnode = slapos.recipe.testnode:Recipe', 'testnode = slapos.recipe.testnode:Recipe',
'urlparse = slapos.recipe._urlparse:Recipe', 'urlparse = slapos.recipe._urlparse:Recipe',
'vifib = slapos.recipe.vifib:Recipe', 'vifib = slapos.recipe.vifib:Recipe',
'waitfor = slapos.recipe.waitfor:Recipe', 'waitfor = slapos.recipe.waitfor:Recipe',
'wrapper = slapos.recipe.wrapper:Recipe',
'xvfb = slapos.recipe.xvfb:Recipe', 'xvfb = slapos.recipe.xvfb:Recipe',
'xwiki = slapos.recipe.xwiki:Recipe', 'xwiki = slapos.recipe.xwiki:Recipe',
'zabbixagent = slapos.recipe.zabbixagent:Recipe', 'zabbixagent = slapos.recipe.zabbixagent:Recipe',
......
##############################################################################
#
# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import json
import os
from subprocess import check_call
from slapos.recipe.librecipe import GenericBaseRecipe
class Recipe(GenericBaseRecipe):
def install(self):
repolist = json.loads(self.options['repos'])
for repo in repolist:
absolute_path = os.path.join(self.options['base-directory'], '%s.git' % repo)
if not os.path.exists(absolute_path):
check_call([self.options['git-binary'], 'init',
'--bare', absolute_path])
check_call([self.options['git-binary'], 'config', 'http.receivepack', 'true'],
cwd=absolute_path)
return []
...@@ -47,15 +47,13 @@ def _wait_files_creation(file_list): ...@@ -47,15 +47,13 @@ def _wait_files_creation(file_list):
def execute(args): def execute(args):
"""Portable execution with process replacement""" """Portable execution with process replacement"""
# Note: Candidate for slapos.lib.recipe # XXX: Kept for backward compatibility
os.execv(args[0], args + sys.argv[1:]) generic_exec([args[0], None, None])
def execute_wait(args): def execute_wait(args):
"""Execution but after all files in args[1] exists""" """Execution but after all files in args[1] exists"""
exec_list = list(args[0]) # XXX: Kept for backward compatibility
file_list = list(args[1]) generic_exec([args[0], args[1], None])
_wait_files_creation(file_list)
os.execv(exec_list[0], exec_list + sys.argv[1:])
child_pg = None child_pg = None
...@@ -63,23 +61,27 @@ child_pg = None ...@@ -63,23 +61,27 @@ child_pg = None
def executee(args): def executee(args):
"""Portable execution with process replacement and environment manipulation""" """Portable execution with process replacement and environment manipulation"""
exec_list = list(args[0]) # XXX: Kept for backward compatibility
environment = args[1] generic_exec([args[0], None, args[1]])
env = os.environ.copy()
for k,v in environment.iteritems():
env[k] = v
os.execve(exec_list[0], exec_list + sys.argv[1:], env)
def executee_wait(args): def executee_wait(args):
"""Portable execution with process replacement and environment manipulation""" """Portable execution with process replacement and environment manipulation"""
# XXX: Kept for backward compatibility
generic_exec(args)
def generic_exec(args):
exec_list = list(args[0]) exec_list = list(args[0])
file_list = list(args[1]) file_list = args[1]
environment = args[2] environment_overriding = args[2]
env = os.environ.copy()
for k,v in environment.iteritems(): exec_env = os.environ.copy()
env[k] = v if environment_overriding is not None:
exec_env.update(environment_overriding)
if file_list is not None:
_wait_files_creation(file_list) _wait_files_creation(file_list)
os.execve(exec_list[0], exec_list + sys.argv[1:], env)
os.execve(exec_list[0], exec_list + sys.argv[1:], exec_env)
def sig_handler(signal, frame): def sig_handler(signal, frame):
print 'Received signal %r, killing children and exiting' % signal print 'Received signal %r, killing children and exiting' % signal
......
##############################################################################
#
# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import os
from slapos.recipe.librecipe import GenericBaseRecipe
class Recipe(GenericBaseRecipe):
def install(self):
mapping = self.options.copy()
for key in ('output', 'template', 'recipe', 'mode'):
if key in mapping:
del mapping[key]
with open(self.options['output'], 'w') as output, \
open(self.options['template'], 'r') as template:
output.write(template.read() % mapping)
if 'mode' in self.options:
os.chmod(self.options['output'], int(self.options['mode'], 8))
return [self.options['output'], ]
##############################################################################
#
# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import shlex
from slapos.recipe.librecipe import GenericBaseRecipe
class Recipe(GenericBaseRecipe):
def install(self):
command_line = shlex.split(self.options['command-line'])
wait_files = self.options.get('wait-for-files')
if wait_files is not None:
wait_files = [filename.strip() for filename in wait_files.split()
if filename.strip()]
environment = self.options.get('environment')
if environment is not None:
environment = {k.strip(): v.strip() for k, v in [
line.split('=')
for line in environment.split('\n')
]}
return [self.createPythonScript(
self.options['output'],
'slapos.recipe.librecipe.execute.generic_exec',
(command_line, wait_files, environment,),
)]
#!/usr/bin/env sh
GIT_PROJECT_ROOT="%(projectdir)s" GIT_HTTP_EXPORT_ALL= exec "%(githttpbackend)s" $@
#!/usr/bin/env sh
GITWEB_CONFIG="%(gitwebconf)s" exec "%(perl)s" "%(gitweb)s" $@
$projectroot = '%(projectdir)s';
$site_name = '%(sitename)s';
# Beautiful URLs
$feature{'pathinfo'}{'default'} = [1];
PidFile "%(pidfile)s"
Listen %(ip)s:%(port)s
ServerAdmin someone@email
ErrorLog "%(errorlog)s"
LogLevel warn
ScriptSock "%(cgidsock)s"
<Directory />
AllowOverride None
Order deny,allow
Deny from all
</Directory>
Alias "/static/" "%(gitwebstaticdir)s"
<Directory "%(gitwebstaticdir)s">
Options FollowSymLinks
Order deny,allow
Allow from all
</Directory>
# This is Static Accelerated git pull
AliasMatch "^/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$" "%(projectdir)s/$1"
AliasMatch "^/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$" "%(projectdir)s/$1"
# When it can't be statically delivered, we rely on git-http-backend
ScriptAliasMatch \
"(?x)^/(.*/(HEAD | \
info/refs | \
objects/info/[^/]+ | \
git-(upload|receive)-pack))$" \
"%(githttpbackend)s/$1"
# Everything else is gitweb interface
ScriptAlias "/" "%(gitwebscript)s/"
<Location />
Order deny,allow
Allow from all
</Location>
<LocationMatch "^/.*/git-receive-pack$">
AuthType Basic
AuthName "Git Push Access"
AuthBasicProvider file
AuthUserFile "%(passwdfile)s"
Require valid-user
SetEnv REMOTE_USER $REDIRECT_REMOTE_USER
</LocationMatch>
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule alias_module modules/mod_alias.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgid_module modules/mod_cgid.so
LoadModule env_module modules/mod_env.so
LoadModule unixd_module modules/mod_unixd.so
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
parts =
httpd
publish
[publish]
recipe = slapos.cookbook:publish
url = http://$${pwgen:user}:$${pwgen:password}@[$${httpd-conf:ip}]:$${httpd-conf:port}/
[httpd]
recipe = slapos.cookbook:wrapper
command-line = ${apache:location}/bin/httpd -DFOREGROUND -f "$${httpd-conf:output}"
output = $${basedirectory:services}/httpd
[httpd-conf]
recipe = slapos.cookbook:template
template = ${template-httpd-conf:location}/${template-httpd-conf:filename}
output = $${rootdirectory:etc}/httpd.conf
pidfile = $${basedirectory:run}/httpd.pid
errorlog = $${basedirectory:log}/httpd-errorlog.log
gitwebstaticdir = ${gitweb:location}/share/gitweb/static/
gitwebscript = $${gitweb-cgi:output}
githttpbackend = $${git-http-backend-cgi:output}
cgidsock = $${basedirectory:run}/cgid.sock
projectdir = $${gitweb-conf:projectdir}
passwdfile = $${htpasswd:output}
ip = $${slap-network-information:global-ipv6}
port = 8080
[gitweb-conf]
recipe = slapos.cookbook:template
template = ${template-gitweb-conf:location}/${template-gitweb-conf:filename}
output = $${rootdirectory:etc}/gitweb.conf
projectdir = $${git-repos:base-directory}
sitename = $${slap-parameter:title}
[gitweb-cgi]
recipe = slapos.cookbook:template
template = ${template-gitweb-cgi:location}/${template-gitweb-cgi:filename}
output = $${rootdirectory:bin}/gitweb.cgi
mode = 700
perl = ${perl:location}/bin/perl
gitweb = ${gitweb:location}/share/gitweb/gitweb.cgi
gitwebconf = $${gitweb-conf:output}
[git-http-backend-cgi]
recipe = slapos.cookbook:template
template = ${template-git-http-backend-cgi:location}/${template-git-http-backend-cgi:filename}
output = $${rootdirectory:bin}/git-http-backend.cgi
mode = 700
projectdir = $${git-repos:base-directory}
githttpbackend = ${git:location}/libexec/git-core/git-http-backend
[htpasswd]
recipe = collective.recipe.cmd
output = $${rootdirectory:etc}/httpd.htpasswd
on_install = true
on_udptae = true
cmds =
${apache:location}/bin/htpasswd -cb $${:output} $${pwgen:user} $${pwgen:password}
[pwgen]
recipe = slapos.cookbook:pwgen
file = $${buildout:directory}/.password
pwgen-binary = ${pwgen:location}/bin/pwgen
user = slapos
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc/
srv = $${buildout:directory}/srv/
var = $${buildout:directory}/var/
bin = $${buildout:directory}/bin/
[basedirectory]
recipe = slapos.cookbook:mkdirectory
services = $${rootdirectory:etc}/run/
run = $${rootdirectory:var}/run/
git-repos = $${rootdirectory:srv}/git/
log = $${rootdirectory:var}/log/
[git-repos]
recipe = slapos.cookbook:gitinit
base-directory = $${basedirectory:git-repos}
repos = $${slap-parameter:repos}
git-binary = ${git:location}/bin/git
[slap-parameter]
title = GitSlap
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
parts =
switch-softwaretype
[switch-softwaretype]
recipe = slapos.cookbook:softwaretype
default = ${template-gitrepo:output}
[buildout]
extends =
../../component/apache/buildout.cfg
../../component/perl/buildout.cfg
../../component/git/buildout.cfg
../../component/pwgen/buildout.cfg
../../stack/slapos.cfg
parts =
apache
perl
git
gitweb
slapos-cookbook
template
template-gitrepo
collective-recipe-cmd
[template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
md5sum = 5917cf0a9d6cc5d6d184e89ca2d72a91
output = ${buildout:directory}/template.cfg
mode = 0644
[template-gitrepo]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-gitrepo.cfg
md5sum = 79ebc1f23443562b3facd4945f031fcf
output = ${buildout:directory}/template-gitrepo.cfg
mode = 0644
[template-download]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename}
download-only = true
[template-gitweb-cgi]]
<= template-download
filename = gitweb.cgi.in
md5sum = 977d23296605d6a7f33f4f83d5bd29c8
[template-gitweb-conf]
<= template-download
filename = gitweb.conf.in
md5sum = bdf4b9e616e7b8e436040304bf1ac312
[template-git-http-backend-cgi]
<= template-download
filename = git-http-backend.cgi.in
md5sum = 814393f919dd0204c913aa77e6183b9c
[template-httpd-conf]
<= template-download
filename = httpd.conf.in
md5sum = f1056dbad1281929cd49c24e62ecc88e
[collective-recipe-cmd]
recipe = zc.recipe.egg
eggs =
collective.recipe.cmd
[version]
slapos.cookbook =
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