Commit 458a1816 authored by Łukasz Nowak's avatar Łukasz Nowak

- move eggs to proper place

 - reuse externals to fetch eggs (temporally solution)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33865 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ee4f0263
# svn propset svn:externals -F ./EXTERNALS.TXT .
z3c.recipe.openoffice http://svn.zope.org/repos/main/z3c.recipe.openoffice/branches/erp5-downloadcache
erp5.timmy https://svn.erp5.org/repos/public/erp5/trunk/utils/erp5.timmy/
erp5.timmy https://svn.erp5.org/repos/public/erp5/trunk/utils/erp5.timmy
erp5.recipe.bt5checkout https://svn.erp5.org/repos/public/erp5/trunk/utils/erp5.recipe.bt5checkout
erp5.recipe.mysqldatabase https://svn.erp5.org/repos/public/erp5/trunk/utils/erp5.recipe.mysqldatabase
erp5.recipe.openoffice https://svn.erp5.org/repos/public/erp5/trunk/utils/erp5.recipe.openoffice
erp5.recipe.standaloneinstance https://svn.erp5.org/repos/public/erp5/trunk/utils/erp5.recipe.standaloneinstance
Changelog
=========
0.1 (2010-02-25)
----------------
- intial version
[luke]
infrae.subversion wrapper for Business Templates
================================================
Easy way to define which Business Templates to download to which folders.
[infrae]
urls =
http://server/path/SOMETHING/revision SOMETHING
[bt5checkout]
base = http://server/path/
revision = revision
urls =
SOMETHING # it will become http://server/path/SOMETHING/revision SOMETHING for infrae.subversion
from setuptools import setup, find_packages
name = "erp5.recipe.bt5checkout"
version = '0.1'
def read(name):
return open(name).read()
long_description=(
read('README.txt')
+ '\n' +
read('CHANGES.txt')
)
setup(
name = name,
version = version,
author = "Lukasz Nowak",
author_email = "luke@nexedi.com",
description = "ZC Buildout recipe to fetch easily BT5 from SVN",
long_description=long_description,
license = "ZPL 2.1",
keywords = "zope2 buildout",
classifiers=[
"License :: OSI Approved :: Zope Public License",
"Framework :: Buildout",
"Framework :: Zope2",
],
packages = find_packages('src'),
include_package_data = True,
package_dir = {'':'src'},
namespace_packages = ['erp5', 'erp5.recipe'],
install_requires = [
'infrae.subversion',
],
zip_safe=False,
entry_points = {'zc.buildout': ['default = %s:Recipe' % name]},
)
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
# Copyright (c) 2006-2008 Zope Corporation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
import infrae.subversion
class Recipe(infrae.subversion.Recipe):
def __init__(self, buildout, name, options):
base, revision, urls = options['base'], options['revision'], \
options['urls']
new_url_list = []
for url in options['urls'].split('\n'):
if url:
url = '%s/%s/%s %s' % (base, url, revision, url)
new_url_list.append(url)
options['urls'] = '\n'.join(new_url_list)
infrae.subversion.Recipe.__init__(self, buildout, name, options)
Changelog
=========
1.0 (2010-03-17)
----------------
- Initial version
[Rafael Monnerat]
Introduction
============
This recipe generates a new database on a mysql server.
Example
=======
You can use it with a part like this::
[default-database]
recipe = erp5.recipe.mysqldatabase
mysql_database_name = somename
mysql_user = root
mysql_password =
mysql_superuser = root
mysql_superpassword =
Options
=======
mysql_database_name
Mysql Database name.
mysql_host
Hostname which is running your mysql server. By Default uses localhost.
(Optional).
mysql_port
Port Number which is running your mysql server. By Default uses 3306.
(Optional).
mysql_user
User of new database, used to grant privilegies on the new database.
mysql_password
User's Password of new database, used to grant privilegies on the new
database.
mysql_superuser
User of mysql used to connect to mysql server to create the database.
mysql_superpassword
Password of user defined at mysql_superuser.
from setuptools import setup, find_packages
name = "erp5.recipe.mysqldatabase"
version = '1.0'
def read(name):
return open(name).read()
long_description=( read('README.txt')
+ '\n' +
read('CHANGES.txt')
)
setup(
name = name,
version = version,
author = "Nexedi",
author_email = "info@nexedi.com",
description = "ZC Buildout recipe for create a mysql database",
long_description=long_description,
license = "ZPL 2.1",
keywords = "zope2 buildout",
url='http://www.erp5.org/HowToUseBuildout',
classifiers=[
"License :: OSI Approved :: Zope Public License",
"Framework :: Buildout",
"Framework :: Zope2",
],
packages = find_packages('src'),
package_dir = {'': 'src'},
install_requires = ['zc.recipe.egg', ],
namespace_packages = ['erp5', 'erp5.recipe'],
entry_points = {'zc.buildout': ['default = %s:Recipe' % name]},
)
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
# Copyright (c) 2006-2008 Zope Corporation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
import os
import logging
import zc.buildout
class Recipe(object):
def __init__(self, buildout, name, options):
self.buildout, self.options, self.name = buildout, options, name
self.logger=logging.getLogger(self.name)
options['location'] = os.path.join(
buildout['buildout']['parts-directory'],
self.name,
)
options.setdefault('mysql_host', 'localhost')
options.setdefault('mysql_port', '3306')
def install(self):
options = self.options
location = options['location']
try:
import MySQLdb
except ImportError:
raise ImportError('To be able to create database MySQLdb is required'
' Install system wide or use software generated python')
database_name, user, password, port, host\
= \
options.get('mysql_database_name'), \
options.get('mysql_user'), \
options.get('mysql_password'), \
options.get('mysql_port'), \
options.get('mysql_host')
if not (database_name and user):
raise zc.buildout.UserError('database_name and user are '
'required to create database and grant privileges')
connection = MySQLdb.connect(
host = self.options.get('mysql_host'),
port = int(self.options.get('mysql_port')),
user = self.options.get('mysql_superuser'),
passwd = self.options.get('mysql_superpassword'),
)
connection.autocommit(0)
cursor = connection.cursor()
cursor.execute(
'CREATE DATABASE IF NOT EXISTS %s DEFAULT CHARACTER SET utf8 COLLATE '
'utf8_unicode_ci' % database_name)
privileges = ['GRANT ALL PRIVILEGES ON %s.* TO %s' % (
database_name, user)]
if host:
privileges.append('@%s' % host)
if password:
privileges.append(' IDENTIFIED BY "%s"' % password)
cursor.execute(''.join(privileges))
connection.commit()
connection.close()
return location
update = install
from setuptools import setup, find_packages
name = "erp5.recipe.openoffice"
version = '0.1'
setup(
name = name,
version = version,
author = "Nicolas Dumazet",
author_email = "nicolas.dumazet@nexedi.com",
description = "ZC Buildout recipe to install openoffice",
license = "ZPL 2.1",
keywords = "openoffice buildout",
classifiers=[
"License :: OSI Approved :: Zope Public License",
"Framework :: Buildout",
],
packages = find_packages('src'),
include_package_data = True,
package_dir = {'':'src'},
namespace_packages = ['erp5', 'erp5.recipe'],
install_requires = [
'z3c.recipe.openoffice',
],
zip_safe=False,
entry_points = {'zc.buildout': ['default = %s:Recipe' % name]},
)
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
# Copyright (c) 2006-2008 Zope Corporation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
import z3c.recipe.openoffice.recipe as original
import os
import platform
class Recipe(original.Recipe):
"""
Wrap z3c.recipe.openoffice to allow selecting the architecture
"""
def __init__(self, buildout, name, options):
machine = platform.uname()[-2]
if machine in ('i386', 'i586', 'i686'):
target = 'x86_32'
elif machine == 'x86_64':
target = 'x86_64'
else:
raise ValueError('Unknown machine')
options['download-url'] = options['download-%s' % target]
original.Recipe.__init__(self, buildout, name, options)
self.options['tmp-storage'] = buildout['buildout'].get('download-cache',
os.path.join(buildout['buildout']['directory'], 'download'))
Changelog
=========
0.4 (2010-03-18)
----------------
- continue fixing of deletion of data - update of instance could result in
buildout having stored location of instance, which then could be removed
[luke]
0.3 (2010-03-17)
----------------
- do not enable not set any preferences
[luke]
0.2 (2010-03-10)
----------------
- fix issues, that during uninstallation instance data was removed
[luke]
0.1 (2010-02-12)
----------------
- intial version
[luke]
Zope standalone instance
========================
This recipe is useful to create standalone Zope instance independent from
buildout tree.
Specification
=============
This recipe shall provide safe instance creation and updating. It shall mix
Zope level instance creation with ERP5 site bootstrap (erp5.recipe.zope2install
+ erp5.recipe.createsite). On update only filesystem will be *safely* updated
without touch user produced data (mostly from ZODB).
DISCLAIMER
==========
Until some stability will be met everything can change without any further
notice, without backward compatibility, possibly with *removing* existing data
produced by previous versions.
- be even more isolated
- support for Zope and ZEO
- in case of one Zope add normal directory
from setuptools import setup, find_packages
name = "erp5.recipe.standaloneinstance"
version = '0.4'
def read(name):
return open(name).read()
long_description=(
read('README.txt')
+ '\n' +
read('CHANGES.txt')
)
setup(
name = name,
version = version,
author = "Lukasz Nowak",
author_email = "luke@nexedi.com",
description = "ZC Buildout recipe to install standalone instance",
long_description=long_description,
license = "ZPL 2.1",
keywords = "zope2 buildout",
classifiers=[
"License :: OSI Approved :: Zope Public License",
"Framework :: Buildout",
"Framework :: Zope2",
],
packages = find_packages('src'),
include_package_data = True,
package_dir = {'':'src'},
namespace_packages = ['erp5', 'erp5.recipe'],
install_requires = [
'plone.recipe.zope2instance',
'erp5.recipe.mysqldatabase',
],
zip_safe=False,
entry_points = {'zc.buildout': ['default = %s:Recipe' % name]},
)
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
# Create an ERP5 instance
# usage: zopectl run create_erp5_instance [options] [business templates]
import os
from optparse import OptionParser
from urllib import unquote
from Testing.makerequest import makerequest
from AccessControl.SecurityManagement import newSecurityManager
parser = OptionParser()
parser.add_option("-p", "--portal_id", dest="portal_id",
help="The ID of the Portal", default="erp5")
parser.add_option("--erp5_sql_connection_string",
dest="erp5_sql_connection_string",
help="Connection String used for ZSQLCatalog "
"(use %20 for space)",
default="test test")
parser.add_option("--cmf_activity_sql_connection_string",
dest="cmf_activity_sql_connection_string",
help="Connection String used for CMFActivity")
parser.add_option("--erp5_catalog_storage",
dest="erp5_catalog_storage",
help="Business Template for Catalog Storage")
parser.add_option("-u", "--initial-user",
dest="user_and_pass",
help="User and Password, separated by :",
default="zope:zope")
parser.add_option("--bt5-path",
dest="bt5_path",
help="Path to folder containing business templates. "
"Can be multiple, separated by commas.",
default="bt5")
(options, args) = parser.parse_args()
# cmf activity connection string defaults to zsqlcatalog's one
if not options.cmf_activity_sql_connection_string:
options.cmf_activity_sql_connection_string = \
options.erp5_sql_connection_string
# connection strings have to contain a space, for conveniance, this space can
# be replaced by %20 character.
options.erp5_sql_connection_string =\
unquote(options.erp5_sql_connection_string)
options.cmf_activity_sql_connection_string =\
unquote(options.cmf_activity_sql_connection_string)
username, password = options.user_and_pass.split(':')
try:
import transaction
except ImportError:
class Transaction:
def commit(self):
return get_transaction().commit()
transaction = Transaction()
app = makerequest(app)
user = app.acl_users.getUserById(username)
if user is None:
uf = app.acl_users
uf._doAddUser(username, password, ['Manager', 'Member', 'Assignee',
'Assignor', 'Author'], [])
user = uf.getUserById(username)
newSecurityManager(None, user.__of__(app.acl_users))
portal = getattr(app, options.portal_id, None)
if portal is None:
add_dict = dict(
id=options.portal_id,
erp5_sql_connection_string=options.erp5_sql_connection_string,
cmf_activity_sql_connection_string=\
options.cmf_activity_sql_connection_string,
erp5_catalog_storage='erp5_mysql_innodb_catalog' )
print 'Adding ERP5 site with parameters %r' % add_dict
app.manage_addProduct['ERP5'].manage_addERP5Site(**add_dict)
transaction.commit()
portal = app._getOb(options.portal_id)
# install our business templates
bt5_list = []
bt5_path_list = []
for i in options.bt5_path.split('\n'):
bt5_path_list.extend(i.split(","))
for arg in args:
bt_path = None
for path in bt5_path_list:
bt_path = os.path.join(path, arg)
if os.path.exists(bt_path):
break
else:
bt_path = None
if bt_path is None:
raise ValueError('Business Template %s not found in paths %s' % (arg,
options.bt5_path))
installed_bt = portal.portal_templates.getInstalledBusinessTemplate(arg)
if installed_bt is not None:
# XXX this way works only for extracted business template, not for
# *.bt5 packed business template.
version = file('%s/bt/version' % bt_path).read().strip()
revision = file('%s/bt/revision' % bt_path).read().strip()
if version == installed_bt.getVersion() and \
revision == installed_bt.getRevision():
print 'Skipping bt %s' % bt_path
continue
else:
print 'Updating bt %s' % bt_path
else:
print 'Installing bt %s' % bt_path
bt = portal.portal_templates.download(bt_path)
bt.install(force=True)
transaction.commit()
transaction.commit()
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