Commit 753dde13 authored by Nicolas Dumazet's avatar Nicolas Dumazet

Add a way to generate a Mandriva spec given the buildout infos


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32667 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a808af9e
[buildout]
# temporary solution for fast system preparation to run buildout
develop = recipes/createmandrivaspec
parts =
[dependency]
......@@ -30,3 +31,16 @@ package_list =
command = echo "${:package_list}" | xargs sudo urpmi --auto
update_command = ${:command}
[erp5-official-buildout]
recipe = createmandrivaspec
input = ${buildout:directory}/templates/${:base}.in
output = ${buildout:directory}/${:base}
name = erp5-official-buildout
version = ${buildout:directory}/VERSION.txt
package_list = ${dependency:package_list}
svnpath = https://svn.erp5.org/repos/public/erp5/trunk/buildout
# only a helper variable
base = erp5-official-buildout-mandriva2010.spec
import os
import collective.recipe.template
class Recipe(collective.recipe.template.Recipe):
def __init__(self, buildout, name, options):
"""
Create a Mandriva RPM spec file from a template
- input: path to spec template
- output: path where generated spec should be saved
- version: rpm version number, can be either the version
or a file path containing the version
- (section) name: rpm name
- build_requires: a list of Mandriva packages required to build the rpm
- svnpath: SVN path to current buildout
optional:
- release: rpm release number. Defaults to 1
"""
package_list = options['package_list'].splitlines()
package_list = map(lambda x: x.strip(), package_list)
dependencies = ["BuildRequires: %s" % pkg for pkg in package_list if pkg]
version = options['version'].strip()
print '"%s"' % version
if os.path.exists(version):
version = open(version, 'r').read().strip()
release = options.get('release', str(1))
options.update(dependencies="\n".join(dependencies),
version=version,
release=release)
collective.recipe.template.Recipe.__init__(self, buildout, name, options)
from setuptools import setup, find_packages
name = "createmandrivaspec"
version = '0.1'
setup(
name = name,
version = version,
author = "Nicolas Dumazet",
author_email = "nicolas.dumazet@nexedi.com",
description = "ZC Buildout recipe to generate a Mandriva spec file",
license = "ZPL 2.1",
keywords = "mandriva buildout",
packages = find_packages(),
scripts = [name+".py",],
include_package_data = True,
classifiers=[
"License :: OSI Approved :: Zope Public License",
"Framework :: Buildout",
"Operating System :: POSIX :: Linux",
],
install_requires = [
'collective.recipe.template',
],
zip_safe=False,
entry_points = {'zc.buildout': ['default = %s:Recipe' % name]},
)
%define version ${:version}
%define name ${:name}
%define release ${:release}
# We do not actually use /usr/local/bin/python
%define _requires_exceptions /usr/local/bin/python
%define fullname %{name}-%{version}
%define installdir /opt/%{fullname}
Name: %{name}
Version: %{version}
Release: %mkrel %{release}
Summary: Open Source ERP Solution
URL: http://www.erp5.org
License: GPL
Vendor: Nexedi
Packager: Nicolas Dumazet <nicolas.dumazet@nexedi.com>
Group: Databases
${:dependencies}
BuildRoot: %{_tmppath}/%{fullname}-%{release}-root
%description
%{summary}
%prep
%{__rm} -rf %{installdir}
%{__mkdir_p} %{installdir}
%build
cd %{installdir}
svn co ${:svnpath} .
python bootstrap/bootstrap.py
bin/buildout
%install
%{__rm} -rf %{buildroot}
%{__mkdir_p} %{buildroot}
%{__cp} -ar --parents %{installdir} %{buildroot}
# cleanup .svn files
find %{buildroot} -name .svn -print0 | xargs -0 %{__rm} -rf
%files
%defattr(-, root, root, 0755)
%{installdir}
%clean
%{__rm} -rf %{buildroot} %{installdir}
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